The Verbs

Ben Baumer

dplyr lives in the tidyverse

dplyr highlights

The Five Verbs:

  • select()

  • filter()

  • mutate()

  • arrange()

  • summarize()

Plus:

  • group_by()

  • rename()

  • inner_join()

  • left_join()

Read more

Philosophy

  • Each verb takes a data frame and returns a data frame
    • actually a tbl_df (more on that later)
    • allows chaining with %>% or |>
  • Idea:
    • master a few simple commands
    • use your creativity to combine them
  • Cheat Sheet:

What is a tibble?

  • object of class tbl

  • a re-imagining of a data.frame

  • it looks and acts like a data.frame

  • but it’s even better…

  • tidyverse works with tibbles

footnote

select(): take a subset of the columns

filter(): take a subset of the rows

mutate(): add or modify a column

arrange(): sort the rows

summarize(): collapse to a single row