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 @@
NEWS.md
-
AMR
1.6.0.9019AMR
1.6.0.9020barplot()
on an RSI classmicroorganisms.codes
data setantibiotics
data setskimr::skim()
on classes mo
, mic
and disk
when using the just released dplyr
v1.0.6