R programming class, assignment #2

My solution - 2014-10-22