used for r-programming course @coursera (Assignment2)