R包依赖 [英] R package dependencies

查看:263
本文介绍了R包依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建R软件包,但似乎软件包依赖关系存在一些问题.如果我在R中运行代码,则需要包"rgdal"和"rgeos",因此要从中创建包,我:

i'm trying to build a R package, but it seems that there are some problems with the package dependencies. If I run the code in R, I need the packages "rgdal" and "rgeos", so for creatng the package out of it, I:

  • 在名称空间文件中添加了"import(rgdal,rgeos)"行
  • 在"DESCRIPTION"文件中添加了"Depends:rgeos,rgdal"行

当我运行R CMD检查(构建后)时,出现错误消息:

When I run R CMD check (after build) I got an error which says:

* checking package dependencies ... ERROR
Benötigte, aber nicht verfügbare Pakete:
  'rgeos' 'rgdal'

See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.

错误的德语部分:Benötigte,需要,但没有可用的软件包".

German part of the error: "Benötigte, aber nicht verfügbare Pakete:" = "Needed, but not available packages".

我已经阅读了所提到的手册,并且知道了使用导入,建议或增强的选项,但是我敢肯定,这取决于我要使用的选项,因为在我的代码功能中,使用这两个软件包的外部功能.

I've read the mentioned manual and know about the options of using imports, suggestes or enhances but i'm pretty sure that depends is the option i've to use, because in the functions of my code, i'm using external functions of this both packages.

我在做什么错了?

推荐答案

R认为您的系统上没有软件包.

R thinks that you do not have the packages on your system.

现在您当然知道您知道.有什么区别?

Now you of course know that you do. What is the difference?

好吧,您可能将它们安装在另一个目录中,而R CMD check不在此目录中.解决此问题的一种方法在"R Internals"手册的第7节工具"(从"Writing R Extensions"中引用)中进行了描述,并使用文件~/.R/checkEnviron设置在R CMD check中使用的环境变量.

Well you probably have them installed in another directory which R CMD check does not look at. One way to fix this is described in Section 7 entitled "Tools" of the 'R Internals' manual (referenced from 'Writing R Extensions') and uses the file ~/.R/checkEnviron to set environment variables to be used during R CMD check.

例如,我有

# edd Apr 2003  Allow local install in /usr/local, also add a directory for
#               Debian packaged CRAN packages, and finally the default dir 
# edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:'
                          '/usr/lib/R/site-library:/usr/lib/R/library'}

我刚刚打破了一条长线(中间没有两个撇号).

where I just broke the one long line (there aren't two apostrophes in the middle).

这篇关于R包依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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