Exposing C++ functions and classes with Rcpp modules

To read the full-text of this research, you can request a copy directly from the authors.


This note discusses Rcpp modules which have been introduced in version 0.8.1 of the Rcpp package. Rcpp modules allow programmers to expose C++ functions and classes to R with relative ease. Rcpp modules are inspired from the Boost.Python C++ library (Abrahams and Grosse-Kunstleve, 2003) which provides the same features (and much more) for Python.

No full-text available

Request Full-text Paper PDF

To read the full-text of this research,
you can request a copy directly from the authors.

... The Module construct (Eddelbuettel and François, 2016) is useful for the internal implementation of ManifoldOptim. When constructing a module in R, the user implicitly creates a C++ problem which can be accessed by the C++ solver. ...
Full-text available
Manifold optimization appears in a wide variety of computational problems in the applied sciences. In recent statistical methodologies such as sufficient dimension reduction and regression envelopes, estimation relies on the optimization of likelihood functions over spaces of matrices such as the Stiefel or Grassmann manifolds. Recently, Huang, Absil, Gallivan, and Hand (2016) have introduced the library ROPTLIB, which provides a framework and state of the art algorithms to optimize real-valued objective functions over commonly used matrix-valued Riemannian manifolds. This article presents ManifoldOptim, an R package that wraps the C++ library ROPTLIB. ManifoldOptim enables users to access functionality in ROPTLIB through R so that optimization problems can easily be constructed, solved, and integrated into larger R codes. Computationally intensive problems can be programmed with Rcpp and RcppArmadillo, and otherwise accessed through R. We illustrate the practical use of ManifoldOptim through several motivating examples involving dimension reduction and envelope methods in regression.
... Each method is wrapped individually which allows us to add user-friendly custom error handling, type coercion, and performance improvements at the cost of a more verbose implementation. The RProtoBuf package in many ways motivated the development of Rcpp Modules (Eddelbuettel and François 2013), which provide a more concise way of wrapping C++ functions and classes in a single entity. ...
Full-text available
Modern data collection and analysis pipelines often involve a sophisticated mix of applications written in general purpose and specialized programming languages. Many formats commonly used to import and export data between different programs or systems, such as CSV or JSON, are verbose, inefficient, not type-safe, or tied to a specific programming language. Protocol Buffers are a popular method of serializing structured data between applications - while remaining independent of programming languages or operating systems. They offer a unique combination of features, performance, and maturity that seems particularly well suited for data-driven applications and numerical computing. The RProtoBuf package provides a complete interface to Protocol Buffers from the R environment for statistical computing. This paper outlines the general class of data serialization requirements for statistical computing, describes the implementation of the RProtoBuf package, and illustrates its use with example applications in large-scale data collection pipelines and web services.
Building Hybrid Systems with Boost
  • D Abrahams
  • R W Grosse-Kunstleve
D. Abrahams and R. W. Grosse-Kunstleve. Building Hybrid Systems with Boost.Python. Boost Consulting, 2003. URL
Rcpp R/C++ interface package
  • D Eddelbuettel
  • R François
D. Eddelbuettel and R. François. Rcpp R/C++ interface package, 2010. URL package=Rcpp. R package version 0.8.1.
  • R Development Core
  • Team
R Development Core Team. Writing R Extensions. R Foundation for Statistical Computing, Vienna, Austria, 2010. URL