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/? Does 'R CMD INSTALL' install the files in the subdirectories automatically?
How to organized code in the R/ directory of a package?
7 messages · Tobias Verbeke, Hadley Wickham, Peng Yu +2 more
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. Best, Tobias
Does 'R CMD INSTALL' install the files in the subdirectories automatically?
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
I have 145 R files in ggplot2, but don't have any problems navigating them (with appropriate tool support). Just how many files do you have? Hadley
On Thu, Dec 10, 2009 at 3:56 PM, Peng Yu <pengyu.ut at gmail.com> 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/? Does 'R CMD INSTALL' install the files in the subdirectories automatically?
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
I don't have many files yet. I'm just wondering what the convention of organizing files is, as different programming languages have different ways of organizing source code. I don't want to start in a wrong way and later to correct it. I don't see ggplot in a tar.gz file on your website. It is also removed from cran. Would you please let me know where I can download the source code to take a look? What 'appropriate tool support' do you refer to?
On Thu, Dec 10, 2009 at 4:29 PM, hadley wickham <h.wickham at gmail.com> wrote:
I have 145 R files in ggplot2, but don't have any problems navigating them (with appropriate tool support). ?Just ?how many files do you have? Hadley On Thu, Dec 10, 2009 at 3:56 PM, Peng Yu <pengyu.ut at gmail.com> 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/? Does 'R CMD INSTALL' install the files in the subdirectories automatically?
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
I don't see ggplot in a tar.gz file on your website. It is also removed from cran. Would you please let me know where I can download the source code to take a look?
It's ggplot2, not ggplot.
What 'appropriate tool support' do you refer to?
Your text editor should make it easy to switch to another file by typing in a few characters in its name. Hadley
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.
That is what I try to do. My rule is that functions which are documented in the same .Rd file are also in the same .R file. Might be more sensible for some packages than for others. David _________________________________________________________________ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics
1 day later
"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)