I wrote two functions for R Programming Assignment 2.