简体   繁体   English

通过install.packages()制作R包以进行安装

[英]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() ? R CMD install and install.packages() R CMD install .tar.gz.tgz文件有什么区别? I have made an example package with R CMD build , which I can currently install with R CMD install mypackage.tar.gz - and it works fine. 我已经使用R CMD build了一个示例包,我目前可以使用R CMD install mypackage.tar.gz - 它工作正常。 I want to be able to install it through the install.packages() function (with a call like install.packages("mypackage.tar.gz",repos=NULL) ). 我希望能够通过install.packages()函数安装它(通过调用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. 在Linux上,您可以使用您指定的命令安装.tar.gz软件包。 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). 如果您使用的是Mac OS X,则需要指定从源程序包而不是二进制文件进行安装(请参阅Mac上的“install.packages”)。 As Dirk said the .tgz packages are binary builds for Mac and you can build them on a Mac. 正如Dirk所说,.tgz包是Mac的二​​进制版本,你可以在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. 如果要为Windows构建程序包,请参阅http://win-builder.r-project.org/ ,这是一个用于从源代码构建二进制程序包的Web服务。

If you are planning to submit your package to CRAN, but wan't to test is first see Rforge 如果您打算将包裹提交给CRAN,但是不想测试是第一次看到Rforge

I think the .tgz is the binary package on OS X, just like windows gets a binary .zip . 我认为.tgz是OS X上的二进制包,就像windows获取二进制.zip Either one results from R CMD build . 任何一个都来自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. 因此,当您编写“已经使用R CMD build一个示例包,我目前可以使用R CMD install mypackage.tar.gz ”时,您不一致,因为.tar.gzR CMD BUILD结果步。 Start with the .tar.gz sources, make sure R CMD check and R CMD INSTALL work on them and then try R CMD binary . .tar.gz源开始,确保R CMD checkR CMD INSTALL对它们起作用,然后尝试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. 最后,对于install.packages()您需要由R CMD build --binary创建的二进制R CMD build --binary和包含文件PACKAGES等的基于Web的存储库 - 并且如help(install.packages) ,请参阅R Installation and Administration有关如何设置存储库的R Installation and Administration手册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM