Matches rows of metadata to samples by name and stores them in the
sample_meta slot, in the same order as the rows of peak_table$tab.
Samples missing from metadata get NA values, with a warning. Columns
already in sample_meta, such as fields added to the chromatograms with
chromConverter::add_metadata() (chromConverter 0.11.0 or later), are kept
unless metadata replaces them.
To replace sample_meta entirely, set peak_table$sample_meta <- NA first.
Arguments
- peak_table
A
peak_tableobject created byget_peaktable.- metadata
A
data.frame(or tibble) of sample metadata.- column
Name of the column in
metadatacontaining sample identifiers, which must be unique and match the row names ofpeak_table$tab.
Examples
data(pk_tab)
path <- system.file("extdata", "Sa_metadata.csv", package = "chromatographR")
meta <- read.csv(path)
pk_tab <- attach_metadata(peak_table = pk_tab, metadata = meta, column="vial")
