Programming Assignment #2 of coursera 'R programming' course