Get the fraction of cells in each state, by group if <groups> provided. Here, the rows in <scores> are interpreted as cells and the columns as their state scores, but more generally the function assigns each row to its maximum column (state) and subsequently counts the number of observations per state where if <groups> provided then the observations are first subsetted by group.

state_fractions(scores, groups = NULL, min = NULL, diff = NULL)

Arguments

scores

a data.frame object of cell signature scores (cells X signatures/states)

groups

should fractions be computed separately for groups, e.g. samples? a list of observations by group. Default: NULL

min

minimum value required for a row to be assigned to a column. Default: NULL

diff

minimum difference in value to the 'next-best' row that is required for a row to be assigned to a column. Default: NULL

Value

a numeric or data.frame object with states as (col)names and if data.frame, groups as rownames.

See also