Drop column or columns
drop_col(DT, var, checkDT = TRUE) drop_cols(DT, vars, checkDT = TRUE)
| DT | A |
|---|---|
| var | Quoted column to drop. |
| checkDT | Should the function check |
| vars | Character vector of columns to drop. Only the intersection is dropped;
if any |
DT with specified columns removed.
if (requireNamespace("data.table", quietly = TRUE)) { library(data.table) DT <- data.table(x = 1, y = 2, z = 3) drop_col(DT, "x") }#> y z #> 1: 2 3