From ligges at statistik.uni-dortmund.de  Thu Nov 11 09:39:50 2004
From: ligges at statistik.uni-dortmund.de (Uwe Ligges)
Date: Thu Nov 11 09:39:30 2004
Subject: [Rd] Questions on package creation
In-Reply-To: <loom.20041111T064049-272@post.gmane.org>
References: <loom.20041111T064049-272@post.gmane.org>
Message-ID: <41932556.1070409@statistik.uni-dortmund.de>

Gabor Grothendieck wrote:

> I have some questions about 
> 
>    1. nomenclature, 
>    2. recommended file locations and 
>    3. overall procedure related to creating packages.
> 
> To the extent that it matters, examples here relate to Windows XP
> R 2.0.1 beta.  
> 
> The questions are interspersed and prefaced with ***.
> 
> My understanding is that there are actually 6 forms of a package
> that one should use in package development:
> 
> 1. original package.  This refers to the original source files, 
>    documentation and other files that the author develops.  
>    If source control, e.g. svn, is used then these are the files 
>    that are under source control.  They are kept in some arbitrary 
>    location on one's disk.  Let us say \usr\mypackage, for example.
> 
> *** Is there some standard name for this form of the package?
> 
> 2. source archive.  This is created from the original package
>    like this:
> 
>      cd \Program Files\rw2001beta
>      bin\R CMD build /usr/mypackage

You won't need to cd to anything.


>    which creates, say
> 
>      \Program Files\rw2001beta\mypackage_1.0-1.tar.gz
> 
>    The source archive is distinct from the original archive since it
>    is specific to a version of R and excludes the files referenced
>    in \usr\mypackage\.Rbuildignore

and others, e.g., .cvs files.


> *** Is \Program Files\rw2001beta the correct place to put this
>    .tar.gz file?


It's arbitrary where to save it, I would not save it in the R directory, 
though.


> 3. source tree.  This is created from the gzipped tar archive in #2
>    like this:
> 
>      cd \Program Files\rw2001beta
>      gzip -d mypackage_1.0-1.tar.gz
>      cd src\library
>      tar xvf ..\..\mypackage_1.0-1.tar
> 
>    and is checked like this:
> 
>      cd \Program Files\rw2001beta
>      bin\R CMD check mypackage
> 
> 4. binary archive.  This is created from the source archive in #2
>    or the source tree in #3:
> 
>       cd \Program Files\rw2001beta
>       bin\R CMD build mypackage --binary
>

or join this with step 5 using
R CMD INSTALL --build mypackage

>    which creates \Program Files\rw2001beta\myhpackage_1.0-1.zip
> 
> *** Is \Program Files\rw2001beta the correct place to put this?


... also arbitrary (as above) ...


> 5. installed package.  This installed by:
> 
>      cd \Program Files\rw2001beta
>      bin\R CMD install mypackage
> 
>   which results in the source package being installed in:
>   
>      \Program Files\rw2001beta\library\mypackage
> 
>   This can alternately be done with the R GUI menu: 
> 
>     Packages | Install package(s) from local zip files
> 
> 6. loaded package.  In R using the command:
> 
>      library(mypackage)
> 
>    loads the package into R.  This can alternately be done
>    using the R GUI menu:
> 
>       Packages | Load package
> 
> One might initially skip #3 and #4 and just test the package out
> in R after #6 and once one is satisfied that it is in good shape
> repeat the sequence.
> 
> *** Is all the above the correct and recommended sequence?

As always: It depends. Nothing of the above is completely wrong.



> *** Someone mentioned that --force is important.  How does that 
>     fit into all this?  I still have not used it and am not sure
>     about it.

It is used to overwrite the INDEX file.

Uwe Ligges

> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Questions on package creation
Uwe Ligges