Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pull..html

Pull out a single variable


Description

Pull a single variable from a data.table as a vector.

Usage

pull.(.df, var = -1)

Arguments

.df

A data.frame or data.table

var

The column to pull from the data.table as:

  • a variable name

  • a positive integer giving the column position

  • a negative integer giving the column position counting from the right

Examples

test_df <- data.table(
  x = 1:3,
  y = 1:3
)

# Grab column by name
test_df %>%
  pull.(y)

# Grab column by position
test_df %>%
  pull.(1)

# Defaults to last column
test_df %>%
  pull.()

tidytable

Tidy Interface to 'data.table'

v0.6.1
MIT + file LICENSE
Authors
Mark Fairbanks [aut, cre], Abdessabour Moutik [ctb], Matt Carlson [ctb], Ivan Leung [ctb], Ross Kennedy [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.