25.8 Data frame functions

When you notice yourself copying and pasting multiple verbs multiple times, you might think about writing a data frame function.

Data frame functions work like dplyr verbs:

  • they take a data frame as the first argument,
  • some extra arguments that say what to do with it,
  • and return a data frame or vector.