diff --git a/DESCRIPTION b/DESCRIPTION index f8ab433fc..6277afe21 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 3.0.1.9043 -Date: 2026-04-02 +Version: 3.0.1.9044 +Date: 2026-04-04 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index 2f6322888..bd2e6faa4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 3.0.1.9043 +# AMR 3.0.1.9044 ### New * Support for clinical breakpoints of 2026 of both CLSI and EUCAST, by adding all of their over 5,700 new clinical breakpoints to the `clinical_breakpoints` data set for usage in `as.sir()`. EUCAST 2026 is now the new default guideline for all MIC and disk diffusion interpretations. diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index 46f9ef8c8..d611a940e 100644 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -405,8 +405,12 @@ import_fn <- function(name, pkg, error_on_fail = TRUE) { ) } +has_cli_rlang <- function() { + pkg_is_available("cli", min_version = "3.0.0") && pkg_is_available("rlang", min_version = "1.0.3") +} + highlight_code <- function(code) { - if (pkg_is_available("cli", min_version = "3.0.0")) { + if (has_cli_rlang()) { cli::code_highlight(code) } else { code @@ -419,7 +423,7 @@ highlight_code <- function(code) { # output function (e.g. packageStartupMessage()). format_inline_ <- function(...) { msg <- paste0(c(...), collapse = "") - if (pkg_is_available("cli", min_version = "3.0.0")) { + if (has_cli_rlang()) { if (!cli::ansi_has_hyperlink_support()) { msg <- simplify_help_markup(msg) } @@ -518,7 +522,7 @@ word_wrap <- function(..., as_note = FALSE, width = 0.95 * getOption("width"), extra_indent = 0) { - if (pkg_is_available("cli", min_version = "3.0.0")) { + if (has_cli_rlang()) { return(paste0(c(...), collapse = "")) } msg <- paste0(c(...), collapse = "") @@ -580,7 +584,7 @@ simplify_help_markup <- function(msg) { message_ <- function(..., appendLF = TRUE, as_note = TRUE) { - if (pkg_is_available("cli", min_version = "3.0.0")) { + if (has_cli_rlang()) { msg <- paste0(c(...), collapse = "") if (!cli::ansi_has_hyperlink_support()) { msg <- simplify_help_markup(msg) @@ -602,7 +606,7 @@ message_ <- function(..., warning_ <- function(..., immediate = FALSE, call = FALSE) { - if (pkg_is_available("cli", min_version = "3.0.0")) { + if (has_cli_rlang()) { msg <- paste0(c(...), collapse = "") if (!cli::ansi_has_hyperlink_support()) { msg <- simplify_help_markup(msg) @@ -622,7 +626,7 @@ stop_ <- function(..., call = TRUE) { if (!cli::ansi_has_hyperlink_support()) { msg <- simplify_help_markup(msg) } - if (pkg_is_available("cli", min_version = "3.0.0")) { + if (has_cli_rlang()) { if (isTRUE(call)) { call_obj <- sys.call(-1) } else if (!isFALSE(call)) { diff --git a/R/ab.R b/R/ab.R index db97914da..3fd79c522 100755 --- a/R/ab.R +++ b/R/ab.R @@ -554,7 +554,7 @@ type_sum.ab <- function(x, ...) { print.ab <- function(x, ...) { if (!is.null(attributes(x)$amr_selector)) { function_name <- attributes(x)$amr_selector - if (pkg_is_available("cli", min_version = "3.0.0")) { + if (has_cli_rlang()) { cli::cli_inform(c( "i" = paste0("This {.cls ab} vector was retrieved using {.fun ", function_name, "}, which should normally be used inside a {.pkg dplyr} verb or {.cls data.frame} call, e.g.:"), paste0("\u00a0\u00a0", AMR_env$bullet_icon, " ", highlight_code(paste0("your_data %>% select(", function_name, "())"))), diff --git a/R/sysdata.rda b/R/sysdata.rda index 826394232..d95f3a50c 100755 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/R/tidymodels.R b/R/tidymodels.R index 7b2500dbf..ea00c7a55 100644 --- a/R/tidymodels.R +++ b/R/tidymodels.R @@ -122,13 +122,14 @@ all_disk_predictors <- function() { #' @rdname amr-tidymodels #' @export step_mic_log2 <- function( - recipe, - ..., - role = NA, - trained = FALSE, - columns = NULL, - skip = FALSE, - id = recipes::rand_id("mic_log2")) { + recipe, + ..., + role = NA, + trained = FALSE, + columns = NULL, + skip = FALSE, + id = recipes::rand_id("mic_log2") +) { recipes::add_step( recipe, step_mic_log2_new( @@ -197,13 +198,14 @@ tidy.step_mic_log2 <- function(x, ...) { #' @rdname amr-tidymodels #' @export step_sir_numeric <- function( - recipe, - ..., - role = NA, - trained = FALSE, - columns = NULL, - skip = FALSE, - id = recipes::rand_id("sir_numeric")) { + recipe, + ..., + role = NA, + trained = FALSE, + columns = NULL, + skip = FALSE, + id = recipes::rand_id("sir_numeric") +) { recipes::add_step( recipe, step_sir_numeric_new( diff --git a/data/antibiotics.rda b/data/antibiotics.rda index 9a9e74d3d..875812b50 100644 Binary files a/data/antibiotics.rda and b/data/antibiotics.rda differ diff --git a/data/antimicrobials.rda b/data/antimicrobials.rda index f5953720f..acdce7c9f 100644 Binary files a/data/antimicrobials.rda and b/data/antimicrobials.rda differ