Solution to R Programming - Programming Assignment 2: Lexical Scoping