alters data frame for coursera class project in R