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 -
-

-AMR 1.4.0.9003 Unreleased +
+

+AMR 1.4.0.9004 Unreleased

-
+

-Last updated: 20 October 2020 +Last updated: 21 October 2020

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 9b7457ac..3c3e4510 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: 2020-10-20T18:59Z +last_built: 2020-10-21T09:40Z urls: reference: https://msberends.github.io/AMR//reference article: https://msberends.github.io/AMR//articles diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 7b4d7d40..54b4007e 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9001 + 1.4.0.9004

@@ -414,14 +414,14 @@ The lifecycle of this function is stablesummary(example_isolates) # see all R/SI results at a glance if (require("skimr")) { - # support for skim() too: + # class <rsi> 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), @@ -450,7 +450,7 @@ The lifecycle of this function is stabledf %>% 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", diff --git a/docs/reference/index.html b/docs/reference/index.html index 6a8dc016..3f08f24a 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9003 + 1.4.0.9004
diff --git a/docs/survey.html b/docs/survey.html index 9995b100..4d2a86b3 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9003 + 1.4.0.9004
diff --git a/man/as.rsi.Rd b/man/as.rsi.Rd index e33a6ffb..80cb649a 100755 --- a/man/as.rsi.Rd +++ b/man/as.rsi.Rd @@ -157,14 +157,14 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/ 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), @@ -193,7 +193,7 @@ if (require("dplyr")) { 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",