[R] packaging my function

Duncan Murdoch murdoch.duncan at gmail.com
Thu Oct 7 16:21:20 CEST 2010


  On 07/10/2010 10:06 AM, Mipam Bruining wrote:
> Dear all,
>
> I write to you because there seems to be something I'm just not 'getting' in
> the way R lets you construct a new package. Google and this mailing list's
> archive don't seem to have the answer to my specific case so I signed up and
> mailed the question myself.
>
> So I've written this function that I wan't to make a package out of. Here is
> what I've done so far:
>
> 1) I've used "package.skeleton(MyFunction)" on it  (with no futher
> arguments) to create the package.
> 2) I edited the DESCRIPTION file and the manual page in the man folder
> according to the specifications in the R tutorial
> 3) I opened a command window to run the commands "Rcmd build" and "Rcmd
> check" on my package  (my OS is windows Vista)
> 4) I corrected the warnings and errors given in the log file and repeated
> step3 until there were no more warnings
> 5) I started the RGui (version 2.10.1) to check if the package was working.
> I used the menu option "Install packages from local zip file'

R uses the following conventions:

*.tar.gz   -- a source package, as produced by R CMD build <pkg>
*.zip        -- a Windows binary package.  There are a couple of ways to 
produce one of these, usually the best is
                    R CMD INSTALL --build <pkg>

You didn't produce a zip file, so when you tried to install a tar.gz 
file, it failed.

For your own file, you can skip producing the .zip.  The easiest way is 
to use

R CMD INSTALL <pkg>

but you can also do it within R using

install.packages("<pkg>", repos=NULL, type="source")

In the examples above, <pkg> can be the directory where the package is 
stored, or (except for R CMD build) the name of a *.tar.gz file.

Duncan Murdoch

> This is were the problem occured. Namely, when trying to install my package
> from local zip file, I get the error message:
> >  utils:::menuInstallLocal()
> Error in gzfile(file, "r") : cannot open the connection
> In addition: Warning messages:
> 1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
> 2: In gzfile(file, "r") :
>    cannot open compressed file 'pggui_2.1.tar.gz/DESCRIPTION', probable
> reason 'No such file or directory'
>
>
> By checking the file manually, I can confirm that the DESCRIPTION file is in
> fact in the right location,  that it's content has the correct structure as
> dictated by the R tutorial, and that the file has all the right permissions
> granted.
>
> What could it be, and how can I find the answer to this problem?
>
> My thanks in advance,
> Mipam Bruining
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list