diff --git a/DESCRIPTION b/DESCRIPTION index 213aaf15..fe75420f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.0.0.9004 +Version: 1.0.0.9005 Date: 2020-02-21 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index 0aa54ced..ab0091e6 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.0.0.9004 +# AMR 1.0.0.9005 ## Last updated: 21-Feb-2020 ### Changed @@ -13,6 +13,7 @@ ``` * Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole * Added `uti` (as abbreviation of urinary tract infections) as parameter to `as.rsi()`, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs +* Info printing in functions `eucast_rules()`, `first_isolate()`, `mdro()` and `resistance_predict()` will now at default only print when R is in an interactive mode (i.e. not in RMarkdown) # AMR 1.0.0 diff --git a/R/eucast_rules.R b/R/eucast_rules.R index 0fb43071..8c277eb3 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -197,7 +197,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" #' } eucast_rules <- function(x, col_mo = NULL, - info = TRUE, + info = interactive(), rules = c("breakpoints", "expert", "other", "all"), verbose = FALSE, ...) { diff --git a/R/first_isolate.R b/R/first_isolate.R index c4ac12f6..f421aea1 100755 --- a/R/first_isolate.R +++ b/R/first_isolate.R @@ -148,7 +148,7 @@ first_isolate <- function(x, type = "keyantibiotics", ignore_I = TRUE, points_threshold = 2, - info = TRUE, + info = interactive(), include_unknown = FALSE, ...) { diff --git a/R/mdro.R b/R/mdro.R index af1a1b1b..00184bda 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -84,7 +84,7 @@ mdro <- function(x, guideline = "CMI2012", col_mo = NULL, - info = TRUE, + info = interactive(), pct_required_classes = 0.5, combine_SI = TRUE, verbose = FALSE, diff --git a/R/misc.R b/R/misc.R index 0b375c1f..d007bf7a 100755 --- a/R/misc.R +++ b/R/misc.R @@ -125,6 +125,7 @@ search_type_in_df <- function(x, type) { found <- colnames(x)[colnames(x) %like% "(urine|urinary)"][1] } if (!is.null(found)) { + # this column should contain logicals if (!is.logical(x[, found, drop = TRUE])) { message(red(paste0("NOTE: Column `", bold(found), "` found as input for `col_", type, "`, but this column does not contain 'logical' values (TRUE/FALSE) and was ignored."))) diff --git a/R/resistance_predict.R b/R/resistance_predict.R index 838788c7..48af6e3e 100755 --- a/R/resistance_predict.R +++ b/R/resistance_predict.R @@ -121,7 +121,7 @@ resistance_predict <- function(x, model = NULL, I_as_S = TRUE, preserve_measurements = TRUE, - info = TRUE, + info = interactive(), ...) { if (nrow(x) == 0) { diff --git a/_pkgdown.yml b/_pkgdown.yml index e6248314..c6b8a71c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -135,6 +135,7 @@ reference: - "`antibiotics`" - "`antivirals`" - "`example_isolates`" + - "`example_isolates_unclean`" - "`microorganisms.codes`" - "`microorganisms.old`" - "`microorganisms`" diff --git a/docs/404.html b/docs/404.html index 412f36d9..ebc5ede1 100644 --- a/docs/404.html +++ b/docs/404.html @@ -78,7 +78,7 @@ AMR (for R) - 1.0.0.9004 + 1.0.0.9005 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index c2ef2b19..8bf2e8a1 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 1.0.0.9004 + 1.0.0.9005 diff --git a/docs/articles/index.html b/docs/articles/index.html index 6c2231f8..5fed4963 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 1.0.0.9004 + 1.0.0.9005 diff --git a/docs/authors.html b/docs/authors.html index 87a9651c..0851da00 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 1.0.0.9004 + 1.0.0.9005 diff --git a/docs/index.html b/docs/index.html index c8d397a0..3c0ed56a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.0.0.9004 + 1.0.0.9005 diff --git a/docs/news/index.html b/docs/news/index.html index 8cf9bcb1..e87af7e1 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 1.0.0.9004 + 1.0.0.9005 @@ -219,9 +219,9 @@ -
+

-AMR 1.0.0.9004 Unreleased +AMR 1.0.0.9005 Unreleased

@@ -242,6 +242,7 @@
  • Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole

  • Added uti (as abbreviation of urinary tract infections) as parameter to as.rsi(), so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs

  • +
  • Info printing in functions eucast_rules(), first_isolate(), mdro() and resistance_predict() will now at default only print when R is in an interactive mode (i.e. not in RMarkdown)

  • @@ -1473,7 +1474,7 @@

    Contents

    diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index bc69c608..5c72ac02 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -80,7 +80,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 0.9.0.9029 + 1.0.0.9005
    @@ -230,7 +230,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
    eucast_rules(
       x,
       col_mo = NULL,
    -  info = TRUE,
    +  info = interactive(),
       rules = c("breakpoints", "expert", "other", "all"),
       verbose = FALSE,
       ...
    diff --git a/docs/reference/example_isolates_unclean.html b/docs/reference/example_isolates_unclean.html
    index 7d98a1fc..a104e387 100644
    --- a/docs/reference/example_isolates_unclean.html
    +++ b/docs/reference/example_isolates_unclean.html
    @@ -79,7 +79,7 @@
           
           
             AMR (for R)
    -        1.0.0.9004
    +        1.0.0.9005
           
         
     
    diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html
    index 60d8f6ea..26ddd36f 100644
    --- a/docs/reference/first_isolate.html
    +++ b/docs/reference/first_isolate.html
    @@ -79,7 +79,7 @@
           
           
             AMR (for R)
    -        0.9.0.9029
    +        1.0.0.9005
           
         
     
    @@ -241,7 +241,7 @@
       type = "keyantibiotics",
       ignore_I = TRUE,
       points_threshold = 2,
    -  info = TRUE,
    +  info = interactive(),
       include_unknown = FALSE,
       ...
     )
    diff --git a/docs/reference/index.html b/docs/reference/index.html
    index 6b1c899b..f7c2ee1e 100644
    --- a/docs/reference/index.html
    +++ b/docs/reference/index.html
    @@ -78,7 +78,7 @@
           
           
             AMR (for R)
    -        1.0.0.9004
    +        1.0.0.9005
           
         
     
    @@ -451,6 +451,12 @@
             

    Data set with 2,000 example isolates

    + +

    example_isolates_unclean

    + +

    Data set with unclean data

    + +

    microorganisms.codes

    diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index 084d51a3..95ac9936 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -79,7 +79,7 @@ AMR (for R) - 0.9.0.9029 + 1.0.0.9005 @@ -229,7 +229,7 @@ x, guideline = "CMI2012", col_mo = NULL, - info = TRUE, + info = interactive(), pct_required_classes = 0.5, combine_SI = TRUE, verbose = FALSE, diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html index 6a25eb11..58fef3c2 100644 --- a/docs/reference/resistance_predict.html +++ b/docs/reference/resistance_predict.html @@ -79,7 +79,7 @@ AMR (for R) - 0.9.0.9029 + 1.0.0.9005 @@ -236,7 +236,7 @@ model = NULL, I_as_S = TRUE, preserve_measurements = TRUE, - info = TRUE, + info = interactive(), ... ) @@ -251,7 +251,7 @@ model = NULL, I_as_S = TRUE, preserve_measurements = TRUE, - info = TRUE, + info = interactive(), ... ) diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index e2a6b4d1..c1b1f37b 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -19,7 +19,7 @@ Leclercq et al. \strong{EUCAST expert rules in antimicrobial susceptibility test eucast_rules( x, col_mo = NULL, - info = TRUE, + info = interactive(), rules = c("breakpoints", "expert", "other", "all"), verbose = FALSE, ... diff --git a/man/first_isolate.Rd b/man/first_isolate.Rd index a3b30774..cd9f51c9 100755 --- a/man/first_isolate.Rd +++ b/man/first_isolate.Rd @@ -27,7 +27,7 @@ first_isolate( type = "keyantibiotics", ignore_I = TRUE, points_threshold = 2, - info = TRUE, + info = interactive(), include_unknown = FALSE, ... ) diff --git a/man/mdro.Rd b/man/mdro.Rd index 727dc191..a7f3e9be 100644 --- a/man/mdro.Rd +++ b/man/mdro.Rd @@ -22,7 +22,7 @@ mdro( x, guideline = "CMI2012", col_mo = NULL, - info = TRUE, + info = interactive(), pct_required_classes = 0.5, combine_SI = TRUE, verbose = FALSE, diff --git a/man/resistance_predict.Rd b/man/resistance_predict.Rd index 6f07acab..3356f1b3 100644 --- a/man/resistance_predict.Rd +++ b/man/resistance_predict.Rd @@ -18,7 +18,7 @@ resistance_predict( model = NULL, I_as_S = TRUE, preserve_measurements = TRUE, - info = TRUE, + info = interactive(), ... ) @@ -33,7 +33,7 @@ rsi_predict( model = NULL, I_as_S = TRUE, preserve_measurements = TRUE, - info = TRUE, + info = interactive(), ... ) diff --git a/tests/testthat/test-disk.R b/tests/testthat/test-disk.R index 850426e3..f463319f 100755 --- a/tests/testthat/test-disk.R +++ b/tests/testthat/test-disk.R @@ -31,5 +31,9 @@ test_that("disk works", { expect_silent(as.disk(levels(as.disk(15)))) expect_warning(as.disk("INVALID VALUE")) + + expect_output(print(as.disk(12))) + library(tibble) + expect_output(print(tibble(d = as.disk(12)))) }) diff --git a/tests/testthat/test-eucast_rules.R b/tests/testthat/test-eucast_rules.R index 531791a3..5d5ca8b5 100755 --- a/tests/testthat/test-eucast_rules.R +++ b/tests/testthat/test-eucast_rules.R @@ -110,9 +110,9 @@ test_that("EUCAST rules work", { "S") # also test norf - expect_output(suppressWarnings(eucast_rules(example_isolates %>% mutate(NOR = "S", NAL = "S")))) + expect_output(suppressWarnings(eucast_rules(example_isolates %>% mutate(NOR = "S", NAL = "S"), info = TRUE))) # check verbose output - expect_output(suppressWarnings(eucast_rules(example_isolates, verbose = TRUE))) + expect_output(suppressWarnings(eucast_rules(example_isolates, verbose = TRUE, info = TRUE))) }) diff --git a/tests/testthat/test-first_isolate.R b/tests/testthat/test-first_isolate.R index 5adf13b0..73c5cf6a 100755 --- a/tests/testthat/test-first_isolate.R +++ b/tests/testthat/test-first_isolate.R @@ -141,7 +141,8 @@ test_that("first isolates work", { mutate(first = first_isolate(., "date", "patient_id", col_mo = "mo", col_specimen = "specimen", - filter_specimen = "something_unexisting"))) + filter_specimen = "something_unexisting", + info = TRUE))) # printing of exclusion message expect_message(example_isolates %>% @@ -149,7 +150,8 @@ test_that("first isolates work", { col_mo = "mo", col_patient_id = "patient_id", col_testcode = "gender", - testcodes_exclude = "M")) + testcodes_exclude = "M", + info = TRUE)) # errors expect_error(first_isolate("date", "patient_id", col_mo = "mo"))