diff --git a/DESCRIPTION b/DESCRIPTION index b06d471ec..964c2b4b6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 3.0.0.9017 -Date: 2025-07-28 +Version: 3.0.0.9018 +Date: 2025-08-07 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 e0af26766..ebb3d7b34 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 3.0.0.9017 +# AMR 3.0.0.9018 This is primarily a bugfix release, though we added one nice feature too. @@ -15,6 +15,7 @@ This is primarily a bugfix release, though we added one nice feature too. * Fixed a bug in `as.sir()` to allow any tidyselect language (#220) * Fixed a bug in `as.sir()` to pick right breakpoint when `uti = FALSE` (#216) * Fixed a bug in `ggplot_sir()` when using `combine_SI = FALSE` (#213) +* Fixed `mdro()` to contain all reasons in verbose output (#227) * Fixed all plotting to contain a separate colour for SDD (susceptible dose-dependent) (#223) * Fixed some specific Dutch translations for antimicrobials * Added `names` to `age_groups()` so that custom names can be given (#215) diff --git a/R/mdro.R b/R/mdro.R index ceca548dc..d840aa26e 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -41,7 +41,7 @@ #' @inheritParams eucast_rules #' @param pct_required_classes Minimal required percentage of antimicrobial classes that must be available per isolate, rounded down. For example, with the default guideline, 17 antimicrobial classes must be available for *S. aureus*. Setting this `pct_required_classes` argument to `0.5` (default) means that for every *S. aureus* isolate at least 8 different classes must be available. Any lower number of available classes will return `NA` for that isolate. #' @param combine_SI A [logical] to indicate whether all values of S and I must be merged into one, so resistance is only considered when isolates are R, not I. As this is the default behaviour of the [mdro()] function, it follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. When using `combine_SI = FALSE`, resistance is considered when isolates are R or I. -#' @param verbose A [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not. +#' @param verbose A [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function returns a data set with the MDRO results in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not. #' @details #' These functions are context-aware. This means that the `x` argument can be left blank if used inside a [data.frame] call, see *Examples*. #' @@ -772,7 +772,7 @@ mdro <- function(x = NULL, ) } x[rows_to_change, "MDRO"] <<- to - x[rows_to_change, "reason"] <<- reason + x[rows_to_change, "reason"] <<- paste0(x[rows_to_change, "reason", drop = TRUE], "; ", reason) x[rows_not_to_change, "reason"] <<- "guideline criteria not met" } } @@ -854,7 +854,7 @@ mdro <- function(x = NULL, x <- left_join_microorganisms(x, by = col_mo) x$MDRO <- ifelse(!is.na(x$genus), 1, NA_integer_) x$row_number <- seq_len(nrow(x)) - x$reason <- NA_character_ + x$reason <- "" x$all_nonsusceptible_columns <- "" if (guideline$code == "cmi2012") { @@ -1899,6 +1899,7 @@ mdro <- function(x = NULL, # fill in empty reasons x$reason[is.na(x$reason)] <- "not covered by guideline" x[rows_empty, "reason"] <- paste(x[rows_empty, "reason"], "(note: no available test results)") + x$reason <- trimws(gsub("^;", "", x$reason)) # format data set colnames(x)[colnames(x) == col_mo] <- "microorganism" x$microorganism <- mo_name(x$microorganism, language = NULL) diff --git a/man/mdro.Rd b/man/mdro.Rd index b7c34a176..4d460e74d 100644 --- a/man/mdro.Rd +++ b/man/mdro.Rd @@ -57,7 +57,7 @@ eucast_exceptional_phenotypes(x = NULL, only_sir_columns = any(is.sir(x)), \item{combine_SI}{A \link{logical} to indicate whether all values of S and I must be merged into one, so resistance is only considered when isolates are R, not I. As this is the default behaviour of the \code{\link[=mdro]{mdro()}} function, it follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. When using \code{combine_SI = FALSE}, resistance is considered when isolates are R or I.} -\item{verbose}{A \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.} +\item{verbose}{A \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function returns a data set with the MDRO results in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.} \item{only_sir_columns}{A \link{logical} to indicate whether only antimicrobial columns must be included that were transformed to class \link[=as.sir]{sir} on beforehand. Defaults to \code{FALSE} if no columns of \code{x} have a class \link[=as.sir]{sir}.}