We've written before about how you can use the Rcpp package to speed up R, by converting performance-critical snippets of R code to C++. (Rcpp makes it easy -- you don't even have to be a C++ expert.) If you haven't tried it out yet, you might want to browse the Rcpp Gallery: an collection of simple but illustrative examples showing many ways that Rcpp can help. A few choice entries:
- A one-line C++ equivalent to Mathematica's "Clip" function runs 5x faster than optimized R code
- Calculation of matrix eigenvalues in R using the Eigen C++ library
- Accessing the date-time attributes of R xts time series objects from C++ code
- Using a simulation method to estimate pi (note how similar the R and C++ versions are)
You can find many more examples in the gallery at the link below. If you're interested in making a similar gallery yourself, Dirk Eddelbuettel shares some behind-the-scenes making-of details from the gallery's creator, RStudio's JJ Allaire.
(Updated Jan 16.)
Rcpp: Rcpp Gallery
Comments