R codes for Coursera class - April 2014