Skip to contents

Drops the named columns from the obs or var table of single cell-related classes. Protected identifier and bookkeeping columns (cell_idx, cell_id, to_keep for obs; gene_idx, gene_id for var) are refused with a warning. Columns that do not exist trigger a warning and are skipped.

Usage

drop_cols_sc(object, table = c("obs", "var"), cols)

Arguments

object

SingleCells (or other compatible) class.

table

String. One of c("obs", "var").

cols

Character vector. Column names to drop.

Value

Invisible self.

Examples

# drop a column that is no longer needed
sc <- demo_single_cells(prepped = FALSE)
sc <- drop_cols_sc(sc, table = "obs", cols = "batch_index")
names(get_sc_obs(sc))
#> [1] "cell_idx" "cell_id"  "cell_grp" "nnz"      "lib_size" "to_keep" 

unlink(sc@dir_data, recursive = TRUE, force = TRUE)