Answer for R Programming Assignment2

Add the implementation of the fuctions