Skip to contents

Unified front-end for summarising abundance either across taxonomy ranks or sample metadata groups.

Usage

summarise_abundance(
  object,
  by = c("taxa", "samples"),
  group_by,
  what = c("sum_intensity", "mean_intensity", "median_intensity"),
  na_remove = TRUE
)

Arguments

object

A microbiome_dataset object.

by

Summarisation target, either "taxa" or "samples".

group_by

Taxonomy rank or sample metadata column used for grouping.

what

Aggregation method.

na_remove

Should taxa with missing rank be removed before summarisation when by = "taxa"?

Value

A microbiome_dataset object.

Examples

data("global_patterns", package = "microbiomedataset")

x0 <- prune_taxa(global_patterns, variable_id = global_patterns@variable_info$variable_id[1:200])
x <- summarise_abundance(
  object = x0,
  by = "taxa",
  group_by = "Genus",
  what = "sum_intensity"
)
dim(x@expression_data)
#> [1] 19 26

y <- summarise_abundance(
  object = x0,
  by = "samples",
  group_by = "SampleType",
  what = "sum_intensity"
)
dim(y@expression_data)
#> [1] 200   9