This is the completed R file from programming assignment 2 in the R programming course.