[R] Creating a minimal package

Douglas Bates bates at stat.wisc.edu
Tue Jul 13 15:49:04 CEST 2004


Duncan Murdoch wrote:
> On Mon, 12 Jul 2004 15:14:27 +0200, Uwe Ligges
> <ligges at statistik.uni-dortmund.de> wrote :
> 
> 
>>Gabor Grothendieck wrote:
> 
> 
>>>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.
>>>
>>
>>OK, I understand what you are going to do, but in that case you can use 
>>dump() into an *.R or save() into an *.RData file and use 
>>source()/load() to load it again. I don't see any advantage of a package 
>>if you don't want to modify documentation or other stuff in the package.
>>Also, you would need the tools to make a binary package from the source 
>>package somewhere. package.skeleton() is clearly not intended to be used 
>>for that purpose, but to create the template for your source package.
>>Hence the default should not be changed.
> 
> 
> I agree with both of you on this.  Currently the method that Uwe
> describes is a lot easier than creating a package, but I think the
> objective should be to make things almost as easy as Gabor describes.
> 
> Not completely as easy:  he's missing the step where the package is
> installed.  I think we want to keep that (because the distinction
> between the source of a package and the installed copy of it is
> important), but it should be easier to install a new package than it
> is now, especially in Windows.  So I'm suggesting that it would be
> nice to be able to do something like this:
> 
>  f <- function()1; g <- function()2; d <- 3; e <- 4:5
>  package.skeleton(list=c("f","g","d","e"), name="AnExample")
>  install.packages("AnExample", build = TRUE)
>  library(AnExample)
>  f()
> 
> but currently install.packages doesn't know how to build, and for most
> Windows users, a fairly substantial effort is necessary to obtain all
> the tools.
> 
> Duncan Murdoch

I haven't checked on the installation tools under Windows but I think 
that most, if not all, of the creation and installation of a binary 
package (i.e. building indices, etc.) could be done in R for packages 
that do not require compilation of source code and provided that you are 
willing to go without some forms of the man pages.




More information about the R-help mailing list