Skip to content

R-ex directory in a R package; large software in R

5 messages · jonathan_li@agilent.com, Thomas Lumley, Kaiya Liu +2 more

#
Hi,

To better organize a package, one sometimes wants to place some individual R
files in R-ex directory (at least this
is the way I understand the functionality of R-ex). But how does one
organize the source R package so that 
R CMD INSTALL pkg will know which R files will go into the R-ex directory?
In the implementation R CMD INSTALL pkg, all R files in the pkg/R directory
are automatically merged into a single file. 

A more general and related question is: how does one organize R files in a
package? Should they all just go into pkg/R? To create a large package, this
way of organization is not very desirable. Most of R packages seem to be
relatively small so far. But I am hoping that some larger software can be
built around R. Can people comment on this?

Thanks!

Regards,
Jonathan
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Fri, 1 Feb 2002 jonathan_li at agilent.com wrote:

            
No. R-ex/ contains examples automatically extracted from the help pages.
You can put tests in tests/ and other stuff you want installed in inst/
Presumably it wouldn't be too hard to allow the src/ and R/ subdirectories
to have further subdirectories.

On the other hand, if the source code really does break into nice modular
subdirectories it probably should be a bundle of packages rather than a
single package. Paul Gilbert has taken this approach with his time-series
software, and in a sense R-base does this too.

Also, there's no reason why the structure of a package has to reflect the
structure of your development tree. You might have a huge set of
subdirectories and a make target that produces an R package or bundle of
packages.


	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Fri, 1 Feb 2002 jonathan_li at agilent.com wrote:
[...]
I would dispute that there are not examples of large packages: certainly
some involve man-years of work.  You will notice that pkg/R is normally
organized into files, each file containing a collection of related
functions. It doen't need to be like that: rpart for example is `one
function, one file' but built from a particular SCCS organization.
But unless the project is really large that seems a natural level of
granularity.

As Thomas has commented, a source package is a distribution model. That is
not how for masters of, e.g. the VR bundle are stored but rather generated
by a script.  For personal use one can omit the INSTALL set and build a
binary package directly if more convenient.
2 days later
#
On Fri, 1 Feb 2002 jonathan_li at agilent.com wrote:

            
I'm not sure what you mean by large, but if you think you have more than a
single package then you should consider the bundle mechanism for grouping
packages together. Multiple packages helps you sort out the relationship between
parts of your code and also provides a good mechanism for maintaining it. Also,
if you use "make" for maintaining and testing your code, then smaller packages
provides a reasonably efficient mechanism for sorting out dependencies.

I have about 18,000 lines of R code (one of those useless measures that is often
quoted) and about 11,000 lines of documentation organized in 18 packages grouped
in three bundles (dse on CRAN, dseplus on CRAN/devel, and a bundle that I don't
distribute). I maintain it mainly for my research interests, it is a small part
of my full time job, and I also have a family. I think the reason for separating
code into packages has more to do with sorting out the logical structure of your
code than it has to do with any limitations of R. I can provide more details if
you like.

Paul Gilbert
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._