example functions from R Programming - Assignment 2