在R中创建新软件包时安装其他软件包 [英] install other packages when creating new package in R

查看:115
本文介绍了在R中创建新软件包时安装其他软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个名为myPackage的R包.在该程序包中,我使用了其他程序包,例如RJSONIOstringrRSQLiteRcpp.我要在安装myPackage时安装所有这些软件包,如果以前没有安装过的话.

I created a R package called myPackage. In that package I've used other packages, such as, RJSONIO, stringr, RSQLite and Rcpp. I want to install all of those packages when I am installing myPackage, if it is not installed before.

这可能吗?

推荐答案

您可以在DEPENDS部分中指定软件包列表. /manuals/R-exts.html"rel =" nofollow>描述文件.从链接的文档文件中

You can specify a list of packages in the DEPENDS section of your DESCRIPTION file. From the linked documentation file

依赖"字段提供了以逗号分隔的软件包名称列表 该软件包所依赖的.包名称可以是可选的 后面加上括号中的注释.评论应包含一个 比较运算符,空格和有效的版本号.你可以 如果您的包裹依赖于 R的特定版本-例如,如果该软件包仅适用于R版本 2.11.0或更高版本,请在依赖"字段中添加"R(> = 2.11.0)".对于R-devel或R-patched,您还可能需要特定的SVN版本,例如 "R(> = 2.14.0),R(> = r56550)"要求的版本晚于R-devel (2011年7月下旬)(包括2.14.0的发行版本).两个都 库和R包检查工具使用此字段:因此它 使用不正确的语法或将"Depends"字段误用于 对其他可能需要的软件发表评论.其他依赖 (R系统外部)应在 "SystemRequirements"字段,可能在单独的自述文件中进行了放大 文件. R INSTALL设施检查所用R的版本是否为 最近安装的软件包足够的信息,以及 指定的软件包将被附加(检查版本后 要求),无论是在当前库之前,还是在调用库时 以及在安装过程中为延迟加​​载做准备时.

The ‘Depends’ field gives a comma-separated list of package names which this package depends on. The package name may be optionally followed by a comment in parentheses. The comment should contain a comparison operator, whitespace and a valid version number. You can also use the special package name ‘R’ if your package depends on a certain version of R — e.g., if the package works only with R version 2.11.0 or later, include ‘R (>= 2.11.0)’ in the ‘Depends’ field. You can also require a certain SVN revision for R-devel or R-patched, e.g. ‘R (>= 2.14.0), R (>= r56550)’ requires a version later than R-devel of late July 2011 (including released versions of 2.14.0). Both library and the R package checking facilities use this field: hence it is an error to use improper syntax or misuse the ‘Depends’ field for comments on other software that might be needed. Other dependencies (external to the R system) should be listed in the ‘SystemRequirements’ field, possibly amplified in a separate README file. The R INSTALL facilities check if the version of R used is recent enough for the package being installed, and the list of packages which is specified will be attached (after checking version requirements) before the current package, both when library is called and when preparing for lazy-loading during installation.

还有其他相关部分,例如IMPORTSSUGGESTS-有关详细信息,请参阅文档.

There are other related sections, such as IMPORTS and SUGGESTS - see the docs for details.

看看r-forge上的一些R-package以获得一个想法.

Have a look at some of the R-packages on r-forge to get an idea.

这篇关于在R中创建新软件包时安装其他软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆