Cpp11 + R examples

Here I show how to achieve some common tasks by integrating R and C++.

All the examples here use the cpp11 package, which is a header-only library that provides a C++11 interface to R's C API.

Contents

The examples here are meant to be instructional, and the goal is to be clear and simple, not to be efficient except when it is clearly stated. For example, the OLS example uses a naive approach to solve the problem, which is not the way R's lm() function does it. See this blog post.

Please see the respective README files for more information.

  • Integers
  • Doubles
  • Doubles matrices
  • Conditionals
  • Integers
  • Doubles
  • Lists
  • Loops (for)
  • OpenMP parallelization
  • Integers
  • Doubles
  • Doubles matrices
  • Conditionals
  • Loops (for)
  • Vendoring
  • Integers
  • Doubles
  • Doubles matrices
  • Conditionals
  • Loops (for and while)
  • Messages