Resources for learning C++/Rcpp?

Does anyone have any good advice on learning C++/Rcpp? There are a ton of self-guided/online C++ tutorials out there. Do you recommend getting a good handle on the fundamentals of C++ on its own first? Or do you suggest working with Rcpp straight away and learn just enough C++ as you go along? Paid courses are also an option. Thanks very much for any advice/suggestions!

Andy

2 Likes

This is dependent on your goals. I started with the Rcpp docs/gallery/tutorials (and also relevant chapters of Advanced R), which taught just enough C++ and Rcpp for the specific tasks I needed to speed up in my R code. As what I was doing got more complex, I finally broke down and read a C++ book (I think it was Scott Meyers’ Effective C++, but I don’t remember).

I’ve found http://www.cplusplus.com/ VERY helpful, primarily as a reference, but it has some good tutorials as well.

1 Like

Thanks Naom. It’s a good point about what my goals are. Right now I don’t have a specific task in R that I need to speed up, but would like to add the skills to my toolbox generally. I know that I will lose some of what I learn if I don’t have a specific immediate use for it, but I also know that if I get some fundamentals I will be in a better position when I do have a need. I’ve also looked at http://www.cplusplus.com/ and it looks great.

Then I’d say definitely first work through the exercises in the Advanced R Rcpp chapter, then maybe work through some of the examples at http://gallery.rcpp.org/ that interest you, maybe in parallel with a book/web C++ tutorial. I would say it is extremely helpful to learn RcppArmadillo, (many examples in the gallery), and the Armadillo docs are very good, but are more reference than tutorial.

1 Like