diff --git a/DESCRIPTION b/DESCRIPTION
index 8e4c08e3..68c23b41 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: AMR
-Version: 1.4.0.9003
-Date: 2020-10-20
+Version: 1.4.0.9004
+Date: 2020-10-21
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(role = c("aut", "cre"),
diff --git a/NEWS.md b/NEWS.md
index 326834d1..be64d39f 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,5 @@
-# AMR 1.4.0.9003
-## Last updated: 20 October 2020
+# AMR 1.4.0.9004
+## Last updated: 21 October 2020
### New
* Functions `is_gram_negative()` and `is_gram_positive()` as wrappers around `mo_gramstain()`. They always return `TRUE` or `FALSE`, thus always return `FALSE` for species outside the taxonomic kingdom of Bacteria.
diff --git a/R/ggplot_rsi.R b/R/ggplot_rsi.R
index 413f3ebd..e56743f0 100755
--- a/R/ggplot_rsi.R
+++ b/R/ggplot_rsi.R
@@ -273,7 +273,7 @@ geom_rsi <- function(position = NULL,
combine_SI = TRUE,
combine_IR = FALSE,
...) {
-
+ x <- x[1]
stop_ifnot_installed("ggplot2")
stop_if(is.data.frame(position), "`position` is invalid. Did you accidentally use '%>%' instead of '+'?")
meet_criteria(position, allow_class = "character", has_length = 1, is_in = c("fill", "stack", "dodge"), allow_NULL = TRUE)
@@ -294,8 +294,6 @@ geom_rsi <- function(position = NULL,
position <- ggplot2::position_fill(vjust = 0.5, reverse = TRUE)
}
- x <- x[1]
-
# we work with aes_string later on
x_deparse <- deparse(substitute(x))
if (x_deparse != "x") {
diff --git a/R/rsi.R b/R/rsi.R
index 9330eeb1..7ad0e5cd 100755
--- a/R/rsi.R
+++ b/R/rsi.R
@@ -100,14 +100,14 @@
#' summary(example_isolates) # see all R/SI results at a glance
#'
#' if (require("skimr")) {
-#' # support for skim() too:
+#' # class supported in skim() too:
#' skim(example_isolates)
#' }
#'
#' # For INTERPRETING disk diffusion and MIC values -----------------------
#'
#' # a whole data set, even with combined MIC values and disk zones
-#' df <- data.frame(microorganism = "E. coli",
+#' df <- data.frame(microorganism = "Escherichia coli",
#' AMP = as.mic(8),
#' CIP = as.mic(0.256),
#' GEN = as.disk(18),
@@ -136,7 +136,7 @@
#' df %>% mutate(across(AMP:TOB, as.rsi))
#'
#' df %>%
-#' mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli")
+#' mutate_at(vars(AMP:TOB), as.rsi, mo = .$microorganism)
#'
#' # to include information about urinary tract infections (UTI)
#' data.frame(mo = "E. coli",
@@ -457,7 +457,7 @@ as.rsi.data.frame <- function(x,
meet_criteria(x, allow_class = "data.frame") # will also check for dimensions > 0
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1)
- meet_criteria(uti, allow_class = "logical", has_length = c(1, nrow(x)), allow_NULL = TRUE)
+ meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE)
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
@@ -482,6 +482,8 @@ as.rsi.data.frame <- function(x,
}
} else {
# column found, transform to logical
+ stop_if(length(col_uti) != 1 | !col_uti %in% colnames(x),
+ "argument `uti` must be a logical vector, of must be a single column name of `x`")
uti <- as.logical(x[, col_uti, drop = TRUE])
}
} else {
diff --git a/docs/404.html b/docs/404.html
index ff720422..64004c0a 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.4.0.9003
+ 1.4.0.9004
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html
index 254d2cde..ae96a073 100644
--- a/docs/LICENSE-text.html
+++ b/docs/LICENSE-text.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.4.0.9003
+ 1.4.0.9004
diff --git a/docs/articles/index.html b/docs/articles/index.html
index 4f1d0661..8b8e9f36 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.4.0.9003
+ 1.4.0.9004
diff --git a/docs/authors.html b/docs/authors.html
index e2a6f3d1..94befaf0 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.4.0.9003
+ 1.4.0.9004
diff --git a/docs/index.html b/docs/index.html
index a9566494..e56c6ed0 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -43,7 +43,7 @@
AMR (for R)
- 1.4.0.9003
+ 1.4.0.9004
diff --git a/docs/news/index.html b/docs/news/index.html
index 283a66bc..70438724 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -81,7 +81,7 @@
AMR (for R)
- 1.4.0.9003
+ 1.4.0.9004
@@ -236,13 +236,13 @@
Source: NEWS.md
-
-