RE: [R] Creating a minimal package

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Mon 12 Jul 2004 - 23:16:23 EST


> From: Gabor Grothendieck
>

[snip]
>
> The objective should be that creating a package is as easy as this:
>
> f <- function()1; g <- function()2; d <- 3; e <- 4:5
> package.skeleton(list=c("f","g","d","e"), name="AnExample")
> library(AnExample)
> f()
>
> which means that the package needs to be inserted where library will
> find it. It should not be necessary to have an understanding of this.

To the best of my knowledge (which is not saying much, admittedly) no version of R on any OS would that work. package.skeleton() only create the directory tree and populate it with code and template files. You still need to package it up from a shell with R CMD build AnExample (or R CMD build --binary AnExample for Windows, and maybe Mac?). Then you need the install.package("AnExample", CRAN=NULL), before you can actually do library(AnExample).

BTW, for functions/objects that you would like to use over and over, but do not want to go through the hurdle of packaging, there's a fairly simple way to achieve similar effect: save all of them in a .rda file, and when you need them, just attach() the .rda file.

Let me bring up the old phrase: R is Open Source. If you want something bad enough, you can try to make it happen yourself. A good example is the scripting patch announced on R-devel by Neil McKay. Neil had provided patches to various versions of R for a while. If the packaging situation bothers you enough, feel free to contribute. I'm quite sure DM will be happy to get help...

Andy



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 12 23:34:55 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:35:36 EST