R porgamming Coursera - Assignment 3