Data Challenge Lab Home

Function basics [program]

(Builds on: Exploratory data analysis (1D), Data structure basics)
(Leads to: Predicate functions, Vector functions, purrr basics, Tidy evaluation)

Functions are powerful tools for reducing the amount of duplication in your code. Reducing duplication is a good principle because it means that each “fact” in your code is only stored in one place. When the requirements of your code change (as they invariably do), you only need to make the change in a single place, reducing the chances of inconsistencies within your code.