R Programming course Programming Assignment 3