1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 13:21:50 +02:00

(v1.3.0.9015) as.mo() speedup for valid taxonomic names

This commit is contained in:
2020-09-03 20:59:21 +02:00
parent c4b87fe241
commit 68e9cb78e9
104 changed files with 542 additions and 529 deletions

7
R/mo.R
View File

@ -178,6 +178,13 @@ as.mo <- function(x,
...) {
check_dataset_integrity()
if (tryCatch(all(tolower(x) %in% MO_lookup$fullname_lower, na.rm = TRUE)
& isFALSE(Becker)
& isFALSE(Lancefield), error = function(e) FALSE)) {
# to improve speed, special case for taxonomically correct full names (case-insensitive)
return(MO_lookup[match(tolower(x), MO_lookup$fullname_lower), "mo", drop = TRUE])
}
# start off with replaced language-specific non-ASCII characters with ASCII characters
x <- parse_and_convert(x)