MeanAcrossClusters: Wrangling function: Take count mat and summarize into mean...

View source: R/SimulationFunctions.R

MeanAcrossClustersR Documentation

Wrangling function: Take count mat and summarize into mean across selected columns (eg by columns that are from same cluster)

Description

Wrangling function: Take count mat and summarize into mean across selected columns (eg by columns that are from same cluster)

Usage

MeanAcrossClusters(count.mat, cnames.keep.lst, jfunc = rowMeans)

Arguments

count.mat

Count matrix, usually rows are genes and columns are cells

cnames.keep.lst

List where names are cluster identities, values in list are column names that are to be summarized

jfunc

Summarizing function, default is rowMeans

Value

List of count vectors with same names as cnames.keep.lst. Count values are across rows of the matrix

Examples

cnames.keep.lst <- lapply(split(dat.final.annots, f = dat.final.annots$cluster), function(x) x$cell) # create cluster to cell input list
prob.mat.byclst.lst <- MeanAcrossClusters(prob.mat, cnames.keep.lst = cnames.keep.lst) # average probabilities across clusters

jakeyeung/scChIX documentation built on May 7, 2023, 9:14 a.m.