1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 20:41:58 +02:00
This commit is contained in:
2023-02-06 14:34:38 +01:00
parent f7dd890b79
commit 75a4c1ef3e
5 changed files with 35 additions and 34 deletions

View File

@ -362,13 +362,13 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
}
if (is.data.frame(data)) {
if (tryCatch(length(list(...)) > 0, error = function(e) TRUE)) {
out <- tryCatch(suppressWarnings(unlist(list(...))), error = function(e) NULL)
if (!is.null(out)) {
df <- data[, out, drop = FALSE]
} else {
df <- select(data, ...)
}
if (tryCatch(length(c(...)) > 1, error = function(e) TRUE)) {
df <- tryCatch(suppressWarnings(select(data, ...)),
error = function(e) {
data[, c(...), drop = FALSE]
})
} else if (tryCatch(is.character(c(...)), error = function(e) FALSE)) {
df <- data[, c(...), drop = FALSE]
} else {
df <- data
}