Normalizes peak table or list of chromatograms by a column in the sample
metadata or in 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. The samples must be in same order as the
peak_table. If omitted, the function will attempt to find it automatically using the pointer from 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, this parameter is inferred based on thecolumnname.- 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 = "V16", by = "peak")
