hw3 in R