[R] *.R files for user libraries

Thomas Lumley tlumley at u.washington.edu
Fri Jun 22 17:14:12 CEST 2001

On Fri, 22 Jun 2001, Agustin Lobo wrote:

> Hi!
> The Writing R Extensions document (R-exts.pdf) states that,
> for creating an R library,
> ""
> The `R' subdirectory contains R code files. The code files to be installed
> must start with
> a (lower or upper case) letter and have one of the extensions `.R', `.S',
> `.q', `.r', or `.s'.
> ""
> Does this mean that each function sould go into
> a separate *.R file?
> I understand that I can save a given function as
> save(test,file="R/test.R")

No, no, no.  This saves a binary version of the file.  You need to use

> But I have many functions, should I make that each function
> go to a separate file? Is there any utility for doing
> this?

One file or many is ok. Most people find it easier to write the functions
in .R files to begin with, but the new 1.3.0 has an experimental function
package.skeleton() that does some of the work of setting up a package.

It is easier to find things in the documentation if you use our
terminology: you are trying to create a package, not a library. A library
is a place to put packages.


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

More information about the R-help mailing list