data.table columns if thereDeletes columns in a data.table conveniently.
May only delete columns that are found silently. Sometimes useful in e.g.
on.exit expressions.
setcolsnull(
DT = NULL,
delete = NULL,
keep = NULL,
colorder = FALSE,
soft = TRUE
)Always returns `NULL` invisibly. This function is called for its side effects.
a data.table
a character vector of column names to be deleted
a character vector of column names to keep;
the rest will be removed; keep overrides delete
logical; if TRUE, also does setcolorder using
keep
logical; if TRUE, does not cause an error if any variable
name in keep or delete is missing; soft = FALSE useful
for programming sometimes
Joonas Miettinen