"Advanced R" by Hadley Wickham is widely considered the best resource to improve your knowledge at R. However, going through it and answering every exercise takes a long time. This guide is designed to give you the most essential parts of Advanced R so that you can get going right away. It still will take a long time, but not as long.
--
1.) Quickly skim these chapters (without doing the exercises) to make sure you're familiar with the concepts:
2.) Read about Debugging, an important skill:
- Read "Debugging" from Advanced R, but don't do the exercises.
- Read about bettertrace.
3.) Hadley co-authored "R for Data Science". Read these two chapters and do all the exercises in them:
4.) Read the following chapters of "Advanced R":
- "Functions 102". Do the three exercises in the "Lexical scoping" section (the ones right after the "Dynamic lookup" subsection) and then go back and do the beginning quiz.
- "Functional Programming" Don't do any exercises.
- "Functionals". Do the first five exericses, but the rest are optional.
- "Function Operators" and do all the exercises.
- "Non-standard evaluation", exercises are optional.
- "Performance" but don't do the exercises.
- "Profiling" but don't do the exercises.
- "Memory" but don't do the exercises.
5.) Read on magrittr (%>%
) here and here.
6.) Make a function that takes another function and returns a function that will print all the arguments and then run the orginal function.
add <- function(x, y) x + y
fn <- arg_printer(add)
fn(2, 3)
[1] "I was called with 2 and 3."
[1] 5
7.) Make a function errors_are_nas
that takes an expression and returns an NA
if that expression fails instead of an error.
8.) Optional Read these chapters:
- "Visualization" - Good way to learn about ggplot2!
- "Tidy data"
9.) Optional Read on R6 classes. Try constructing a bank account class with deposit, check balance, and withdraw methods.
10.) Optional Learn about git, R Packages, and writing readable code.