R 包:下划线在构建时添加到 RcppExports.R [英] R package: underscores added to RcppExports.R when building

查看:59
本文介绍了R 包:下划线在构建时添加到 RcppExports.R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在不同的计算机上使用 Rstudio 在同一个 R 包上工作,但出于某种原因,每当我构建包时,有些计算机会修改 RcppExports.RRcppExports.cpp 文件,在一些函数前添加下划线.例如,查看编译包前后文件之间的差异(第一行是之前,第二行是之后)可以发现:

I work from different computers on the same R package with Rstudio, but for some reason, whenever I build the package, some of the computers will modify the RcppExports.R and RcppExports.cpp files by adding underscore in front of some functions. For example, this can be found when looking at the dif between the files before and after compiling the package (first line is before, second is after):

    .Call('PkgName_FunctionName', PACKAGE = 'PkgName', arguments)
    .Call('_PkgName_FunctionName', PACKAGE = 'PkgName', arguments)

这让我很困扰,因为 git 认为这是一种改变.

This bothers me because git sees this as a change.

我的问题是:

  • 为什么包含下划线?
  • 如何才能编译包而不修改任何文件?

推荐答案

确保两台机器上的 Rcpp 版本相同(当前).然后 RcppExports.{R,cpp} 文件将是相同的.

Make sure you have the same (current) versions of Rcpp on both machines. Then the RcppExports.{R,cpp} files will be identical.

该更改是 R 上游(大约 R 3.4.0)的要求,我们需要进行调整.

The change was a requirement from R upstream (around R 3.4.0) and we needed to adjust.

另请注意,您可能希望 registration=TRUE 在您的 NAMESPACE 文件中,在这种情况下,表单将变为

Also note that you probably want registration=TRUE in your NAMESPACE file in which case the form becomes

.Call(`_PkgName_FunctionName`, arguments)

这篇关于R 包:下划线在构建时添加到 RcppExports.R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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