Retains the chromatograms of a chrom_list whose metadata meet the specified
condition, such as sample_name == "blank" or
run_datetime > as.POSIXct("2024-01-01", tz = "UTC"). The condition can
refer to any field extract_metadata reports, such as sample_name or
method, as well as the chromatogram's name in the list.
Usage
# S3 method for class 'chrom_list'
subset(x, subset, ...)Details
Numeric fields such as time_range and sample_injection_volume compare
as numbers wherever the file's value parses as one, and a field with several
values can be indexed (e.g. time_range[2]). A field a chromatogram does not
carry is NA, and a chromatogram for which
subset is NA is dropped, as in subset() for data frames. Where an
element holds several chromatograms, such as the traces read_agilent_d
returns for each .D directory, it is kept or dropped as a whole, and
subset sees the fields its chromatograms agree on, ignoring those that
leave a field empty; a field they disagree on is NA.
Examples
path <- system.file("extdata/ladder.txt", package = "chromConverter")
chroms <- read_chroms(path, format_in = "shimadzu_ascii",
find_files = FALSE, progress_bar = FALSE)
subset(chroms, sample_name == "FS19_214")
#> A chrom_list with 1 chromatogram
#> name: ladder | sample_name: FS19_214 | run_datetime: 2019-07-18 19:45:56
#> method: C:\LabSolutions\Data\A Legan\Method files\SPME_sample_1.gcm
subset(chroms, grepl("ladder", source_file))
#> A chrom_list with 1 chromatogram
#> name: ladder | sample_name: FS19_214 | run_datetime: 2019-07-18 19:45:56
#> method: C:\LabSolutions\Data\A Legan\Method files\SPME_sample_1.gcm
