My work of programming assignment 2 in the R Programming Course