(v0.7.1.9013) guess_mo_ab speed improvement

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2019-07-11 13:39:18 +02:00
1 parent 68230d0712
commit c652c6913f
12 files changed
+227 -216

No files matched your search

+7
View File
@@ -79,6 +79,13 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE) {
search_string.ab <- suppressWarnings(as.ab(search_string))
if (search_string.ab %in% colnames(x)) {
ab_result <- colnames(x)[colnames(x) == search_string.ab][1L]
} else if (any(tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations"))))) {
ab_result <- colnames(x)[tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations")))][1L]
# } else if (any(tolower(colnames(x)) %in% tolower(ab_tradenames(search_string.ab)))) {
# ab_result <- colnames(x)[tolower(colnames(x)) %in% tolower(ab_tradenames(search_string.ab))][1L]
} else {
# sort colnames on length - longest first
cols <- colnames(x[, x %>% colnames() %>% nchar() %>% order() %>% rev()])