diff --git a/DESCRIPTION b/DESCRIPTION index 59b9b69d5..b7b2bab76 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 3.0.0 -Date: 2025-06-01 +Version: 3.0.0.9001 +Date: 2025-06-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 a745477e7..90b852273 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# AMR 3.0.0.9001 + +# Changed +* Fix for `antibiogram()` for when no antimicrobials are set +* Fixed some specific Dutch translations antimicrobials + + + # AMR 3.0.0 This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the [University of Prince Edward Island's Atlantic Veterinary College](https://www.upei.ca/avc), Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change. @@ -122,7 +130,7 @@ This package now supports not only tools for AMR data analysis in clinical setti ## Older Versions -This changelog only contains changes from AMR v3.0 (March 2025) and later. +This changelog only contains changes from AMR v3.0 (June 2025) and later. * For prior v2 versions, please see [our v2 archive](https://github.com/msberends/AMR/blob/v2.1.1/NEWS.md). * For prior v1 versions, please see [our v1 archive](https://github.com/msberends/AMR/blob/v1.8.2/NEWS.md). diff --git a/R/antibiogram.R b/R/antibiogram.R index b9df118a5..42eef9f4b 100755 --- a/R/antibiogram.R +++ b/R/antibiogram.R @@ -40,6 +40,7 @@ #' - A combination of the above, using `c()`, e.g.: #' - `c(aminoglycosides(), "AMP", "AMC")` #' - `c(aminoglycosides(), carbapenems())` +#' - Column indices using numbers #' - Combination therapy, indicated by using `"+"`, with or without [antimicrobial selectors][antimicrobial_selectors], e.g.: #' - `"cipro + genta"` #' - `"TZP+TOB"` @@ -452,7 +453,7 @@ antibiogram.default <- function(x, deprecation_warning("antibiotics", "antimicrobials", fn = "antibiogram", is_argument = TRUE) antimicrobials <- list(...)$antibiotics } - meet_criteria(antimicrobials, allow_class = "character", allow_NA = FALSE, allow_NULL = FALSE) + meet_criteria(antimicrobials, allow_class = c("character", "numeric", "integer"), allow_NA = FALSE, allow_NULL = FALSE) if (!is.function(mo_transform)) { meet_criteria(mo_transform, allow_class = "character", has_length = 1, is_in = c("name", "shortname", "gramstain", colnames(AMR::microorganisms)), allow_NULL = TRUE, allow_NA = TRUE) } @@ -1194,12 +1195,13 @@ retrieve_wisca_parameters <- function(wisca_model, ...) { #' @rawNamespace if(getRversion() >= "3.0.0") S3method(pillar::tbl_sum, antibiogram) tbl_sum.antibiogram <- function(x, ...) { dims <- paste(format(NROW(x), big.mark = ","), AMR_env$cross_icon, format(NCOL(x), big.mark = ",")) + names(dims) <- "An Antibiogram" if (isTRUE(attributes(x)$wisca)) { - names(dims) <- paste0("An Antibiogram (WISCA / ", attributes(x)$conf_interval * 100, "% CI)") + dims <- c(dims, Type = paste0("WISCA with ", attributes(x)$conf_interval * 100, "% CI")) } else if (isTRUE(attributes(x)$formatting_type >= 13)) { - names(dims) <- paste0("An Antibiogram (non-WISCA / ", attributes(x)$conf_interval * 100, "% CI)") + dims <- c(dims, Type = paste0("Non-WISCA with ", attributes(x)$conf_interval * 100, "% CI")) } else { - names(dims) <- paste0("An Antibiogram (non-WISCA)") + dims <- c(dims, Type = paste0("Non-WISCA without CI")) } dims } diff --git a/R/translate.R b/R/translate.R index c5eefa35e..ab89cc44b 100755 --- a/R/translate.R +++ b/R/translate.R @@ -258,6 +258,11 @@ translate_into_language <- function(from, return(from) } + if (only_affect_ab_names == TRUE) { + df_trans$pattern[df_trans$regular_expr == TRUE] <- paste0(df_trans$pattern[df_trans$regular_expr == TRUE], "$") + df_trans$pattern[df_trans$regular_expr == TRUE] <- gsub("$$", "$", df_trans$pattern[df_trans$regular_expr == TRUE], fixed = TRUE) + } + lapply( # starting with longest pattern, since more general translations are shorter, such as 'Group' order(nchar(df_trans$pattern), decreasing = TRUE), diff --git a/man/antibiogram.Rd b/man/antibiogram.Rd index 7709eeaea..222cf9554 100644 --- a/man/antibiogram.Rd +++ b/man/antibiogram.Rd @@ -56,6 +56,7 @@ retrieve_wisca_parameters(wisca_model, ...) \item \code{c(aminoglycosides(), "AMP", "AMC")} \item \code{c(aminoglycosides(), carbapenems())} } +\item Column indices using numbers \item Combination therapy, indicated by using \code{"+"}, with or without \link[=antimicrobial_selectors]{antimicrobial selectors}, e.g.: \itemize{ \item \code{"cipro + genta"}