
identifix matches two sets of sample names that refer to the same samples but are written differently: other whitespace, case, separators, accents, leading zeros, dates in other formats or languages (even with typos), another word order, typos or abbreviations.
The most important rule: no wrong pairs. A pair is only accepted if it is unambiguous within both complete sets. Names that cannot be matched safely are reported with a suggestion, so that you can decide yourself.
identifix only depends on base R.
# install.packages("remotes")
remotes::install_github("MatthiasPucher/identifix")library(identifix)
lab <- c("Sample_001", "Exp_2026-09-01", "DNA_Sample_002", "Muster A",
"Standard_10ng", "sampleA")
field <- c("2026Setember01_Exp", "muster_a", "sample_1", "DNA_Smaple_002",
"Std_10ng", "sampleB")
m <- idfix_match(lab, field)
m
#> <idfix_match> 5 of 6 names in n1 matched (n2 has 6 names)
#> by step: punctuation 1, zeros 1, reorder 1, typo 1, abbreviation 1
#> unmatched: 1 in n1, 1 in n2 -> see idfix_report(x, unmatched_only = TRUE)
#> Positions in n2 for each name in n1:
#> [1] 3 1 4 2 5 NA
# field names in the order of the lab names
field[m]
#> [1] "sample_1" "2026Setember01_Exp" "DNA_Smaple_002"
#> [4] "muster_a" "Std_10ng" NA
idfix_report(m)[, c("n1", "n2", "step", "note")]
#> n1 n2 step note
#> 1 Sample_001 sample_1 zeros
#> 2 Exp_2026-09-01 2026Setember01_Exp reorder
#> 3 DNA_Sample_002 DNA_Smaple_002 typo
#> 4 Muster A muster_a punctuation
#> 5 Standard_10ng Std_10ng abbreviation
#> 6 sampleA <NA> <NA> no safe candidate found
#> 7 <NA> sampleB <NA> no safe candidate foundThe date was recognised despite the other format and the typo
(Setember) and the swapped word order. sampleA
and sampleB are similar, but a difference at the end of a
name usually marks a different sample, so they are not paired.
idfix_review() opens a review window (RStudio viewer or
browser; needs the shiny package, otherwise the review runs in the
console). Differences are highlighted, and each pair is confirmed or
rejected with one key; for names without a match, candidates are
offered.
m <- idfix_review(m) # all pairs
m <- idfix_review(m, confidence = c("low", "unmatched")) # only the uncertain onesThe decisions can be saved and reused, so that next time only new names have to be checked:
write.csv(idfix_known(m), "known.csv", row.names = FALSE)
known <- read.csv("known.csv")
m <- idfix_match(lab, field, known = known) # confirmed pairs first, rejected neverPairs confirmed earlier are shown as confirmed (with date) by
idfix_report() and are already marked as confirmed in the
next idfix_review().
After checking (and, if needed, correcting) the matches, rename names
into the spelling of the other set. idfix_rename() works on
the names directly or on objects: names of vectors and lists, data frame
columns (also in long format), row and column names. It finds where the
names are by itself.
idfix_rename(m) # lab names in field spelling
idfix_rename(m, to = "n1") # field names in lab spelling
conc <- c(Sample_001 = 1.2, DNA_Sample_002 = 0.7)
idfix_rename(m, conc) # renames names(conc)
#> sample_1 DNA_Smaple_002
#> 1.2 0.7
results <- data.frame(sample = rep(field, each = 2), value = 1:12)
results <- idfix_rename(m, results, to = "n1") # column in lab spellinggis <- c("SAMPLE 1", "sampleB", "Site_9")
t <- idfix_multi(lab = lab, field = field, gis = gis)
t[, c("lab", "gis")]
#> lab gis
#> 1 Sample_001 SAMPLE 1
#> 2 Exp_2026-09-01 <NA>
#> 3 DNA_Sample_002 <NA>
#> 4 Muster A <NA>
#> 5 Standard_10ng <NA>
#> 6 sampleA <NA>
#> 7 <NA> sampleB
#> 8 <NA> Site_9
idfix_rename(t, from = "gis") # gis names in lab spelling
#> [1] "Sample_001" "sampleB" "Site_9"
idfix_report(attr(t, "matches")$gis) # check one of the matchingsOne row per sample, one column per set. Samples missing in the first
set still get a common row (here sampleB from
field and gis).
The matching runs in steps from strict to lenient
(idfix_steps()); each step only sees the names that are
still unmatched:
| step | example |
|---|---|
| exact | S_1 = S_1 |
| whitespace | S 1 A = S1A |
| case | Sample_A = SAMPLE_a |
| punctuation | Protocole_Français =
Protocole Francais |
| zeros | Probe_007 = Probe_7 |
| dates | Exp_2026-09-01 = Exp_1. Sept 2026 =
Exp_2026Setember01 |
| reorder | Replicate_R1_A = Replicate_A_R1 |
| typo | DNA_Sample_001 = DNA_Smaple_001 |
| abbreviation | Quality_Check_Pass = QC_Pass |
| date_context | Exp_2026-05-20_EN = 20 May 2026 |
| subset (off by default) | Centrifuge_Run_1 = Centrifuge_1 |
Each step has a confidence level (high,
medium, low; see idfix_steps()),
shown by idfix_report() and used by
idfix_review() to select what to check.
Safety rules:
Sample_A and
sample_a both exist, case matters).sample001 is not
sample002).sampleA is not sampleB).03/04/2026 are resolved by
unambiguous dates with the same separator in the same set, by an
explicit date_order, or by the other set; otherwise they
stay unmatched.See vignette("identifix") for the full workflow,
including manual corrections.