In the past, when working with a data frame and wanting to get a single column as a vector, I would use magrittr::extract2()
like this:
mtcars %>%
mutate(wt_to_hp = wt/hp) %>%
extract2('wt_to_hp')
But I've seen that dplyr::pull()
and purrr::pluck()
also exists to do much the same job: return a single vector from a data frame, not unlike [[
.
Assuming that I'm always loading all 3 libraries for any project I work on, what are the advantages and use cases of each of these 3 functions? Or more specifically, what distinguishes them from each other?