Last chance! 50% off unlimited learning
Sale ends in
This works like [[
for local data frames, and automatically collects
before indexing for remote data tables.
pull(.data, var = -1)
A table of data
A variable specified as:
a literal variable name
a positive integer, giving the position counting from the left
a negative integer, giving the position counting from the right.
The default returns the last column (on the assumption that's the column you've created most recently).
This argument is taken by expression and supports quasiquotation (you can unquote column names and column positions).
# NOT RUN {
mtcars %>% pull(-1)
mtcars %>% pull(1)
mtcars %>% pull(cyl)
# Also works for remote sources
if (requireNamespace("dbplyr", quietly = TRUE)) {
df <- dbplyr::memdb_frame(x = 1:10, y = 10:1, .name = "pull-ex")
df %>%
mutate(z = x * y) %>%
pull()
}
# }
Run the code above in your browser using DataLab