[Rd] Re: [R] Creating a minimal package

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Jul 12 16:27:47 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()

[moved the thread to R-devel....]

Yes. That's the ideal solution.

Anyway, these days you still need perl, and what happens if you have got 
some C or Fortran sources?
Additionally, we can never do all the stuff without the tools. And I 
think you don't want to be able to do so, because maintaining the R 
sources will get much harder if development of the package management is 
that different under Unix-alikes and Windows. From my point of view the 
aim should be to join, not to diverge here ....

Uwe


BTW: Note that creating packages in such an easy manner does not remind 
people to write their documentation. And if nobody tells me to write 
documentation, my function will be useless (even for myself in a couple 
of weeks). But that's just the pedagogical part. ;-)



> 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



More information about the R-devel mailing list