Extending and growing R applications via an easy-to-use, robust, and performant C++ interface.
All key R data types map naturally into key C++ data structures, and simple interfaces make transfer back and forth very easy. And by composing more complex interfaces become possible.
Numerous examples, as well as extensive documentation, facilitate its use.

Rcpp makes it easy to create a first example. Just usecppFunction("...") and supply a valid C++ function in the argument string.
Here is a simple example from the introductory vignette:
library("Rcpp")cppFunction("bool isOddCpp(int num = 10) { bool result = (num % 2 == 1); return result;}")isOddCpp(42L)Of course, that function could be written in R (and we show an R variant in that vignette) but this provides a nice and simple stepping stone.

Rcpp makes it equally easy to source code from a file viasourcCpp("...") and supply a path to a file as the argument.
The well-known Fibonacci sequence can set-up this way:
#include "Rcpp.h"// [[Rcpp::export]]int fibonacci(const int x) { if (x< 2) return(x); return (fibonacci(x - 1)) + fibonacci(x - 2);}/*** Rsystem.time(print(fibonacci(30)))*/This shows another nice trick: We can include an R example use in our C++ file by placing it behind a marker of/*** R. Try it! On my computer, this call is still so fast thatsystem.time() can barely measure it!.

Rcpp is used byover 3000 packages on CRAN alone. Below is a small selection of some of the key packages.
The related websitegallery.rcpp.org contains over one hundred distinct examples, ranging from simple first steps on how to create certain data types for features to more complex applications examples. All examples are fully tested and should be runnable.
Best of all, it is open website to which

The Rcpp package comes with ten pdf vignettes documenting both first steps and more advanced use cases.
Thercpp-devel mailing can help with additional user- or developer questions.
The book, published in the SpringeruseR! series, isavailable from the publisher as both a soft-cover version (ISBN 978-1-4614-6867-7) and an e-book (ISBN 978-1-4614-6868-4). Institutions with a Springer Link subscription can also access it. Springer provideselectronic previews.
The book is also available fromAmazon and other on-line booksellers.
