Writing functions in R troubling you? How and when to write your own functions (including the mysteries of non-standard evaluation and the ellipsis
Writing functions in R troubling you? How and when to write your own functions (including the mysteries of non-standard evaluation and the ellipsis