Training exercises in R