NEWS.md
The match_type values are renamed and a match_side column is added (#167, #163). The labels were taxon-tools’ and hard to read, and the +/- suffix (which name had an extra element) was hard to remember. The type now names only the rule, without the auto_ prefix, and the new match_side column says which name had the element that was ignored (query, reference, both, or NA when not applicable). The “Match types” section of ?ts_match_names has a table of what each type and side means and what to do next. This also fixes the documentation, which listed auto_ex-/auto_ex+ for the types the code returned as auto_exin-/ auto_exin+. Code that filters on match_type needs to be updated:
| Before | Now match_type
|
Now match_side
|
|---|---|---|
auto_punct |
punct |
NA |
auto_basio- / auto_basio+
|
basionym |
reference / query
|
auto_in- / auto_in+
|
in_author |
reference / query
|
auto_exauth- / auto_exauth+
|
ex_validating |
reference / query
|
auto_exauth_both |
ex_validating |
both |
auto_exin- / auto_exin+
|
ex_first |
reference / query
|
auto_basexin |
basionym_in_ex |
both |
auto_irank |
rank |
NA |
auto_orthvar |
orthvar |
NA |
auto_canon |
canonical |
NA |
auto_fuzzy |
fuzzy |
NA |
auto_fuzzy_canon |
fuzzy_canonical |
NA |
auto_fuzzy_genus |
fuzzy_genus |
NA |
exact, autonym, manual and no_match are unchanged. match_side is also in the output of ts_resolve_names(), and is left out when simple is TRUE in ts_match_names().
taxastand is now licensed under GPL-3 (was MIT) (#168). The pure-R name parsing and matching code was ported from taxon-tools (Cam Webb, GPL-3), so it is a derivative work and must be distributed under the same license. Cam Webb is now listed as a copyright holder in DESCRIPTION, and the two ported files say so in their headers. Releases up to and including 2.0.0 were distributed under the MIT license.
New ts_optimize_ref() for repeated matching against a large reference (#44, #110). Matching spends most of its time preparing the reference (finding the genus of every name, parsing, building match keys). Pass the result of ts_optimize_ref(reference) to ts_match_names() (as reference) or ts_resolve_names() (as ref_taxonomy) and that work is done once and reused: the genus of every name is found when the reference is prepared, and each genus is parsed and keyed the first time a query needs it. Results are identical. Against a 1.6M-name WFO reference, 100 queries take about 0.2 s and 1000 queries about 1.2 s with a prepared reference once the genera are cached, versus about 4 s and 11 s without; the first call that uses a genus pays for parsing it, as before. A prepared reference holds what it has built, so it grows with use.
New functions to set up a reference (#109). A reference is no longer something you must prepare yourself.
ts_load_ref() loads a reference from a named source ("wfo", the World Flora Online Plant List; "ppg", the Pteridophyte Phylogeny Group classification; or the taxadb snapshots of "itis", "col", "gbif", "ncbi", "ott", "fb" and "slb"), an HTTPS url, or a file (CSV/TSV, zipped Darwin Core Archive or Parquet), formats it, and optionally keeps only some taxa (taxon). The latest version of a named source is used unless a version is given; the version, license and citation are recorded in the ts_source attribute. Parquet files need the nanoparquet or duckdb package (with duckdb, taxon is applied while reading, which is much faster for large tables like GBIF). Downloads are kept in a folder only if you give a cache_dir (otherwise they are in tempdir()) (#115, #116, #117).ts_show_ref_sources() lists the sources with their licenses and citations, and with versions = TRUE the versions you can download.ts_format_ref() turns a table of taxonomic names into a reference: it renames columns with col_map, adds scientificNameAuthorship to scientificName, drops ranks above species, gives a made-up unique taxonID to names that have none (some databases give none to synonyms), and tidies values. It keeps the columns that give the hierarchy (higher ranks such as family, and parentNameUsageID) (#112, #117, #121).ts_subset_ref() keeps one or more taxa (for example a family) and their synonyms from a large table of names, using higher-rank columns or parentNameUsageID. It can be used before or after ts_format_ref() for most tables (#114).ts_show_ref_cache() and ts_clear_ref_cache() list and delete the files downloaded by ts_load_ref(); other files in the folder are never touched (#132).ref in ts_match_names(), ts_resolve_names(), ts_optimize_ref(), ts_format_ref() and ts_subset_ref() (#120). The old names, reference in ts_match_names() and ref_taxonomy in ts_resolve_names(), still work as aliases and will be deprecated in a future version. Only calls that name the argument are affected; its position is unchanged.Messages are controlled by one package option, taxastand.verbosity (#133). options(taxastand.verbosity = "quiet") silences the messages and the warnings about names that were excluded (not parsed or placeholders), in ts_load_ref(), ts_show_ref_sources(), ts_show_ref_cache(), ts_clear_ref_cache(), ts_parse_names(), ts_match_names() and ts_resolve_names(); the default is "inform". This follows rOpenSci advice to set verbosity at the package level. ts_parse_names(quiet = TRUE) still works but is superseded by the option. ts_load_ref() gives one line (Loaded 309 names from ITIS (version 2026), license CC0.) and the citation once per R session for each source (it is always in attr(x, "ts_source")).
Fuzzy matching is faster for large references, with identical results (#44). Reference names whose length differs from the query’s by more than max_dist can never be within max_dist edits, so they are no longer compared; the per-query bookkeeping of the matching stages was also made linear in the number of queries, and exact-key lookups no longer hash the whole reference.
Breaking: a query can now match several reference records at any stage (#105). When several reference records reduce to the same name at the exact, punctuation, basionym, in, ex, rank or spelling-variant stages (for example “Willd. ex Less.” and “Willd. ex DC.” for the query “Willd.”), ts_match_names() returned only one of them, chosen by reference order. It now returns every one, as it already did for canonical-name and fuzzy matches, so the ambiguity is visible. Queries that matched a single record are unchanged.
Breaking: with match_autonyms = TRUE, an autonym that matches exactly after being collapsed now has match_type autonym instead of exact (#95). For example, the query “Blechnum lunare var. lunare” matching the reference name “Blechnum lunare” was reported as exact although the two names differ. Plain species names that match exactly are still exact, and a collapsed name that matches by another route keeps that match type.
match_autonyms now works both ways (#144). It used to collapse only an autonym in the query. A species name in the query (Blechnum lunare) now also matches an autonym in the reference (Blechnum lunare var. lunare), with any infraspecific rank, as autonym.
The collapse_infra and collapse_infra_exclude arguments of ts_match_names() and ts_resolve_names() are renamed match_autonyms and match_autonyms_exclude (#101), since they are about autonyms, the infraspecific names that repeat the specific epithet. The old names still work as aliases, so existing code is unaffected; giving both an alias and its new name with different values is an error.
Breaking: match type auto_cfonly is renamed auto_canon (#82). The old name could be misread as a match on the taxonomic qualifier cf.; it means a match on the canonical name (genus + specific epithet + infraspecific epithet).
New match type auto_orthvar (#68). Epithets that differ only by standard Latin spelling variants (sylvestris/silvestris, caerulea/coerulea; ae/oe = e, y = i, ph = f, rh = r, th = t, final ii = i) are now matched exactly after folding, before fuzzy matching, instead of being reported as fuzzy matches. Code that filters on match_type may see auto_orthvar where it saw auto_fuzzy or auto_fuzzy_canon.
New dist column and optional swap-aware distance (#67). ts_match_names() output has a new dist column with the edit distance of each fuzzy hit (NA for other match types; a new column, so code that selects columns by position may need updating). The new argument transpositions = TRUE counts a swap of two adjacent letters (Qurecus for Quercus) as one edit instead of two. It is off by default (plain Levenshtein distance, as before, and somewhat faster). With max_dist = 1, 188 swapped-letter PPG queries were all found with it on, versus none with it off; at the default max_dist = 3 the effect is small.
Breaking: fuzzy matching of queries without an author (#49). The author string used to count towards the edit distance, so author-less queries could only fuzzy-match (loosely, and only because the old default max_dist was large). They are now fuzzy-matched on the canonical name (genus + specific epithet + infraspecific epithet), ignoring the author. A canonical-name match is reported as auto_canon, and a misspelled one as the new match type auto_fuzzy_canon; all reference names within max_dist are returned, so ambiguity shows up in ts_resolve_names(), whose output now has a dist column (the edit distance of fuzzy matches). The new argument closest_only = TRUE of ts_resolve_names() instead keeps only the nearest fuzzy hits of each query (ties kept), which avoids unrelated names with short epithets. Queries with an author are still matched on the whole name (auto_fuzzy).
Breaking: the default max_dist is now 3 (was 10) (#47). max_dist is the Levenshtein distance on the whole depunctuated name including the author, and 10 was very loose (for example, 5 queries against PPG returned 275 result rows). The distance is also now plain Levenshtein distance: the extra +1 penalty taxon-tools applied when the reference merely has extra trailing text was removed, which can add matches at exactly max_dist.
match_no_auth and the auto_noauth match type are removed (#143). A query without an author is matched on its canonical name whatever the setting (see above), so the option gave the same reference names under a different match_type. Such queries now return auto_canon. match_canon is the closest replacement, and match_no_auth is kept as an alias of it so that existing code runs. The behavior is slightly different: match_canon = TRUE also allows canonical-name matches for queries that have an author. Use match_canon instead of match_no_auth.
Design philosophy change: taxastand is no longer a strict port of taxon-tools. Goals are now to standardize names accurately (including authors), quickly, and flexibly (custom reference databases), rather than to implement taxon-tools in R. Output may diverge from taxon-tools in future releases. The docker differential test and the “pure R vs. taxon-tools” benchmark vignette were removed.
Add strip_qualifiers argument to ts_parse_names(), ts_match_names(), and ts_resolve_names(), so that open-nomenclature qualifiers (cf., aff., s.l./sensu lato, s.str./sensu stricto) can optionally be removed from names before parsing/matching, instead of being mis-captured as the specific epithet. Off by default (#40)
ts_match_names() and ts_resolve_names() now ignore reference names whose genus cannot match any query genus before parsing the reference (#43); match keys are computed lazily and looked up in vectorised passes instead of per-key hash maps (#45); and matching returns a data frame instead of delimited strings (#46). ts_parse_names() is also about twice as fast, because the per-row failure check and tidyr::separate() were replaced with vectorised base R (#44). Results are unchanged, except that multiple fuzzy matches to one query are now returned in reference order.ts_parse_names() also keeps in at the start of the author in the author, as IPNI writes it when the author before in is unknown: Mertensia cusickii in Piper no longer has the infraspecific epithet in (#174).
Matching now removes both the basionym author and the “ex”/“in” citation in the auto_basexin match. When a name had both, as in Hymenophyllum magellanicum (Desv.) Willd. ex Kunze, only the basionym author was removed, so it did not match Hymenophyllum magellanicum Willd. (#174).
ts_parse_names() no longer reads ex, sensu, non or nec at the start of the author as an infraspecific epithet: Verbesina conyzoides ex DC. now has the author ex DC. (as Hook. ex DC. already did), and Glycine javanica sensu Backer, non L. the author sensu Backer, non L. (about 180 WFO names) (#174).
ts_parse_names() no longer mistakes a lowercase word at the start of the author for an infraspecific epithet. Authors such as de Vriese, van der Werff, de la Sota, d'Urv., hort. and auct. are kept whole; before, Angiopteris affinis de Vriese was read as the infraspecific epithet de with author Vriese, which also made matching ignore the particle. A name that ends in a particle with no author after it, such as Foo bar de, can no longer be parsed (#170).
Matching now treats Hook. ex Smith and Smith as the same name. Under the botanical Code the author after ex is the author of the name, but only the author before ex was used, so Foo bar Hook. ex Smith did not match Foo bar Smith. They now match as auto_exauth+ / auto_exauth- (and as auto_exauth_both when both names have an ex author), tried before the exin matches, so Foo bar Hook. ex Smith prefers Foo bar Smith to Foo bar Hook.. The documentation of the exin match types now says to check them.
Matching now ignores accents on all the letters found in IPNI author names, not only Latin-1 ones. Letters such as Š, ř, ł, ğ and ı used to be deleted when names were compared, so Dvorak and Dvořák (or Smarda and Šmarda) matched only fuzzily (auto_fuzzy); they now match as punctuation-only differences (auto_punct). ß is now ss (it was b) and þ is th (it was p) (#171).
Matching no longer erases an author written NULL (or \N). These strings were treated as missing values, a leftover from the input files of the original taxon-tools; missing values are empty fields (#173).
ts_parse_names() now reads a slash between authors as a space, so Smith/Jones gives the author Smith Jones instead of the fused SmithJones (#172).
Matching now treats “and” and “et” between author names as “&”, as intended, so Smith and Jones and Smith & Jones match as punctuation-only differences (auto_punct) instead of falling through to a fuzzy match or no match (#164).
ts_parse_names() no longer treats the epithet incerta as a placeholder, so real species such as Dryopteris incerta are kept (#153).
ts_resolve_names() no longer resolves a query to the accepted name of a synonym when the query also matched a different accepted name (#154). Such queries are now ambiguous, like any other match to several accepted names.
ts_match_names() checked the match names of manual_match against only the part of the reference whose genus could match a query (since the genus filter of #43). A manual_match table with rows for queries that are not in the call (for example one table used for several batches of queries) then failed with “One or more manually matched reference names not in reference data” whenever such a row pointed to a genus that no query has. The names are now checked against the whole reference.
Fix ts_match_names(..., collapse_infra = TRUE)’s internal deduplication key, which used paste0(..., sep = "_") – paste0() has no sep argument, so the separator was silently dropped, joining name components with no delimiter between them. This could in rare cases cause two genuinely different names to be treated as duplicates during deduplication if their concatenated components happened to coincide. Found via static analysis while running pkgcheck::pkgcheck() ahead of rOpenSci submission.
The id column of ts_parse_names() (and id_query in ts_match_names() output) is now the position of the name as a string ("1", "2", …) instead of a hash of the input followed by the position ("5f207ff2-1"). The hash did not identify anything across calls. A reference passed as a parsed dataframe now gets id_ref values ref-1, ref-2, …, as a character reference does (#159).
digest is no longer imported: the names of downloaded reference files now use a short hash computed in base R (#159). Files cached by an earlier development version are not recognized by ts_show_ref_cache().
New keep_cols argument of ts_format_ref() and ts_load_ref() to keep extra columns of the reference, such as nomenclaturalStatus (#155).
manual_match in ts_match_names() now also works when query is a dataframe of names parsed with ts_parse_names() (#93), not only a character vector. The query values are compared with the name column.
The documentation of ts_match_names() and ts_resolve_names() now recommends ts_optimize_ref() for repeated queries against a large reference, and ts_match_names() defines an autonym (#94).
New “Benchmarks” vignette comparing taxastand with similar packages (#96, #103): taxastand, taxify, WorldFlora and U.Taxonstand match the same World Flora Online reference against queries made by damaging real names (typos in the genus, epithet and author, missing authors, homonyms) and by changing the form of names in the ways taxastand checks for (a missing basionym author, a dropped ex element, a changed infraspecific rank, a Latin spelling variant), so the right answer is known. It compares accuracy, single answers and speed. The results are precomputed and saved with the package, and the code that produced them is installed in system.file("benchmark", package = "taxastand").
Faster fuzzy matching: candidates are looked up by reference row rather than by name (a 600-query PPG run took 2.4 s, now 2.1 s; results identical).
Faster parsing and key building (#66): fewer and cheaper regex passes, and pipe-delimited records are split once instead of once per field. Output is identical; e.g. parsing 149,000 names takes about 1.2 s instead of 3.2 s.
Lighter installation (#48): dplyr, tidyr, fs and glue are no longer dependencies (the resolve and match steps now use base R, with identical output), and tibble moved to Suggests. tbl_out = TRUE (or the ts_tbl_out option) now requires the tibble package to be installed. magrittr is also no longer a dependency, so breaking: %>% is no longer re-exported; load magrittr or dplyr, or use the native pipe |>.
New vignette “Setting up a reference” shows the ways to get a reference: named sources, your own file or URL, subsetting, and tables from other packages such as taxadb (#107, #129).
Document the match_type values in a new “Match types” section of ?ts_match_names, grouped by how far each can be trusted (#52); the match type codes themselves are unchanged
Use vapply() instead of sapply(), anyDuplicated() instead of any(duplicated(x)), and drop several redundant x == TRUE/x == FALSE comparisons
Fix a dead link in the README (“The Plant List”, no longer online; now links to a Wayback Machine snapshot)
manual_match argument to ts_match_names(), so users can supply a dataframe of manually matched names that override the matching algorithm (#4)taxon-tools, so it no longer needs to be installed locallycollapse_infra and collapse_infra_exclude arguments to ts_match_names() and ts_resolve_names(), for collapsing infraspecific taxa to their species when matchingquiet argument to ts_parse_names() to suppress warningsts_parse_names(), ts_match_names(), and ts_resolve_names(), using the external taxon-tools system dependency for parsing and fuzzy matching