Used to pool a meta-data data.frame which may contain a mixture of numeric and factor variables

poolMetaData(metaData, pools)

Arguments

metaData

data.frame of meta-data for cells

pools

named list of character vector describing cell ids in each pool

Value

A data.frame of pooled meta-data

Details

For numerical variables, the pooled value is just the average of the value for cells in the pool

For factors, the pooled factor value represents the majority level across cells in the pool. If there is no simple majority (e.g. no factor level > 50%), then the level '~' is substituted.

Additionally, for factor variables, a new variable of the form <Variable>_<Level> is created for each level in the factor with a value equal to the proportion of cells in the pool with that factor level.