diff --git a/NEWS.md b/NEWS.md index e201f28ab..e58ba1725 100644 --- a/NEWS.md +++ b/NEWS.md @@ -111,6 +111,7 @@ Planned as v3.1.0, mid October 2026. * `wisca()` now follows Bielicki *et al.* (2016) more strictly by using $\text{Beta}(1, 9999)$ for intrinsically resistant pairs, forcing near-zero susceptibility regardless of observed data (based on EUCAST Expected Resistant Phenotypes) * Fixed a bug where both functions failed without the `antimicrobials` argument if `tidyselect` was not available, e.g., for binary installations without `dplyr` * Isolates of unknown species are now included in grouped antibiograms and in `wisca()`, as they already were in traditional antibiograms. They were previously excluded silently, with the warning "invalid microorganism code, NA generated". This can change WISCA coverage estimates. + * Grouped traditional antibiograms now show the (translated) pathogen names, as ungrouped antibiograms do, instead of microorganism codes * Resistance and susceptibility calculation * New argument `guideline` (default: the `AMR_guideline` option, otherwise EUCAST) in `susceptibility()`, `resistance()`, `count_df()`, `proportion_df()`, `sir_df()`, `ggplot_sir()`, `geom_sir()`, `labels_sir_count()`, `antibiogram()`, `wisca()`, and `bug_drug_combinations()` to interpret the 'I' category correctly per guideline. Functions that return results per category also accept `guideline = NULL` to keep S, I, and R separate, while functions that return a single proportion or count give an informative error. * When EUCAST is assumed because neither the `guideline` argument nor the `AMR_guideline` option is set, a message explains how to change this, once per session and not in R Markdown or Quarto documents diff --git a/R/antibiogram.R b/R/antibiogram.R index e346c5b2d..db4d56420 100755 --- a/R/antibiogram.R +++ b/R/antibiogram.R @@ -1191,7 +1191,8 @@ antibiogram.grouped_df <- function(x, antibiogram.default(x, antimicrobials = antimicrobials, - mo_transform = mo_transform, + # WISCA is pathogen-agnostic and needs the codes, a traditional antibiogram shows the (translated) names as in antibiogram.default() + mo_transform = if (isTRUE(wisca)) NULL else "shortname", ab_transform = ab_transform, syndromic_group = ".group", add_total_n = add_total_n, diff --git a/R/sysdata.rda b/R/sysdata.rda index 5542a45bc..d6ef170d3 100755 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/R/tidymodels.R b/R/tidymodels.R index f357b815f..b2513e0aa 100755 --- a/R/tidymodels.R +++ b/R/tidymodels.R @@ -120,13 +120,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( @@ -195,13 +196,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 6dd354acb..59293bf58 100644 Binary files a/data/antibiotics.rda and b/data/antibiotics.rda differ diff --git a/data/antimicrobials.rda b/data/antimicrobials.rda index b8e3da8c4..35d6d6e39 100644 Binary files a/data/antimicrobials.rda and b/data/antimicrobials.rda differ diff --git a/man/AMR.Rd b/man/AMR.Rd index abdcaed0b..28121b949 100644 --- a/man/AMR.Rd +++ b/man/AMR.Rd @@ -12,7 +12,7 @@ The \code{AMR} package is a peer-reviewed, \href{https://amr-for-r.org/#copyrigh This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}). -After installing this package, R knows \href{https://amr-for-r.org/reference/microorganisms.html}{\strong{~103 000 distinct microbial species}} (updated April 2026) and all \href{https://amr-for-r.org/reference/antimicrobials.html}{\strong{~630 antimicrobial and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI 2011-2026 and EUCAST 2011-2026 are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen} and the \href{https://www.umcg.nl}{University Medical Center Groningen}. +After installing this package, R knows \href{https://amr-for-r.org/reference/microorganisms.html}{\strong{~103 000 distinct microbial species}} (updated april 2026) and all \href{https://amr-for-r.org/reference/antimicrobials.html}{\strong{~630 antimicrobial and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral clinical breakpoint guidelines from CLSI 2011-2026 and EUCAST 2011-2026 are included, even with epidemiological cut-off (ECOFF) values. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen} and the \href{https://www.umcg.nl}{University Medical Center Groningen}. The \code{AMR} package is available in English, Arabic, Bengali, Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek, Hindi, Indonesian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swahili, Swedish, Turkish, Ukrainian, Urdu, and Vietnamese. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages. } diff --git a/tests/testthat/test-antibiogram.R b/tests/testthat/test-antibiogram.R index 0d9df6710..009686c53 100644 --- a/tests/testthat/test-antibiogram.R +++ b/tests/testthat/test-antibiogram.R @@ -53,7 +53,8 @@ test_that("test-antibiogram.R", { warning = function(w) conditionMessage(w) ) expect_inherits(ab_grouped, "antibiogram") - expect_true("UNKNOWN" %in% as.character(ab_grouped[[2]])) + expect_true(mo_shortname("UNKNOWN", language = NULL) %in% ab_grouped[[2]]) + expect_false(any(as.character(ab_grouped[[2]]) %in% c("UNKNOWN", "B_ESCHR_COLI"))) } # Traditional antibiogram ----------------------------------------------