Solution for Programming Assignment 2 of the R Programming Course