R script for Programming Assignment 2