On 11-09-06 10:26 AM, Jannis wrote:
Dear list members,
i have build a package which contains a collection of my frequently used
functions. To keep the code organized I have broken down some rather extensive
and long functions into individual steps and bundled these steps in
sub-functions that are called inside the main function.
To keep an overview over which sub-function belongs to which main function I saved
all the respective sub-functions to the same *.R file as their main-function and gave
them names beginning with . to somehow hide the sub-functions. The result would be
one *.R file in<package>/R for each 'main-function' containing something like:
mainfunction<- function() {
.subfunction1()
.subfunction2()
#...
}
.subfunction1()<- function() {
#do some stuff
}
.subfunction2()<- function() {
#do some more stuff
}
According to the way I understood the "Writing R Extensions" Manual I expected this
to work. When I load the package, however, I get the error message that the sub-functions could
not be found. Manually sourcing all files in the<package>/R directory however yields the
expected functionality.
In what way am I mistaken here? Any ideas?
Those definitions of .subfunction1 and .subfunction2 are not
syntactically correct: extra parens. If that's just a typo in the
message, then you'll have to show us real code. What you describe
should work.
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.