Foreign function calls to a different package NOTE

╄→гoц情女王★ 提交于 2020-01-02 05:38:15

问题


I am preparing an R package for submission to CRAN. R CMD check gives me the following NOTE:

Foreign function calls to a different package:
.Fortran("cinc", ... PACKAGE = "cmprsk")
.Fortran("crstm", ... PACKAGE = "cmprsk")
See the chapter 'System and Foreign language interface' of the 'Writing R Extensions manual.

How do I get rid of this NOTE? I can't find the answer from either reading the chapter or searching the web. Maybe I am missing something very simple. I submit the package before for R2.x with the same code and never have this problem. This is something new for R3.x.


回答1:


The warning points you toward the 'System and Foreign language interface' chapter of the Writing R Extensions manual, which says specifically (in the Writing Portable Packages section):

It is not portable to call compiled code in R or other packages via .Internal, .C, .Fortran, .Call or .External, since such interfaces are subject to change without notice and will probably result in your code terminating the R process.

You can say what you like about the CRAN maintainers, but they're rarely wrong on technical points, and the reasons are almost always documented somewhere.

Some of your options are:

  • if you don't want to submit to CRAN, you can ignore the NOTE.
  • you could copy the Fortran (or C) code from the other package and incorporate it in your own (you might need to be careful about license, and it would certainly be polite to ask permission)
  • you could ask the maintainers of the other package to implement and export a thin R wrapper around their low-level code


来源:https://stackoverflow.com/questions/24150185/foreign-function-calls-to-a-different-package-note

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