diff --git a/DESCRIPTION b/DESCRIPTION index ece811c4..d1ca04d9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.6.0.9019 -Date: 2021-05-05 +Version: 1.6.0.9020 +Date: 2021-05-06 Title: Antimicrobial Resistance Data Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index dd762700..3744b91d 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# `AMR` 1.6.0.9019 -## Last updated: 5 May 2021 +# `AMR` 1.6.0.9020 +## Last updated: 6 May 2021 ### New * Function `custom_eucast_rules()` that brings support for custom AMR rules in `eucast_rules()` @@ -36,6 +36,7 @@ * Colour fix for using `barplot()` on an RSI class * Added 25 common system codes for bacteria to the `microorganisms.codes` data set * Added 16 common system codes for antimicrobial agents to the `antibiotics` data set +* Fix for using `skimr::skim()` on classes `mo`, `mic` and `disk` when using the just released `dplyr` v1.0.6 # `AMR` 1.6.0 diff --git a/R/disk.R b/R/disk.R index 013c3b48..46d6fd4f 100644 --- a/R/disk.R +++ b/R/disk.R @@ -202,7 +202,7 @@ get_skimmers.disk <- function(column) { min = ~min(as.double(.), na.rm = TRUE), max = ~max(as.double(.), na.rm = TRUE), median = ~stats::median(as.double(.), na.rm = TRUE), - n_unique = ~pm_n_distinct(., na.rm = TRUE), + n_unique = ~length(unique(stats::na.omit(.))), hist = ~skimr::inline_hist(stats::na.omit(as.double(.))) ) } diff --git a/R/mic.R b/R/mic.R index 7defae52..dd108269 100755 --- a/R/mic.R +++ b/R/mic.R @@ -348,7 +348,7 @@ get_skimmers.mic <- function(column) { min = ~min(., na.rm = TRUE), max = ~max(., na.rm = TRUE), median = ~stats::median(., na.rm = TRUE), - n_unique = ~pm_n_distinct(., na.rm = TRUE), + n_unique = ~length(unique(stats::na.omit(.))), hist_log2 = ~skimr::inline_hist(log2(stats::na.omit(.))) ) } diff --git a/R/mo.R b/R/mo.R index f5048b5f..ca75cfce 100755 --- a/R/mo.R +++ b/R/mo.R @@ -1732,9 +1732,9 @@ freq.mo <- function(x, ...) { get_skimmers.mo <- function(column) { skimr::sfl( skim_type = "mo", - unique_total = ~pm_n_distinct(., na.rm = TRUE), - gram_negative = ~sum(mo_is_gram_negative(stats::na.omit(.))), - gram_positive = ~sum(mo_is_gram_positive(stats::na.omit(.))), + unique_total = ~length(unique(stats::na.omit(.))), + gram_negative = ~sum(mo_is_gram_negative(.), na.rm = TRUE), + gram_positive = ~sum(mo_is_gram_positive(.), na.rm = TRUE), top_genus = ~names(sort(-table(mo_genus(stats::na.omit(.), language = NULL))))[1L], top_species = ~names(sort(-table(mo_name(stats::na.omit(.), language = NULL))))[1L] ) diff --git a/R/rsi.R b/R/rsi.R index e9887aff..ecc463fc 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -934,28 +934,16 @@ get_skimmers.rsi <- function(column) { # get the variable name 'skim_variable' name_call <- function(.data) { calls <- sys.calls() + frms <- sys.frames() calls_txt <- vapply(calls, function(x) paste(deparse(x), collapse = ""), FUN.VALUE = character(1)) if (any(calls_txt %like% "skim_variable", na.rm = TRUE)) { ind <- which(calls_txt %like% "skim_variable")[1L] - vars <- tryCatch(eval(parse(text = ".data$skim_variable"), envir = sys.frame(ind)), + vars <- tryCatch(eval(parse(text = ".data$skim_variable$rsi"), envir = frms[[ind]]), error = function(e) NULL) + tryCatch(ab_name(as.character(calls[[length(calls)]][[2]]), language = NULL), + error = function(e) NA_character_) } else { - vars <- NULL - } - i <- tryCatch(attributes(calls[[length(calls)]])$position, - error = function(e) NULL) - if (is.null(vars) | is.null(i)) { NA_character_ - } else { - lengths <- vapply(FUN.VALUE = double(1), vars, length) - when_starts_rsi <- which(names(vapply(FUN.VALUE = double(1), vars, length)) == "rsi") - offset <- sum(lengths[c(1:when_starts_rsi - 1)]) - var <- vars$rsi[i - offset] - if (!isFALSE(var == "data")) { - NA_character_ - } else{ - ab_name(var) - } } } diff --git a/R/sysdata.rda b/R/sysdata.rda index 2f7af387..3740d49a 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index b0ffd41f..8a027e88 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/docs/404.html b/docs/404.html index 0807eae5..59dc7870 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 9572fcb7..de70adc5 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020 diff --git a/docs/articles/index.html b/docs/articles/index.html index ae06b7e0..7f7ac163 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020 diff --git a/docs/authors.html b/docs/authors.html index fee2bd6f..4554d04d 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020 diff --git a/docs/index.html b/docs/index.html index c14d81cc..0a290bf8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020 diff --git a/docs/news/index.html b/docs/news/index.html index 2fd81cce..8bd80555 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020 @@ -236,12 +236,12 @@ Source: NEWS.md -
-

- Unreleased AMR 1.6.0.9019

-
+
+

+ Unreleased AMR 1.6.0.9020

+

-Last updated: 5 May 2021 +Last updated: 6 May 2021

@@ -300,6 +300,7 @@
  • Colour fix for using barplot() on an RSI class
  • Added 25 common system codes for bacteria to the microorganisms.codes data set
  • Added 16 common system codes for antimicrobial agents to the antibiotics data set
  • +
  • Fix for using skimr::skim() on classes mo, mic and disk when using the just released dplyr v1.0.6
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index e235dcfc..c82c9d68 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -12,7 +12,7 @@ articles: datasets: datasets.html resistance_predict: resistance_predict.html welcome_to_AMR: welcome_to_AMR.html -last_built: 2021-05-05T13:26Z +last_built: 2021-05-06T13:16Z urls: reference: https://msberends.github.io/AMR//reference article: https://msberends.github.io/AMR//articles diff --git a/docs/reference/index.html b/docs/reference/index.html index a8bb8471..9d44c3d6 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020
    diff --git a/docs/survey.html b/docs/survey.html index e7acba4c..b6fab0fe 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.6.0.9019 + 1.6.0.9020