R scripts with comments for assignment2