[R] Creating a R package for Windows XP

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jun 19 18:27:54 CEST 2005


You have created a source package, and c:/R/rw2010/library is not the 
right place for a source package.  You need to move it somewhere else and 
INSTALL it, as described in the rw-FAQ.  (You need to move it because it 
would be installed into that directory and you are not allowed to clobber 
the sources by doing so.)

Both `Writing R Extensions' and `R Installation and Administration' 
manuals give more details: in particular the latter describes the tools 
you will need to collect.

On Sun, 19 Jun 2005, Jeffrey Pai wrote:

> Hi:
>
> I'm trying to create a package to pass to someone else to use a group of
> functions with help files.  I'm working on Windows XP.
>
> Step One:  I use the example
>
>>       ## two functions and two "data sets" :
>>       f <- function(x,y) x+y
>>       g <- function(x,y) x-y
>>       d <- data.frame(a=1, b=2)
>>       e <- rnorm(1000)
>>
>>       package.skeleton(name="mypkg", list=c("f","g","d","e"),
> + path="c:/R/rw2010/library", force=TRUE)
> Creating directories ...
> Creating DESCRIPTION ...
> Creating READMEs ...
> Saving functions and data ...
> Making help files ...
> Created file named 'c:/R/rw2010/library/mypkg/man/f.Rd'.
> Edit the file and move it to the appropriate directory.
> Created file named 'c:/R/rw2010/library/mypkg/man/g.Rd'.
> Edit the file and move it to the appropriate directory.
> Created file named 'c:/R/rw2010/library/mypkg/man/d.Rd'.
> Edit the file and move it to the appropriate directory.
> Created file named 'c:/R/rw2010/library/mypkg/man/e.Rd'.
> Edit the file and move it to the appropriate directory.
> Done.
> Further steps are described in c:/R/rw2010/library/mypkg/README
>
>
> Step Two:  I load the package "mypkg" from "Packages - load package..." and
> get
>
>> local({pkg <- select.list(sort(.packages(all.available = TRUE)))
> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> Error in library(pkg, character.only = TRUE) :
>        there is no package called 'mypkg'
>
> The DESCRIPTION file in /library/mypkg contains:
>
> Package: mypkgType: Package
> Title: What the package does (short line)
> Version: 1.0
> Date: 2005-06-19
> Author: Who wrote it
> Maintainer: Who to complain to <yourfault at somewhere.net>
> Description: More about what it does (maybe more than one line)
> License: What license is it under?
>
> The first line looks suspicious so I change it to two lines
>
> Package: mypkg
> Type: Package
>
> I load the package again and get
>
>> local({pkg <- select.list(sort(.packages(all.available = TRUE)))
> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> Error in library(pkg, character.only = TRUE) :
>        'mypkg' is not a valid package -- installed < 2.0.0?
>
>
> Step-Three:  I read the README file under \mypkg and do
>
>> R CMD build
> Error: syntax error
>
>
> Am I on the right track?  I've read several instructions regarding creating
> R packages for Windows on web and installed several files.  I must be
> missing something.
> Thank.
>
>
> Best Regards!
>
> Jeffrey Pai
> L.A.H. Warren Professor
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list