assignment 2 in R programming (lc)