Week 11: Rewriting R code in C++
Guest Lecturer: Tomasz Wozniak
Main reference
What you will learn this week
- C++ for applications in R with Tomasz Woźniak
- The first steps with Rcpp
- Some stats with RcppArmadillo
- Hands-on coding with four exercises
- An R package with compiled code
Preparation to the session
You must have a cpp compiler installed on your computer. Follow the instructions from Section 1.3. by Eddelbuettel & François (2023). In short:
- Windows: install RTools
- macOS: install Xcode Command Line Tools
- Linux: install the standard development packages
Other references used during the session
- Armadillo library documentation
- Tsuda, M., Rcpp for everyone
Scripts used during the session
- Simple list creation
nicetry.cpp
- Simple linear regression example
nicelr.cpp
- Simple loop application
nicelist.cpp
- Sampling from inverted gamma 2 distribution
nicerig2.cpp
- Step-by-step package creation
nicepackage.R
Slides for week
Assignments
- Game package 1 is due on Tuesday 20 May.