amp_merge_replicates: Merge replicate samples

View source: R/amp_merge_replicates.R

amp_merge_replicatesR Documentation

Merge replicate samples

Description

Aggregates read counts in replicate samples by calculating the mean abundances of OTU's.

Usage

amp_merge_replicates(data, merge_var, round = NULL)

amp_mergereplicates(data, merge_var, round = NULL)

Arguments

data

(required) Data list as loaded with amp_load().

merge_var

Variable in the sample metadata that defines the sample groups, see examples.

round

If the read counts in data$abund are integers, any decimals present after merging will be rounded either "up" or "down". Make sure this makes sense if the read counts have been normalised, as it may result in 0's, 1's, and 2's everywhere. (default: NULL)

Value

An object of class ampvis2

Author(s)

Kasper Skytte Andersen ksa@bio.aau.dk

Examples

# load data
d <- amp_load(ampvis2::example_otutable, ampvis2::example_metadata)
d

# add a grouping variable to the sample metadata defining the groups of sample replicates
d$metadata$group <- c("group1", "group1", "group2", "group2", "group3", "group4", NA, NA)
d$metadata

# merge by "group" rounding up the resulting values
dmerged <- amp_mergereplicates(d,
  merge_var = "group",
  round = "up"
)
dmerged$metadata
dmerged

MadsAlbertsen/ampvis2 documentation built on Jan. 28, 2024, 7:12 a.m.