Learn R Programming

dynwrap (version 1.2.4)

calculate_average_by_group: Calculate average values of a matrix

Description

calculate_average_by_group will calculate an average value per group, given a matrix with cells in the rows and some features in the columns (e.g. expression matrix)

Usage

calculate_average_by_group(x, cell_grouping)

Value

A matrix containing for each feature (column) the average

Arguments

x

A matrix. One row for every cell; one column for every feature. The rows must be named.

cell_grouping

A data frame denoting the grouping of the cells. Format: tibble(cell_id = character(), group_id = character()).

Examples

Run this code
calculate_average_by_group(
  x = example_trajectory$expression,
  cell_grouping = example_trajectory$prior_information$groups_id
)

Run the code above in your browser using DataLab