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.
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