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

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2020-09-03 20:59:21 +02:00
1 parent c4b87fe241
commit 68e9cb78e9
104 files changed
+542 -529

No files matched your search

+7
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)