% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/amp_merge_replicates.R
\name{amp_merge_replicates}
\alias{amp_merge_replicates}
\alias{amp_mergereplicates}
\title{Merge replicate samples}
\usage{
amp_merge_replicates(data, merge_var, round = NULL)

amp_mergereplicates(data, merge_var, round = NULL)
}
\arguments{
\item{data}{(\emph{required}) Data list as loaded with \code{amp_load()}.}

\item{merge_var}{Variable in the sample metadata that defines the sample groups, see examples.}

\item{round}{If the read counts in \code{data$abund} are integers, any decimals present after merging will be rounded either \code{"up"} or \code{"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. (\emph{default:} \code{NULL})}
}
\value{
An object of class \code{ampvis2}
}
\description{
Aggregates read counts in replicate samples by calculating the mean abundances of OTU's.
}
\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
}
\author{
Kasper Skytte Andersen \email{ksa@bio.aau.dk}
}
