Learn R Programming

dbplyr (version 2.4.0)

pull.tbl_sql: Extract a single column

Description

This is a method for the dplyr pull() generic. It evaluates the query retrieving just the specified column.

Usage

# S3 method for tbl_sql
pull(.data, var = -1, name = NULL, ...)

Value

A vector of data.

Arguments

.data

A lazy data frame backed by a database query.

var

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 locations).

name

An optional parameter that specifies the column to be used as names for a named vector. Specified in a similar manner as var.

...

<data-masking> Variables, or functions of variables. Use desc() to sort a variable in descending order.

Examples

Run this code
library(dplyr, warn.conflicts = FALSE)

db <- memdb_frame(x = 1:5, y = 5:1)
db %>%
  mutate(z = x + y * 2) %>%
  pull()

Run the code above in your browser using DataLab