我是否需要使用R包将RccpEigen导入R包的Description文件中,或者是“ LinkingTo”?足够? [英] Do I need to import RccpEigen in the DESCRIPTION file for an R package using it, or is "LinkingTo" enough?

查看:201
本文介绍了我是否需要使用R包将RccpEigen导入R包的Description文件中,或者是“ LinkingTo”?足够?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用RcppEigen.package.skeleton()作为向现有R包添加小功能的模板,因此我的DESCRIPTION文件现在包含以下行:

I used the RcppEigen.package.skeleton() as a template for adding a small function to an existing R package, so that my DESCRIPTION file now has the lines:

Imports: Rcpp (>= 0.11.3), RcppEigen (>= 0.3.2.3.0)
LinkingTo: Rcpp, RcppEigen

但是,执行 R CMD检查--as-cran< myPackageName_1.0.0> .tar.gz 给出以下内容:

However, doing R CMD check --as-cran <myPackageName_1.0.0>.tar.gz gives the following:

依赖项/导入项中的包可能仅应位于LinkingTo中:'RcppEigen'

"Package in Depends/Imports which should probably only be in LinkingTo: 'RcppEigen'"

Writing R Extensions页面说:如果在'LinkingTo'中指定一个软件包就可以了,只要它们是包含源代码或静态链接的C ++头文件就可以在安装时完成:这些软件包不需要(和通常不应该)列在依赖或导入字段中。这包括CRAN软件包BH以及几乎所有RcppArmadillo和RcppEigen的用户。

The Writing R Extensions page says: "Specifying a package in ‘LinkingTo’ suffices if these are C++ headers containing source code or static linking is done at installation: the packages do not need to be (and usually should not be) listed in the ‘Depends’ or ‘Imports’ fields. This includes CRAN packages BH and almost all users of RcppArmadillo and RcppEigen."

我不我不懂任何C ++,所以我不知道这意味着什么。我创建程序包的过程在这里: RcppEigen-从包中的内联函数转到.cpp函数,然后映射

I don't know any C++, so I don't know what this means. My procedure for creating the package is here: RcppEigen - going from inline to a .cpp function in a package and "Map"

是否可以从导入中删除RcppEigen ,为什么/为什么不呢? (即,您能否解释一下我的情况, Writing R Extension页面在说什么,以便我了解自己在做什么?我实验室的R和软件专家都说他们不理解导入之间的区别和 LinkingTo。)

Is it okay to remove the RcppEigen from "Imports" and why/why not? (i.e. Can you please explain what the Writing R Extension page is saying, for my case, so that I can understand what I'm doing? Both the R and software experts in my lab said they don't understand the difference between "Imports" and "LinkingTo".)

推荐答案

简而言之:


  1. CRAN上目前有25个使用RcppEigen的软件包。这进行了25个工作案例研究。您可以看一两个。

  2. LinkingTo:通常就足够了。

  3. 骨架生成器仍然添加Imports可能是一个错误。我们不再在RcppArmadillo中这样做。

当我刚刚为RcppArmadillo运行相应的功能时,我得到了

When I just ran the corresponding function for RcppArmadillo, I got

Imports: Rcpp (>= 0.11.3)
LinkingTo: Rcpp, RcppArmadillo

所以我倾向于一个错误。现在,我为此打开了发行票据

so I am leaning towards a bug. And I now opened an issue ticket for it.

更广泛地说,LinkingTo:和Imports之间的区别是:

More broadly, the differences between LinkingTo: and Imports: are


  • 导入:是Depends的首选现代替代方案;您还需要使用NAMESPACE

  • LinkingTo:主要用于指向头文件,如此处所示。

正在编写R扩展程序,或哈德利的在线图书以获取详细信息。

So Writing R Extensions, or Hadley's online book for details.

这篇关于我是否需要使用R包将RccpEigen导入R包的Description文件中,或者是“ LinkingTo”?足够?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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