Updated Programming Assignment 2 in R.