Sam's R script for week 1