Coursera R class Programming Assignment no. 2