mapCellMeta: Create new variable from categories in cellMeta

View source: R/clustering.R

mapCellMetaR Documentation

Create new variable from categories in cellMeta

Description

Designed for fast variable creation when a new variable is going to be created from existing variable. For example, multiple samples can be mapped to the same study design condition, clusters can be mapped to cell types.

Usage

mapCellMeta(object, from, newTo = NULL, ...)

Arguments

object

A liger object.

from

The name of the original variable to be mapped from.

newTo

The name of the new variable to store the mapped result. Default NULL returns the new variable (factor class).

...

Mapping criteria, argument names are original existing categories in the from and values are new categories in the new variable.

Value

When newTo = NULL, a factor object of the new variable. Otherwise, the input object with variable newTo updated in cellMeta(object).

Examples

pbmc <- mapCellMeta(pbmc, from = "dataset", newTo = "modal",
                    ctrl = "rna", stim = "rna")

rliger documentation built on Oct. 30, 2024, 1:07 a.m.