Learn R Programming

lplyr (version 0.1.6)

pull: Column selection

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

.data
A tbl.
j
integer. The column to be extracted.

Value

A vector of length nrow(.data)

Examples

Run this code
library(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