Abstract

The Rcpp package simplies integrating C++ code with R. It provides a consistent C++ class hierarchy that maps various types of R objects (vectors, matrices, functions, environments, . . . ) to dedicated C++ classes. Object interchange between R and C++ is managed by simple, exible and extensible concepts which include broad support for C++ Standard Template Library idioms. C++ code can both be compiled, linked and loaded on the y, or added via packages. Flexible error and exception code handling is provided. Rcpp substantially lowers the barrier for programmers wanting to combine C++ code with R.

Highlights

  • The R language and environment (R Core Team, 2018a) has established itself as both an increasingly dominant facility for data analysis, and the lingua franca for statistical computing in both research and application settings.Since the beginning, and as we argue below, “by design”, the R system has always provided an application programming interface (API) suitable for extending R with code written in C or Fortran

  • As we argue below, “by design”, the R system has always provided an application programming interface (API) suitable for extending R with code written in C or Fortran

  • Being implemented in R and C, R has always been extensible via a C interface

Read more

Summary

Introduction

The R language and environment (R Core Team, 2018a) has established itself as both an increasingly dominant facility for data analysis, and the lingua franca for statistical computing in both research and application settings. As we argue below, “by design”, the R system has always provided an application programming interface (API) suitable for extending R with code written in C or Fortran. Being implemented in R and C (with a generous sprinkling of Fortran for well-established numerical subroutines), R has always been extensible via a C interface. Both the actual implementation and the C interface use 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. This article introduces Rcpp, and illustrates with several examples how the Rcpp Attributes mechanism (Allaire et al, 2019) in particular eases the transition of objects between R and C++ code

Background
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call