R programming (Rstudio) assignment