diff --git a/DESCRIPTION b/DESCRIPTION index 1da3c8c5..fbdb612a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.4.0.9015 +Version: 1.4.0.9016 Date: 2020-11-10 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index ec6de640..f17103b0 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.4.0.9015 +# AMR 1.4.0.9016 ## Last updated: 10 November 2020 ### New @@ -16,6 +16,7 @@ * Better determination of disk zones and MIC values when running `as.rsi()` on a data.frame * Updated coagulase-negative staphylococci determination with Becker *et al.* 2020 (PMID 32056452), meaning that the species *S. argensis*, *S. caeli*, *S. debuckii*, *S. edaphicus* and *S. pseudoxylosus* are now all considered CoNS * Fix for using parameter `reference_df` in `as.mo()` and `mo_*()` functions that contain old microbial codes (from previous package versions) +* Fix for using `as.rsi()` on a data.frame in older R versions ### Other * All messages and warnings thrown by this package now break sentences on whole words diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index c7d8332d..91ca9ed3 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -313,7 +313,9 @@ word_wrap <- function(..., } msg <- gsub("\n", paste0("\n", strrep(" ", indentation)), msg, fixed = TRUE) msg <- gsub("*|*", paste0("*|*", strrep(" ", indentation)), msg, fixed = TRUE) - + # remove trailing empty characters + msg <- gsub("(\n| )+$", "", msg) + if (length(add_fn) > 0) { if (!is.list(add_fn)) { add_fn <- list(add_fn) diff --git a/R/rsi.R b/R/rsi.R index b92540b0..3299f9d4 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -469,6 +469,13 @@ as.rsi.data.frame <- function(x, meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1) meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1) + for (i in seq_len(ncol(x))) { + # don't keep factors + if (is.factor(x[, i, drop = TRUE])) { + x[, i] <- as.character(x[, i, drop = TRUE]) + } + } + # -- MO col_mo.bak <- col_mo if (is.null(col_mo)) { diff --git a/docs/404.html b/docs/404.html index d49e45e8..53cdaf62 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index bbb17b65..bcdc6cff 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016 diff --git a/docs/articles/index.html b/docs/articles/index.html index 6fde1ebb..44824168 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016 diff --git a/docs/authors.html b/docs/authors.html index 311aaae4..00cd68c3 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016 diff --git a/docs/index.html b/docs/index.html index c4eaf778..d5102462 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016 diff --git a/docs/news/index.html b/docs/news/index.html index 9ba52194..3b66c2fb 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016 @@ -236,9 +236,9 @@ Source: NEWS.md -
-

-AMR 1.4.0.9015 Unreleased +
+

+AMR 1.4.0.9016 Unreleased

@@ -267,6 +267,7 @@
  • Better determination of disk zones and MIC values when running as.rsi() on a data.frame
  • Updated coagulase-negative staphylococci determination with Becker et al. 2020 (PMID 32056452), meaning that the species S. argensis, S. caeli, S. debuckii, S. edaphicus and S. pseudoxylosus are now all considered CoNS
  • Fix for using parameter reference_df in as.mo() and mo_*() functions that contain old microbial codes (from previous package versions)
  • +
  • Fix for using as.rsi() on a data.frame in older R versions
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 8014e2cf..58640be2 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-11-10T15:32Z +last_built: 2020-11-10T18:58Z 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 e642e04a..23c81bd6 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016
    diff --git a/docs/survey.html b/docs/survey.html index 0f9bb3d9..b1d9ec63 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9015 + 1.4.0.9016
    diff --git a/tests/testthat/test-mdro.R b/tests/testthat/test-mdro.R index cdad598a..15908b35 100755 --- a/tests/testthat/test-mdro.R +++ b/tests/testthat/test-mdro.R @@ -46,7 +46,7 @@ test_that("mdro works", { library(dplyr) # example_isolates should have these finding using Dutch guidelines - expect_equal(outcome %>% cleaner::freq() %>% pull(count), + expect_equal(as.double(table(outcome)), c(1969, 25, 6)) # 1969 neg, 25 unconfirmed, 6 pos expect_equal(brmo(example_isolates, info = FALSE), @@ -104,7 +104,7 @@ test_that("mdro works", { expect_equal( # select only rifampicine, mo will be determined automatically (as M. tuberculosis), # number of mono-resistant strains should be equal to number of rifampicine-resistant strains - cleaner::freq(mdr_tb(example_isolates[, "RIF", drop = FALSE]))$count[2], + as.double(table(mdr_tb(example_isolates[, "RIF", drop = FALSE])))[2], count_R(example_isolates$RIF)) sample_rsi <- function() {