R code written for the three statistics assignments