
Replace values in a metadata column
update_metadata_values.RdThis function will update the values in a given metadata column based on what you are providing in terms of replacement.
Arguments
- object
The underlying object, either
BulkCoExp()orBulkDge().- column
Character vector. The columns for which to replace the values.
- replacement
Named character vector. The values with which to replace the data.
- ...
Additional arguments to parse to the functions.
Examples
# relabel the levels of a metadata column
syn <- synthetic_bulk_cor_matrix()
meta <- data.table::data.table(
sample_id = colnames(syn$counts),
case_control = rep(c("case", "control"), each = 50)
)
object <- BulkDge(raw_counts = syn$counts, meta_data = meta)
object <- update_metadata_values(
object,
column = "case_control",
replacement = c(case = "disease", control = "healthy")
)
unique(get_metadata(object)$case_control)
#> [1] "disease" "healthy"