First commit of my answer to
Coursera's R programming assignment 2