Re: [Rd] How to organized code in the R/ directory of a package?

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Sat, 12 Dec 2009 18:33:59 +0100

>>>>> "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)



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat 12 Dec 2009 - 17:37:40 GMT

This archive was generated by hypermail 2.2.0 : Sat 12 Dec 2009 - 17:41:05 GMT