Description
The function pull
selects a column in a data frame
and transforms it into a vector.
This is useful to use it in combination with magrittr's pipe operator
and dplyr's verbs.
Usage
pull(.data, j)
pull_(.data, j)
"pull_"(.data, j)
"pull_"(.data, j)
"pull_"(.data, j)
Arguments
j
integer. The column to be extracted.
Value
A vector of length nrow(.data)
Examples
Run this codelibrary(dplyr)
mtcars[["mpg"]]
mtcars %>% pull(mpg)
# more convenient than (mtcars %>% filter(mpg > 20))[[3L]]
mtcars %>%
filter(mpg > 20) %>%
pull(3)
Run the code above in your browser using DataLab