Divides each sample in a peak table or list of chromatograms by its value in
a column of the sample metadata or of the peak table. For normalization by
sample metadata, the metadata must first be attached to the peak_table
using attach_metadata.
Arguments
- peak_table
A
peak_tableobject.- column
The name of the column to be used for normalization.
- chrom_list
List of chromatograms for normalization. Its names must match the sample names of the
peak_table, in the same order. If omitted, it is retrieved using the name stored in thepeak_table.- what
Output type to return: either
"peak_table"(default) or"chrom_list".- by
Whether to normalize by a column in sample metadata (
"meta") or by a column in the peak table ("peak"). By default, it is inferred from wherecolumnis found, and an error is raised if it is found in both.- on_invalid
How to handle invalid normalization values (i.e. zero, negative, or
NAvalues). One of"warn"(the default),"silent", or"error". Invalid values are replaced withNAunless"error"is chosen.
Value
Either a normalized peak_table object or a normalized chrom_list,
depending on the value of what.
Examples
data(pk_tab)
path <- system.file("extdata", "Sa_metadata.csv", package = "chromatographR")
meta <- read.csv(path)
# normalize by sample mass
pk_tab <- attach_metadata(peak_table = pk_tab, metadata = meta, column="vial")
norm <- normalize_data(pk_tab, "mass", what = "peak_table")
# normalize by internal standard
norm <- normalize_data(pk_tab, column = "V14", by = "peak")
