I'm currently using R and came across the function all_of
in the tidyverse. What does this function exists for? It seems like I can use just x
at every point where all_of(x)
can be used..
Example:
library(tidyverse)
tb <- tibble(a=1:3, b=1:3, c=1:3)
x <- c("a", "b")
tb %>% select(all_of(x))
tb %>% select(x)
tb %>$ select(-all_of(x))
tb %>% select(-x)
The two lines with all_of
yield the same return values as the ones without the extra function. Why should I bother using them?