A few small, low-risk cleanups noticed during review:
1. Duplicated gsub helper
The identical f <- function(x, find, replace) gsub(find, replace, x, perl = TRUE) is defined in three places: standardise_names(), strip_names(), and strip_names_extra() (R/standardise_names.R, R/strip_names.R). Promote to a single internal helper.
2. Repeated slash-pattern predicate
The slash/digit/paren/apostrophe detection in match_taxa() is repeated verbatim across the five match_04* branches (lines ~586, 633, 672, 711, 751). Compute once into a column.
3. Per-row fuzzy loops
Several fuzzy-match steps use for (i in seq_len(nrow(...))) to fill a column one element at a time (match_taxa.R ~784, 825, 1092, 1138). vapply()/purrr::map_chr() would be clearer and pre-allocate.
None of these change behaviour; all are covered by the existing alignment benchmark + snapshot.
A few small, low-risk cleanups noticed during review:
1. Duplicated
gsubhelperThe identical
f <- function(x, find, replace) gsub(find, replace, x, perl = TRUE)is defined in three places:standardise_names(),strip_names(), andstrip_names_extra()(R/standardise_names.R, R/strip_names.R). Promote to a single internal helper.2. Repeated slash-pattern predicate
The slash/digit/paren/apostrophe detection in
match_taxa()is repeated verbatim across the fivematch_04*branches (lines ~586, 633, 672, 711, 751). Compute once into a column.3. Per-row fuzzy loops
Several fuzzy-match steps use
for (i in seq_len(nrow(...)))to fill a column one element at a time (match_taxa.R~784, 825, 1092, 1138).vapply()/purrr::map_chr()would be clearer and pre-allocate.None of these change behaviour; all are covered by the existing alignment benchmark + snapshot.