Function R Programming Assignment 2 for R Programming Course