Solution to programming assignment 2 

"R Programming" course, Penn et al., Coursera