aggregate_rows: Aggregate rows of matrix

View source: R/aggregate_rows.R

aggregate_rowsR Documentation

Aggregate rows of matrix

Description

Aggregate rows of a matrix for many:1 mappings, using a grouping vector.

Usage

aggregate_rows(
  X,
  groupings,
  agg_fun = "sum",
  agg_method = c("monocle3", "stats"),
  as_sparse = TRUE,
  as_DelayedArray = TRUE,
  dropNA = TRUE,
  verbose = TRUE
)

Arguments

X

Input matrix.

groupings

Gene groups of the same length as nrow(X).

agg_fun

Aggregation function.

agg_method

Aggregation method.

as_sparse

Convert aggregated matrix to sparse matrix.

as_DelayedArray

Convert aggregated matrix to DelayedArray.

dropNA

Drop genes assigned to NA in groupings.

verbose

Print messages.

Value

Aggregated matrix

Source

data("exp_mouse_enst") X <- exp_mouse_enst gene_map <- map_genes(genes = rownames(X),species = "mouse") X_agg <- orthogene:::aggregate_rows(X = X, groupings = gene_map$name) sum(duplicated(rownames(exp_mouse))) # 0 sum(duplicated(rownames(X))) # 1215 sum(duplicated(rownames(X_agg))) # 0


neurogenomics/orthogene documentation built on Jan. 30, 2024, 4:44 a.m.