phy_summarise_taxa_by_metadata: Summarise taxa by metadata

View source: R/phy_summarise_taxa_by_metadata.R

phy_summarise_taxa_by_metadataR Documentation

Summarise taxa by metadata

Description

A quick dplyr function that allows to summarise (mean, median, sum, ...) all taxa for each category of a metadata column. So far tested only on discrete variables.

Usage

phy_summarise_taxa_by_metadata(physeq, metadata_var, .fun = mean)

Arguments

physeq

A phyloseq object

metadata_var

A character with the name of the factor to summarise by. it must be accepted by the codegroup_by dplyr function

.fun

a function object to call by the summarise function in dplyr. I am thinking mean, median, sum, scale, ...

Value

A matrix object with the metadata variable in columns, and taxa in rows

Examples


data(enterotype)
matrix_for_plot <- phy_summarise_taxa_by_metadata(microbiome::transform(enterotype, "clr"), metadata_var = "Enterotype", .fun = mean)
pheatmap::pheatmap(matrix_for_plot)


g-antonello/gautils documentation built on May 3, 2024, 10:51 a.m.