From d384b492cf7b1ae2a0f39a5a4eb58e6aabd821fa Mon Sep 17 00:00:00 2001 From: Matthijs Berends Date: Sun, 1 Jun 2025 16:00:12 +0200 Subject: [PATCH] (v2.1.1.9289) unit test fix --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/data.R | 6 ++++++ R/mdro.R | 2 +- man/antimicrobials.Rd | 7 +++++++ tests/testthat/test-mdro.R | 2 +- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 43f3d4365..440323d91 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 2.1.1.9288 +Version: 2.1.1.9289 Date: 2025-06-01 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 7b64cca34..a5c3a80a1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.1.1.9288 +# AMR 2.1.1.9289 *(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)* diff --git a/R/data.R b/R/data.R index 8031b9144..73321c40b 100755 --- a/R/data.R +++ b/R/data.R @@ -29,7 +29,10 @@ #' Data Sets with `r format(nrow(antimicrobials) + nrow(antivirals), big.mark = " ")` Antimicrobial Drugs #' +#' @description #' Two data sets containing all antimicrobials and antivirals. Use [as.ab()] or one of the [`ab_*`][ab_property()] functions to retrieve values from the [antimicrobials] data set. Three identifiers are included in this data set: an antimicrobial ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes. +#' +#' **The `antibiotics` data set has been renamed to `antimicrobials`. The old name will be removed in a future version.** #' @format #' ### For the [antimicrobials] data set: a [tibble][tibble::tibble] with `r nrow(antimicrobials)` observations and `r ncol(antimicrobials)` variables: #' - `ab`\cr antimicrobial ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. ***This is a unique identifier.*** @@ -88,6 +91,9 @@ #' antivirals "antimicrobials" +#' @rdname antimicrobials +"antibiotics" + #' @rdname antimicrobials "antivirals" diff --git a/R/mdro.R b/R/mdro.R index 140cdb658..bc8235063 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -1490,7 +1490,7 @@ mdro <- function(x = NULL, if (length(ESBLs) > 0) { trans_tbl( 2, # positive, unconfirmed - rows = which(x$order == "Enterobacterales" & x[[ESBLs[1]]] == "R" & x[[ESBLs[2]]] == "R" & is.na(esbl)), + rows = which(x$order == "Enterobacterales" & col_values(x, ESBLs[1]) == "R" & col_values(x, ESBLs[2]) == "R" & is.na(esbl)), cols = c(AMX %or% AMP, cephalosporins_3rd), any_all = "all", reason = "Enterobacterales: potential ESBL" diff --git a/man/antimicrobials.Rd b/man/antimicrobials.Rd index bdaf846b4..4b65366df 100644 --- a/man/antimicrobials.Rd +++ b/man/antimicrobials.Rd @@ -3,6 +3,7 @@ \docType{data} \name{antimicrobials} \alias{antimicrobials} +\alias{antibiotics} \alias{antivirals} \title{Data Sets with 617 Antimicrobial Drugs} \format{ @@ -49,6 +50,8 @@ LOINC: } } +An object of class \code{deprecated_amr_dataset} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 497 rows and 14 columns. + An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 120 rows and 11 columns. } \source{ @@ -61,10 +64,14 @@ An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) w \usage{ antimicrobials +antibiotics + antivirals } \description{ Two data sets containing all antimicrobials and antivirals. Use \code{\link[=as.ab]{as.ab()}} or one of the \code{\link[=ab_property]{ab_*}} functions to retrieve values from the \link{antimicrobials} data set. Three identifiers are included in this data set: an antimicrobial ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes. + +\strong{The \code{antibiotics} data set has been renamed to \code{antimicrobials}. The old name will be removed in a future version.} } \details{ Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units}. Do note that ATC codes are not unique. For example, J01CR02 is officially the ATC code for "amoxicillin and beta-lactamase inhibitor". Consequently, these two items from the \link{antimicrobials} data set both return \code{"J01CR02"}: diff --git a/tests/testthat/test-mdro.R b/tests/testthat/test-mdro.R index ff6267064..b7385b69f 100755 --- a/tests/testthat/test-mdro.R +++ b/tests/testthat/test-mdro.R @@ -48,7 +48,7 @@ test_that("test-mdro.R", { # example_isolates should have these finding using Dutch guidelines expect_equal( as.double(table(outcome)), - c(1977, 23, 0) + c(1977, 21, 2) ) expect_equal(