mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 00:43:00 +02:00
use dplyr where available, new antibiogram()
for WISCA, fixed Salmonella Typhi/Paratyphi
This commit is contained in:
@ -338,7 +338,7 @@ ab_url <- function(x, open = FALSE, ...) {
|
||||
ab_property <- function(x, property = "name", language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(property, is_in = colnames(AMR::antibiotics), has_length = 1)
|
||||
meet_criteria(language, is_in = c(LANGUAGES_SUPPORTED, ""), has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
translate_into_language(ab_validate(x = x, property = property, ...), language = language)
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
|
||||
if (!is.null(out)) {
|
||||
df <- data[, out, drop = FALSE]
|
||||
} else {
|
||||
df <- pm_select(data, ...)
|
||||
df <- select(data, ...)
|
||||
}
|
||||
} else {
|
||||
df <- data
|
||||
@ -438,7 +438,7 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
|
||||
|
||||
ab_validate <- function(x, property, ...) {
|
||||
if (tryCatch(all(x[!is.na(x)] %in% AMR_env$AB_lookup$ab), error = function(e) FALSE)) {
|
||||
# special case for ab_* functions where class is already 'ab'
|
||||
# # special case for ab_* functions where class is already 'ab'
|
||||
x <- AMR_env$AB_lookup[match(x, AMR_env$AB_lookup$ab), property, drop = TRUE]
|
||||
} else {
|
||||
# try to catch an error when inputting an invalid argument
|
||||
|
Reference in New Issue
Block a user