Seamless R and C++ integration
open sourceGPL-2.0-or-laterfree
Rcpp is an R package that integrates R and C++: R functions and C++ classes map R's data types and objects to C++ equivalents and back, so slow R code can be rewritten in C++ and third-party C++ libraries used from R. cppFunction() compiles a C++ function given as a string, sourceCpp() compiles a C++ file and exports functions marked with an attribute, and packages can build their compiled code on it. It is documented in several vignettes, the Rcpp Gallery of over a hundred tested examples, papers and a book, and more than 3,000 CRAN packages use it.
Problems it solves
- speed up a slow loop in my R code by rewriting it in C++
- call a C++ library from R
- write an R package with compiled C++ code
Features
- maps R data types and objects to C++ and back
- cppFunction() to compile inline C++
- sourceCpp() with exported functions
- build R packages with compiled C++ code
- use third-party C++ libraries from R
- vignettes and the Rcpp Gallery of tested examples
