[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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, creator Dirk Eddelbuettel shares some behind-the-scenes making-of details.
Rcpp: Rcpp Gallery
To leave a comment for the author, please follow the link and comment on their blog: Revolutions.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.