% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rarefy.r
\name{biom_relativize}
\alias{biom_relativize}
\title{Relativize Counts to Proportions}
\usage{
biom_relativize(biom, clone = TRUE)
}
\arguments{
\item{biom}{An \link[=rbiom_objects]{rbiom object}, or any value accepted by \code{\link[=as_rbiom]{as_rbiom()}}.}

\item{clone}{Create a copy of \code{biom} before modifying. If \code{FALSE}, \code{biom}
is modified in place as a side-effect. See \link[=speed]{speed ups} for
use cases. Default: \code{TRUE}}
}
\value{
An \link[=rbiom_objects]{rbiom object}.
}
\description{
This function normalizes the data by dividing each observation by the total
library size of its sample. The resulting values represent the proportion
(0 to 1) of the sample composed of that specific feature.

This is a common transformation for microbiome data, as it accounts for
differences in sequencing depth across samples, allowing for comparison of
community composition.
}
\details{
Convert absolute counts to relative abundances (proportions) where each
sample sums to 1.
}
\examples{
    library(rbiom)
    
    biom <- hmp50[1:5]
    
    # Raw counts sum to different library sizes
    sample_sums(biom)
    
    # Relativized counts sum to 1
    biom_rel <- biom_relativize(biom)
    sample_sums(biom_rel)

}
\seealso{
Other transformations: 
\code{\link{biom_inflate}()},
\code{\link{biom_rescale}()},
\code{\link{modify_metadata}},
\code{\link{rarefy}()},
\code{\link{slice_metadata}},
\code{\link{subset}()},
\code{\link{with}()}
}
\concept{transformations}
