Learn R Programming

ggpicrust2 (version 2.5.10)

calculate_abundance_stats: Helper function to calculate abundance statistics for differential analysis

Description

This function calculates mean relative abundance, standard deviation, and log2 fold change for each feature between two groups.

Usage

calculate_abundance_stats(abundance, metadata, group, features, group1, group2)

Value

A data frame with columns:

feature

Feature identifier

mean_rel_abundance_group1

Mean relative abundance for group1

sd_rel_abundance_group1

Standard deviation of relative abundance for group1

mean_rel_abundance_group2

Mean relative abundance for group2

sd_rel_abundance_group2

Standard deviation of relative abundance for group2

log2_fold_change

Log2 fold change (group2/group1)

Arguments

abundance

A matrix or data frame with features as rows and samples as columns

metadata

A data frame containing sample information

group

Character string specifying the group column name in metadata

features

Character vector of feature names to calculate statistics for

group1

Character string specifying the first group name

group2

Character string specifying the second group name