diff --git a/DESCRIPTION b/DESCRIPTION index 471922eef..9f368b5f1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.7.1.9059 +Version: 1.7.1.9060 Date: 2021-12-05 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 8a3a67204..d7758f4fd 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# `AMR` 1.7.1.9059 +# `AMR` 1.7.1.9060 ## Last updated: 5 December 2021 ### Breaking changes diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index d638ebe98..68224209e 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -57,7 +57,7 @@ pm_left_join <- function(x, y, by = NULL, suffix = c(".x", ".y")) { # adapted from https://github.com/nathaneastwood/poorman/blob/52eb6947e0b4430cd588976ed8820013eddf955f/R/where.R#L17-L32 where <- function(fn) { if (!is.function(fn)) { - stop(deparse_var(fn), " is not a valid predicate function.") + stop(pm_deparse_var(fn), " is not a valid predicate function.") } preds <- unlist(lapply( pm_select_env$.data, diff --git a/R/ab_property.R b/R/ab_property.R index d2e734333..5956a2e44 100644 --- a/R/ab_property.R +++ b/R/ab_property.R @@ -354,7 +354,7 @@ set_ab_names <- function(data, ..., property = "name", language = get_locale(), } if (is.data.frame(data)) { - if (length(list(...)) > 0) { + if (tryCatch(length(list(...)) > 0, error = function(e) TRUE)) { df <- pm_select(data, ...) } else { df <- data diff --git a/R/rsi.R b/R/rsi.R index b4bf9e05d..a60432150 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -604,7 +604,11 @@ as.rsi.data.frame <- function(x, } i <- 0 - sel <- colnames(pm_select(x, ...)) + if (tryCatch(length(list(...)) > 0, error = function(e) TRUE)) { + sel <- colnames(pm_select(x, ...)) + } else { + sel <- colnames(x) + } if (!is.null(col_mo)) { sel <- sel[sel != col_mo] } diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index dcd96f440..d49a30d22 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/data-raw/reproduction_of_poorman.R b/data-raw/reproduction_of_poorman.R index 978bd7954..ed32061e1 100644 --- a/data-raw/reproduction_of_poorman.R +++ b/data-raw/reproduction_of_poorman.R @@ -78,4 +78,4 @@ writeLines(contents, "R/aa_helper_pm_functions.R") # after this, comment out: # pm_left_join() since we use a faster version -# pm_group_split() since we don't use it and it relies on R 3.5.0 for the use of ...length(), which is hard to support with C++ code +# pm_group_split() since we don't use it and it relies on R 3.5.0 for the use of ...length(), which is hard to support without C++ code diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index e780f5b98..8713ed11e 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -44,7 +44,7 @@
diff --git a/docs/news/index.html b/docs/news/index.html index 181ea216f..fb0cf8a15 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ @@ -157,19 +157,19 @@AMR
1.7.1.9059AMR
1.7.1.9060p_symbol()
and all filter_*()
functions (except for filter_first_isolate()
), which were all deprecated in a previous package versionkey_antibiotics()
and key_antibiotics_equal()
functions, which were deprecated and superseded by key_antimicrobials()
and antimicrobials_equal()
ggplot2::ggplot()
generics for classes <mic>
, <disk>
, <rsi>
and <resistance_predict>
as they did not follow the ggplot2
logic. They were replaced with ggplot2::autoplot()
generics.Support for EUCAST Intrinsic Resistance and Unusual Phenotypes v3.3 (October 2021), effective in the eucast_rules()
function. This is now the default guideline (all other guidelines are still available).
Function set_ab_names()
to rename data set columns that resemble antimicrobial drugs. This allows for quickly renaming columns to official names, ATC codes, etc. Its second argument can be a tidyverse way of selecting:
Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese
antibiotics
data set now contains all ATC codes that are available through the WHOCC website, regardless of drugs being present in more than one ATC group. This means that:
get_episode()
and is_new_episode()
can now cope with NA
s