Reputation: 171
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
However, doing R CMD check --as-cran <myPackageName_1.0.0>.tar.gz
gives the following:
"Package in Depends/Imports which should probably only be in LinkingTo: '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."
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"
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".)
Upvotes: 4
Views: 1221
Reputation: 368499
Briefly:
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.
More broadly, the differences between LinkingTo: and Imports: are
So Writing R Extensions, or Hadley's online book for details.
Upvotes: 8