statar (version 0.4.0)

discard: Create a new data.table by discarding certain columns

Description

Create a new data.table by discarding certain columns

Usage

discard(x, ...)

discard_(x, vars)

Arguments

x
a data.table
...
Variables to keep. Default to all. See the select documentation.
vars
Used to work around non-standard evaluation.

Examples

Run this code
library(data.table)
DT <- data.table(
  id = c(1,2),
  v1 = c(1,1),
  v2 = c(2,1)
)
discard(DT, id, v2)
discard(DT, -id)

Run the code above in your browser using DataCamp Workspace