1
0
mirror of https://github.com/msberends/AMR.git synced 2026-03-31 16:55:53 +02:00

(v3.0.1.9041) add breakpoints 2026

This commit is contained in:
2026-03-30 10:01:49 +02:00
parent 9c95aa455c
commit 3a736bc484
37 changed files with 5975 additions and 345 deletions

View File

@@ -146,7 +146,7 @@ get_column_abx <- function(x,
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(sort, allow_class = "logical", has_length = 1)
if (isTRUE(info)) {
if (isTRUE(info) && message_not_thrown_before("get_column_abx", colnames(x))) {
message_("Auto-guessing columns suitable for analysis", appendLF = FALSE, as_note = FALSE)
}

View File

@@ -174,7 +174,7 @@ as.mic <- function(x, na.rm = FALSE, keep_operators = "all", round_to_next_log2
keep_operators <- "none"
}
if (is.mic(x) && (keep_operators == "all" || !any(x %like% "[>=<]", na.rm = TRUE))) {
if (any(is.mic(x)) && (keep_operators == "all" || !any(x %like% "[>=<]", na.rm = TRUE))) {
if (isTRUE(round_to_next_log2)) {
x <- roundup_to_nearest_log2(x)
}
@@ -327,7 +327,7 @@ rescale_mic <- function(x, mic_range, keep_operators = "edges", as.mic = TRUE, r
mic_range <- trimws(format(mic_range, scientific = FALSE))
mic_range <- gsub("[.]0+$", "", mic_range)
mic_range[mic_range == "NA"] <- NA_character_
} else if (is.mic(mic_range)) {
} else if (any(is.mic(mic_range))) {
mic_range <- as.character(mic_range)
}
stop_ifnot(

8
R/mo.R
View File

@@ -249,7 +249,7 @@ as.mo <- function(x,
if (length(which(ind)) > 0 && isTRUE(info) && message_not_thrown_before("as.mo_microorganisms.codes", is.na(out), toupper(x))) {
message_(
"Retrieved value", ifelse(sum(ind) > 1, "s", ""),
" from the `microorganisms.codes` data set for ", vector_and(toupper(x)[ind]), "."
" from the {.help [microorganisms.codes](AMR::microorganisms.codes)} data set for ", vector_and(paste0("{.val ", toupper(x)[ind], "}"), quotes = FALSE), "."
)
}
# From SNOMED ----
@@ -686,7 +686,7 @@ pillar_shaft.mo <- function(x, ...) {
}
warning_(
col, " contains old MO codes (from a previous AMR package version). ",
"Please update your MO codes with `as.mo()`.",
"Please update your MO codes with {.help [{.fun as.mo}](AMR::as.mo)}.",
call = FALSE
)
}
@@ -793,7 +793,7 @@ print.mo <- function(x, print.shortnames = FALSE, ...) {
if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) {
warning_(
"Some MO codes are from a previous AMR package version. ",
"Please update the MO codes with `as.mo()`.",
"Please update the MO codes with {.help [{.fun as.mo}](AMR::as.mo)}.",
call = FALSE
)
}
@@ -827,7 +827,7 @@ as.data.frame.mo <- function(x, ...) {
if (!all(x %in% c(AMR_env$MO_lookup$mo, NA))) {
warning_(
"The data contains old MO codes (from a previous AMR package version). ",
"Please update your MO codes with `as.mo()`."
"Please update your MO codes with {.help [{.fun as.mo}](AMR::as.mo)}."
)
}
nm <- deparse1(substitute(x))

View File

@@ -2080,10 +2080,10 @@ freq.sir <- function(x, ...) {
# this prevents the requirement for putting the dependency in Imports:
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, sir)
get_skimmers.sir <- function(column) {
# TODO add here in AMR 3.1.0 details about guideline
# TODO #170 add here in AMR 3.1.0 details about guideline
skimr::sfl(
skim_type = "sir",
# guideline = function(x) "EUCAST 2025", # or "Multiple"
# guideline = function(x) "EUCAST 2026", # or "Multiple"
# origin = function(x) "MIC", # or "Multiple"
count_S = count_S,
count_I = count_I,