R code and plots for the first assignement