1
0
mirror of https://github.com/msberends/AMR.git synced 2026-04-05 00:16:07 +02:00

(v3.0.1.9044) fix old R version

This commit is contained in:
2026-04-04 11:51:50 +02:00
parent 225493192c
commit 6c24718893
8 changed files with 30 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 3.0.1.9043 Version: 3.0.1.9044
Date: 2026-04-02 Date: 2026-04-04
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by

View File

@@ -1,4 +1,4 @@
# AMR 3.0.1.9043 # AMR 3.0.1.9044
### New ### 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. * 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.

View File

@@ -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) { highlight_code <- function(code) {
if (pkg_is_available("cli", min_version = "3.0.0")) { if (has_cli_rlang()) {
cli::code_highlight(code) cli::code_highlight(code)
} else { } else {
code code
@@ -419,7 +423,7 @@ highlight_code <- function(code) {
# output function (e.g. packageStartupMessage()). # output function (e.g. packageStartupMessage()).
format_inline_ <- function(...) { format_inline_ <- function(...) {
msg <- paste0(c(...), collapse = "") msg <- paste0(c(...), collapse = "")
if (pkg_is_available("cli", min_version = "3.0.0")) { if (has_cli_rlang()) {
if (!cli::ansi_has_hyperlink_support()) { if (!cli::ansi_has_hyperlink_support()) {
msg <- simplify_help_markup(msg) msg <- simplify_help_markup(msg)
} }
@@ -518,7 +522,7 @@ word_wrap <- function(...,
as_note = FALSE, as_note = FALSE,
width = 0.95 * getOption("width"), width = 0.95 * getOption("width"),
extra_indent = 0) { extra_indent = 0) {
if (pkg_is_available("cli", min_version = "3.0.0")) { if (has_cli_rlang()) {
return(paste0(c(...), collapse = "")) return(paste0(c(...), collapse = ""))
} }
msg <- paste0(c(...), collapse = "") msg <- paste0(c(...), collapse = "")
@@ -580,7 +584,7 @@ simplify_help_markup <- function(msg) {
message_ <- function(..., message_ <- function(...,
appendLF = TRUE, appendLF = TRUE,
as_note = TRUE) { as_note = TRUE) {
if (pkg_is_available("cli", min_version = "3.0.0")) { if (has_cli_rlang()) {
msg <- paste0(c(...), collapse = "") msg <- paste0(c(...), collapse = "")
if (!cli::ansi_has_hyperlink_support()) { if (!cli::ansi_has_hyperlink_support()) {
msg <- simplify_help_markup(msg) msg <- simplify_help_markup(msg)
@@ -602,7 +606,7 @@ message_ <- function(...,
warning_ <- function(..., warning_ <- function(...,
immediate = FALSE, immediate = FALSE,
call = FALSE) { call = FALSE) {
if (pkg_is_available("cli", min_version = "3.0.0")) { if (has_cli_rlang()) {
msg <- paste0(c(...), collapse = "") msg <- paste0(c(...), collapse = "")
if (!cli::ansi_has_hyperlink_support()) { if (!cli::ansi_has_hyperlink_support()) {
msg <- simplify_help_markup(msg) msg <- simplify_help_markup(msg)
@@ -622,7 +626,7 @@ stop_ <- function(..., call = TRUE) {
if (!cli::ansi_has_hyperlink_support()) { if (!cli::ansi_has_hyperlink_support()) {
msg <- simplify_help_markup(msg) msg <- simplify_help_markup(msg)
} }
if (pkg_is_available("cli", min_version = "3.0.0")) { if (has_cli_rlang()) {
if (isTRUE(call)) { if (isTRUE(call)) {
call_obj <- sys.call(-1) call_obj <- sys.call(-1)
} else if (!isFALSE(call)) { } else if (!isFALSE(call)) {

2
R/ab.R
View File

@@ -554,7 +554,7 @@ type_sum.ab <- function(x, ...) {
print.ab <- function(x, ...) { print.ab <- function(x, ...) {
if (!is.null(attributes(x)$amr_selector)) { if (!is.null(attributes(x)$amr_selector)) {
function_name <- 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( 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.:"), "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, "())"))), paste0("\u00a0\u00a0", AMR_env$bullet_icon, " ", highlight_code(paste0("your_data %>% select(", function_name, "())"))),

Binary file not shown.

View File

@@ -122,13 +122,14 @@ all_disk_predictors <- function() {
#' @rdname amr-tidymodels #' @rdname amr-tidymodels
#' @export #' @export
step_mic_log2 <- function( step_mic_log2 <- function(
recipe, recipe,
..., ...,
role = NA, role = NA,
trained = FALSE, trained = FALSE,
columns = NULL, columns = NULL,
skip = FALSE, skip = FALSE,
id = recipes::rand_id("mic_log2")) { id = recipes::rand_id("mic_log2")
) {
recipes::add_step( recipes::add_step(
recipe, recipe,
step_mic_log2_new( step_mic_log2_new(
@@ -197,13 +198,14 @@ tidy.step_mic_log2 <- function(x, ...) {
#' @rdname amr-tidymodels #' @rdname amr-tidymodels
#' @export #' @export
step_sir_numeric <- function( step_sir_numeric <- function(
recipe, recipe,
..., ...,
role = NA, role = NA,
trained = FALSE, trained = FALSE,
columns = NULL, columns = NULL,
skip = FALSE, skip = FALSE,
id = recipes::rand_id("sir_numeric")) { id = recipes::rand_id("sir_numeric")
) {
recipes::add_step( recipes::add_step(
recipe, recipe,
step_sir_numeric_new( step_sir_numeric_new(

Binary file not shown.

Binary file not shown.