Rcpp for Seamless R and C++ Integration

The Rcpp package has become the most widely used language extension for R, the powerful environment and language for computing with data. As of early 2013, over 100 packages on CRAN and a further 10 on BioConductor deploy Rcpp to extend R, to accelerate computations and to connect to other C++ projects.

This page provides a few pointers to other popular packages using Rcpp, as well as to a few related external sites.

A good introduction to Rcpp is provided by our JSS paper on Rcpp (also included in the package) and the numerous vignettes included in the package.

Rcpp Core Packages

Rcpp

Rcpp provides a powerful API on top of R, permitting direct interchange of rich R objects (including S3, S4 or Reference Class objects) between R and C++. Rcpp sugar gives syntactic sugar such as vectorised C++ expression; Rcpp modules provide easy extensibility using declarations and Rcpp attributes greatly facilitates code integration.

More details, documentation, vignettes are at the Rcpp page.

Learn More »

RcppArmadillo

Rcpp connects R with the powerful Armadillo templated C++ library for linear algebra. Armadillo aims towards a good balance between speed and ease of use, and its syntax is deliberately similar to Matlab which makes it easy to port existing code (as shown by an included Kalman Filter example).

More details, documentation, vignettes are at the RcppArmadillo page and in a paper about RcppArmadillo (CSDA, in press)

Learn More »

RcppEigen

RcppEigen gives R access to the high-performance Eigen linear algebra library. Eigen is also templated, and highly optimised. It provides a wide variety of matrix methods, various decompositions and includes support for sparse matrices.

Our recent JSS paper on RcppEigen, also included as a vignette in the package, provides a good introduction to RcppEigen, and the Eigen website has more details on Eigen itself.

RInside

RInside makes it easy to use R from inside another C++ by wrapping the existing R embedding API in an easy-to-use C++ class. Over a dozen basic example are included in the package, as well as more specialised example showing use of RInside with MPI for parallel computing, Qt for cross-platform GUIs, Wt for web applications, as well as the Armadillo and Eigen templated C++ libraries for linear algebras. See more on the RInside page.

Learn More »

Rcpp Application Packages

A small selection of packages which use Rcpp follows below. These are in most case small packages which can provides examples to build upon. See the Rcpp CRAN page for an up-to-date list.

RcppBDT

RcppBDT wraps the Boost Date_Time library and provides powerful and well test date, time and calendar functions. The package also shows how to write simple as<>() and wrap<>() converters.

RcppSMC

RcppSMC re-implements the Sequential Monte Carlo models from the JSS paper by Adam Johansen, and illustrates the usefulness of Rcpp for modern simulation-based methods.

RcppDE

RcppDE is a "port" of (an older version of) the DEoptim package. Converting from C to C++ reduced the code from 700 lines to 400 lines making it easier to deploy and extend. We also use Rcpp to allow a compiled objective function to be passed in for the optimization.

RcppCNPy

RcppCNPy is small single-purpose package which wraps around a small standalone C++ library to read and write Python NumPy files---so that R can now read and write NumPy data with ease.