I have read this article several times, but still feel confused about the conclusion of it, which is don’t use C++ to interface with R. There have been so many R packages relying on C++, but now one of the R Core Team members is telling us that we shouldn't use C++ to interface with R. I used to think C++ is the solution for computation intensive tasks in R, since writing C or Fortran code is more challenging for most users.
https://developer.r-project.org/Blog/public/2019/03/28/use-of-c---in-packages/index.html
Hi,
The article is talking about writing C++ programs that make calls to R programs and explains the problems that can cause with the C++ code. Going the other way is not a problem (although it is a challenge), with RCpp
and other packages, an R package can bring in a C++ library and tons and tons of them do.
There was some discussion of this blog post on r-devel: https://stat.ethz.ch/pipermail/r-devel/2019-March/077560.html
In my opinion (formed after re-reads, research, and even asking around)- the original negative r-project.org article is wrong on some of its key technical points (for example: there is no C++ interface to R, article fails to emphasize Rcpp properly uses the C interface, article doesn't mention important history of .C versus .Call, and so on) and does not support a clear conclusion (let alone a conclusion of "don’t use C++ to interface with R"). I respect that the article is coming from a knowledgeable R authority, but feel the article has not been a good thing for the R community.
If the article had been carefully labeled as being only about "writing C++ programs that make calls to R" that would have helped. But it is hard to support that position as the original article starts with "About 20% packages from CRAN and BIOC repositories include some native code and more than a half of those include some code in C++". That commonly means R using C++ for extensions.
Perhaps the article should have been on a personal blog, or r-project.org should become a formally refereed source (if one is going to treat it as authoritative).
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.