
Loved by learners at thousands of companies
Course Description
R is a great language for data science, but sometimes the code can be slow to run. Combining the comfort of R with the speed of a compiled language
is a great way to reclaim the performance your code deserves.C++ is a modern, high performance language that is simple enough to learn
in the context of accelerating R code. With the help of the Rcpp package,
C++ integrates very neatly with R. You will learn how to create and manipulate
typical R objects (vectors and lists), and write your own C++ functions
to dramatically boost the performance of your R code.
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.- 1
Introduction
FreeWriting, benchmarking, and debugging your first C++ code.
- 2
Functions and Control Flow
Writing functions, controlling the flow with if and else, and learning to use the three kinds of loops in C++.
C++ functions belong to C++ files50 xpWhat happens when you compile this C++ file50 xpBoiler plate100 xpWriting functions in C++50 xpFirst function - again100 xpExported and unexported functions100 xpR code in C++ files100 xpif and if/else100 xpFor loops50 xpCalculating square roots with a for loop100 xpBreaking out of a for loop100 xpWhile loops50 xpCalculating square roots with a while loop100 xpDo it again: do-while loop100 xp - 3
Vector Classes
Manipulate and compute with Rcpp and native C++ vectors.
Rcpp classes and vectors50 xpFirst and last values of a vector50 xpIndexing a vector100 xpSum of double vector100 xpCreating vectors50 xpSequence of integers100 xpCreate vector with given values100 xpVector cloning100 xpWeighted mean50 xpWeighted mean (C++ version)100 xpHandling of missing values100 xpVectors from the STL50 xpDon't change the size of Rcpp vectors100 xpSTL vectors100 xp - 4
Case Studies
Use random numbers and write algorithms for applied time series models.
Random number generation50 xpScalar random number generation100 xpSampling from a mixture of distributions (I)100 xpSampling from a mixture of distributions (II)100 xpRolling operations50 xpRolling means100 xpRolling means (in C++)100 xpLast observation carried forward100 xpMean carried forward100 xpAuto regressive model50 xpSimulate AR(p) model100 xpSimulate MA(q) model100 xpARMA (p, q) model100 xpCongratulations!50 xp
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.collaborators


prerequisites
Introduction to Writing Functions in RJoin over 17 million learners and start Optimizing R Code with Rcpp today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.