R package: underscores added to RcppExports.R when building

纵然是瞬间 提交于 2019-12-10 10:32:57

问题


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)

This bothers me because git sees this as a change.

My questions are:

  • Why is the underscore included?
  • What can I do to have compiling the package not modify any of the files?

回答1:


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

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

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

.Call(`_PkgName_FunctionName`, arguments)


来源:https://stackoverflow.com/questions/48067213/r-package-underscores-added-to-rcppexports-r-when-building

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!