mirror of
https://github.com/msberends/AMR.git
synced 2026-01-11 19:14:39 +01:00
(v3.0.1.9017) fix documentation
This commit is contained in:
@@ -163,6 +163,7 @@ ab_tradenames <- function(x, ...) {
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
#' @param all_groups A [logical] to indicate whether all antimicrobial groups must be return as a vector for each input value. For example, an antibiotic in the "aminopenicillins" group, is also in the "penicillins" and "beta-lactams" groups. Setting `all_groups = TRUE` would return all three for such an antibiotic, while `all_groups = FALSE` (default) only returns the most distinctive group name.
|
||||
#' @export
|
||||
ab_group <- function(x, language = get_AMR_locale(), all_groups = FALSE, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
@@ -171,11 +172,9 @@ ab_group <- function(x, language = get_AMR_locale(), all_groups = FALSE, ...) {
|
||||
|
||||
grps <- ab_validate(x = x, property = "group", ...)
|
||||
for (i in seq_along(grps)) {
|
||||
# take the first match based on ABX_PRIORITY_LIST
|
||||
if (all_groups == FALSE) {
|
||||
# take the first match based on ABX_PRIORITY_LIST
|
||||
grps[[i]] <- grps[[i]][1]
|
||||
} else if (length(grps[[i]]) > 1) {
|
||||
grps[[i]] <- grps[[i]][grps[[i]] != "Beta-lactamase inhibitors"] # leave these out if there are other groups
|
||||
}
|
||||
if (language != "en") {
|
||||
grps[[i]] <- translate_into_language(grps[[i]], language = language, only_affect_ab_names = TRUE)
|
||||
|
||||
Reference in New Issue
Block a user