A function to demonstrate lexical scoping in R