Neat guide to {tidyverse} updates in R, by Mine Γ‡etinkaya-Rundel

This guide is intended for people teaching tidyverse, but it’s relevant to anyone (e.g., me!) trying to keep up with developments.

Everytime I load {tidyverse}, it advises me to use {conflicted}. I didn’t realise it would be this useful:

library(conflicted)
    
penguins |>
  filter(species == "Adelie")
#> Error:
#> ! [conflicted] filter found in 2 packages.
#> Either pick the one you want with `::`:
#> β€’ dplyr::filter
#> β€’ stats::filter
#> Or declare a preference with `conflicts_prefer()`:
#> β€’ `conflicts_prefer(dplyr::filter)`
#> β€’ `conflicts_prefer(stats::filter)`

Another neat update: case_when now doesn’t need type-specific NAs like NA_character_ for default cases.

# now, optionally
df |>
  mutate(
    x = case_when(
       ~ "value 1",
       ~ "value 2",
       ~ "value 3",
      .default = NA
    )
  )

Lots of other tips.