Function R Programming Assignment 3 for R Programming Course