2,570
Views
73
CrossRef citations to date
0
Altmetric
Article

Extending R with C++: A Brief Introduction to Rcpp

ORCID Icon & ORCID Icon
Pages 28-36 | Received 01 Jun 2017, Published online: 24 Apr 2018
 

ABSTRACT

R has always provided an application programming interface (API) for extensions. Based on the C language, it uses a number of macros and other low-level constructs to exchange data structures between the R process and any dynamically loaded component modules authors added to it. With the introduction of the Rcpp package, and its later refinements, this process has become considerably easier yet also more robust. By now, Rcpp has become the most popular extension mechanism for R. This article introduces Rcpp, and illustrates with several examples how the Rcpp Attributes mechanism in particular eases the transition of objects between R and C++ code. Supplementary materials for this article are available online.

Supplementary Materials

The online supplementary materials contain the code utilized in the article.

Acknowledgments

The authors thank Bob Rudis and Lionel Henry for comments and suggestion on an earlier draft of this manuscript. Furthermore, the authors appreciate the improved C++ annotated function graphic provided by Bob Rudis.

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.