Learning how to program in R