[Rd] How to organized code in the R/ directory of a package?
Martin Maechler
maechler at stat.math.ethz.ch
Sat Dec 12 18:33:59 CET 2009
>>>>> "DScottNZ" == David Scott <d.scott at auckland.ac.nz>
>>>>> on Fri, 11 Dec 2009 13:52:21 +1300 writes:
DScottNZ> Tobias Verbeke wrote:
>> Peng Yu wrote:
>>> I'm making a package, Current, I put all R files in the
>>> R/ directory in the package (without using
>>> subdirectory). This will become a problem when there are
>>> many files in the directory. I'm wondering how to use
>>> subdirectories in R/?
>>
>> The standard solution is (I would think) to organize the
>> code such that functions belonging together are grouped
>> in one file.
>>
DScottNZ> That is what I try to do. My rule is that
DScottNZ> functions which are documented in the same .Rd
DScottNZ> file are also in the same .R file. Might be more
DScottNZ> sensible for some packages than for others.
Yes. I typically even use less *.R than *.Rd files.
That's also the case for the R standard package sources:
The ratio #{R/*.R} / #{man/*.Rd} is ~ 44%
In my own packages, I see a ratio of slightly less than 40%.
Martin Maechler, ETH Zurich (and R core)
More information about the R-devel
mailing list