1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 01:22:25 +02:00

documentation fix

This commit is contained in:
2019-05-13 20:16:51 +02:00
parent 2ea0c93e44
commit f6bf54b37d
13 changed files with 71 additions and 60 deletions

View File

@ -69,13 +69,18 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE) {
if (search_string %in% colnames(x)) {
ab_result <- search_string
} else {
# sort colnames on length - longest first
cols <- colnames(x[, x %>% colnames() %>% nchar() %>% order() %>% rev()])
df_trans <- data.frame(cols = cols,
abs = suppressWarnings(as.ab(cols)),
stringsAsFactors = FALSE)
ab_result <- df_trans[which(df_trans$abs == as.ab(search_string)), "cols"]
ab_result <- ab_result[!is.na(ab_result)][1L]
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 {
# sort colnames on length - longest first
cols <- colnames(x[, x %>% colnames() %>% nchar() %>% order() %>% rev()])
df_trans <- data.frame(cols = cols,
abs = suppressWarnings(as.ab(cols)),
stringsAsFactors = FALSE)
ab_result <- df_trans[which(df_trans$abs == search_string.ab), "cols"]
ab_result <- ab_result[!is.na(ab_result)][1L]
}
}
if (length(ab_result) == 0) {