final submission for assignment 2 for R Programming