开发者

Making R packages for installation by install.packages()

What is the difference between .tar.gz or .tgz files installed by R CMD install and install.packages()? I have made an example package with R CMD build, which I can currently install with R C开发者_StackOverflowMD install mypackage.tar.gz - and it works fine. I want to be able to install it through the install.packages() function (with a call like install.packages("mypackage.tar.gz",repos=NULL)). What additional steps do I need to take?


It depends on your OS. On Linux you can install your .tar.gz package with the command you specify. If you are on Mac OS X, you need to specify that you are installing from source package and not binary (see ?install.packages on a Mac). As Dirk said the .tgz packages are binary builds for Mac and you can build them on a Mac.

If you want to build the package for Windows see http://win-builder.r-project.org/, which is a web service for building binary packages from source.

If you are planning to submit your package to CRAN, but wan't to test is first see Rforge


I think the .tgz is the binary package on OS X, just like windows gets a binary .zip. Either one results from R CMD build.

So when you write "have made an example package with R CMD build, which I can currently install with R CMD install mypackage.tar.gz" you are inconsistent as the .tar.gz was the source and the result of the R CMD BUILD step. Start with the .tar.gz sources, make sure R CMD check and R CMD INSTALL work on them and then try R CMD binary.

Lastly, for install.packages() you need both the binary packages created by R CMD build --binary and a web-based repository containing file PACKAGES etc --- and as help(install.packages) says, see the R Installation and Administration manual for how to set up a repository.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜