Attempts to match sample names to recognized calibration standards using pattern matching on normalized names.
Arguments
- sample_names
Character vector of sample names to match.
- standards
Optional named list of standards with regex patterns. If
NULL(default), usesget_recognized_standards().- return_all
Logical. If
TRUE, returns all matches including non-matches as NA. IfFALSE(default), returns only matched entries.
Value
A tibble with columns:
sample_name: Original sample namenormalized_name: Cleaned/normalized namematched_standard: Canonical standard name (or NA if no match)standard_type: Type of standard (PS, PMMA, etc.)
Examples
samples <- c("20231215_PS_A", "Unknown Sample", "Std B", "PMMA-C")
match_standards(samples)
#> # A tibble: 2 × 4
#> sample_name normalized_name matched_standard standard_type
#> <chr> <chr> <chr> <chr>
#> 1 20231215_PS_A ps a PS A PS
#> 2 PMMA-C pmma c PMMA C PMMA
# Return all samples including non-matches
match_standards(samples, return_all = TRUE)
#> # A tibble: 4 × 4
#> sample_name normalized_name matched_standard standard_type
#> <chr> <chr> <chr> <chr>
#> 1 20231215_PS_A ps a PS A PS
#> 2 Unknown Sample unknown sample NA NA
#> 3 Std B standard b NA NA
#> 4 PMMA-C pmma c PMMA C PMMA