From maechler at stat.math.ethz.ch  Sat Dec 12 18:33:59 2009
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat, 12 Dec 2009 18:33:59 +0100
Subject: [Rd] How to organized code in the R/ directory of a package?
In-Reply-To: <4B2197C5.9030305@auckland.ac.nz>
References: <366c6f340912101356j1be51766lba30bc00de72e52f@mail.gmail.com>
	<4B2174B9.1050807@openanalytics.be>
	<4B2197C5.9030305@auckland.ac.nz>
Message-ID: <19235.54279.237965.469607@cmath-6.math.ethz.ch>

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



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