Writing Functions in R – Hadley Wickham
datacamp.com