diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 7e6b468b..d46756d5 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -64,8 +64,8 @@ jobs: - {os: ubuntu-20.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-20.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-20.04, r: '3.3', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: '3.2', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: '3.1', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + # - {os: ubuntu-20.04, r: '3.2', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + # - {os: ubuntu-20.04, r: '3.1', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-20.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-16.04, r: 'devel', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: 'release', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} @@ -75,8 +75,8 @@ jobs: - {os: ubuntu-16.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: '3.3', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.2', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.1', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + # - {os: ubuntu-16.04, r: '3.2', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} + # - {os: ubuntu-16.04, r: '3.1', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} - {os: ubuntu-16.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} env: diff --git a/DESCRIPTION b/DESCRIPTION index 56a98629..140c7b25 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.5.0.9006 +Version: 1.5.0.9007 Date: 2021-01-18 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index fc73dceb..73246277 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.5.0.9006 +# AMR 1.5.0.9007 ## Last updated: 18 January 2021 ### New diff --git a/R/mdro.R b/R/mdro.R index 8959fcca..28770e7e 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -805,6 +805,7 @@ mdro <- function(x, x[which(x$genus == "Escherichia" & x$species == "hermannii"), ab_NA(c(TCC, TZP))] <- NA x[which((x$genus == "Citrobacter" & x$species == "freundii") | (x$genus == "Enterobacter" & x$species == "aerogenes") + | (x$genus == "Klebsiella" & x$species == "aerogenes") # new name (2017) | (x$genus == "Enterobacter" & x$species == "cloacae") | (x$genus == "Hafnia" & x$species == "alvei") | (x$genus == "Morganella" & x$species == "morganii") @@ -824,6 +825,7 @@ mdro <- function(x, x[which((x$genus == "Citrobacter" & x$species == "koseri") | (x$genus == "Citrobacter" & x$species == "freundii") | (x$genus == "Enterobacter" & x$species == "aerogenes") + | (x$genus == "Klebsiella" & x$species == "aerogenes") # new name (2017) | (x$genus == "Enterobacter" & x$species == "cloacae") | (x$genus == "Escherichia" & x$species == "hermannii") | (x$genus == "Hafnia" & x$species == "alvei") @@ -836,6 +838,7 @@ mdro <- function(x, | (x$genus == "Serratia" & x$species == "marcescens")), ab_NA(AMP)] <- NA x[which((x$genus == "Citrobacter" & x$species == "freundii") | (x$genus == "Enterobacter" & x$species == "aerogenes") + | (x$genus == "Klebsiella" & x$species == "aerogenes") # new name (2017) | (x$genus == "Enterobacter" & x$species == "cloacae") | (x$genus == "Hafnia" & x$species == "alvei") | (x$genus == "Morganella" & x$species == "morganii") @@ -845,6 +848,7 @@ mdro <- function(x, x[which((x$genus == "Citrobacter" & x$species == "freundii") | (x$genus == "Citrobacter" & x$species == "koseri") | (x$genus == "Enterobacter" & x$species == "aerogenes") + | (x$genus == "Klebsiella" & x$species == "aerogenes") # new name (2017) | (x$genus == "Enterobacter" & x$species == "cloacae") | (x$genus == "Hafnia" & x$species == "alvei") | (x$genus == "Providencia" & x$species == "rettgeri") diff --git a/data-raw/AMR_1.5.0.9006.tar.gz b/data-raw/AMR_1.5.0.9007.tar.gz similarity index 79% rename from data-raw/AMR_1.5.0.9006.tar.gz rename to data-raw/AMR_1.5.0.9007.tar.gz index 071885c9..af5e782e 100644 Binary files a/data-raw/AMR_1.5.0.9006.tar.gz and b/data-raw/AMR_1.5.0.9007.tar.gz differ diff --git a/docs/404.html b/docs/404.html index 2c54c76f..e4192c1a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 1aee5fca..53200bbb 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007 diff --git a/docs/articles/index.html b/docs/articles/index.html index 5a40e997..cfd9a553 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007 diff --git a/docs/authors.html b/docs/authors.html index 8a25c95f..63d122fe 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007 diff --git a/docs/index.html b/docs/index.html index 7bbff29f..bb3dd48a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007 diff --git a/docs/news/index.html b/docs/news/index.html index f3366557..e2bbca0f 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007 @@ -236,9 +236,9 @@ Source: NEWS.md -
-

-AMR 1.5.0.9006 Unreleased +
+

+AMR 1.5.0.9007 Unreleased

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 21cd1f1b..d2d6b68f 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: 2021-01-18T15:57Z +last_built: 2021-01-18T17:45Z 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 98ed696d..ceb53d07 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007

diff --git a/docs/survey.html b/docs/survey.html index 636d9446..b1b9d7cc 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.5.0.9006 + 1.5.0.9007
diff --git a/tests/testthat/test-eucast_rules.R b/tests/testthat/test-eucast_rules.R index 84f46e09..2eb7eba1 100755 --- a/tests/testthat/test-eucast_rules.R +++ b/tests/testthat/test-eucast_rules.R @@ -50,20 +50,21 @@ test_that("EUCAST rules work", { expect_warning(eucast_rules(data.frame(mo = "Escherichia coli", vancomycin = "S", stringsAsFactors = TRUE))) expect_identical(colnames(example_isolates), - colnames(suppressWarnings(eucast_rules(example_isolates)))) + colnames(suppressWarnings(eucast_rules(example_isolates, info = FALSE)))) + expect_output(suppressMessages(eucast_rules(example_isolates, info = TRUE))) a <- data.frame(mo = c("Klebsiella pneumoniae", "Pseudomonas aeruginosa", - "Enterobacter aerogenes"), + "Enterobacter cloacae"), amox = "-", # Amoxicillin stringsAsFactors = FALSE) b <- data.frame(mo = c("Klebsiella pneumoniae", "Pseudomonas aeruginosa", - "Enterobacter aerogenes"), + "Enterobacter cloacae"), amox = "R", # Amoxicillin stringsAsFactors = FALSE) expect_identical(suppressWarnings(eucast_rules(a, "mo", info = FALSE)), b) - expect_identical(suppressWarnings(eucast_rules(a, "mo", info = TRUE)), b) + expect_output(suppressMessages(suppressWarnings(eucast_rules(a, "mo", info = TRUE)))) a <- data.frame(mo = c("Staphylococcus aureus", "Streptococcus group A"), @@ -81,8 +82,8 @@ test_that("EUCAST rules work", { example_isolates %>% mutate(TIC = as.rsi("R"), PIP = as.rsi("S")) %>% - eucast_rules(col_mo = "mo", version_expertrules = 3.1) %>% - left_join_microorganisms() %>% + eucast_rules(col_mo = "mo", version_expertrules = 3.1, info = FALSE) %>% + left_join_microorganisms(by = "mo") %>% filter(family == "Enterobacteriaceae") %>% pull(PIP) %>% unique() %>% diff --git a/tests/testthat/test-mdro.R b/tests/testthat/test-mdro.R index b4f3fd84..47f93e69 100755 --- a/tests/testthat/test-mdro.R +++ b/tests/testthat/test-mdro.R @@ -34,13 +34,13 @@ test_that("mdro works", { expect_error(mdro(example_isolates, guideline = c("BRMO", "MRGN"), info = TRUE)) expect_error(mdro(example_isolates, col_mo = "invalid", info = TRUE)) - outcome <- suppressWarnings(mdro(example_isolates)) - outcome <- mdro(example_isolates, "eucast3.1", info = TRUE) - outcome <- eucast_exceptional_phenotypes(example_isolates, info = TRUE) + expect_output(suppressMessages(suppressWarnings(mdro(example_isolates, info = TRUE)))) + expect_output(suppressMessages(suppressWarnings(mdro(example_isolates, "eucast3.1", info = TRUE)))) + expect_output(outcome <- suppressMessages(suppressWarnings(eucast_exceptional_phenotypes(example_isolates, info = TRUE)))) # check class expect_equal(class(outcome), c("ordered", "factor")) - outcome <- mdro(example_isolates, "nl", info = TRUE) + expect_output(outcome <- mdro(example_isolates, "nl", info = TRUE)) # check class expect_equal(class(outcome), c("ordered", "factor")) @@ -228,15 +228,14 @@ test_that("mdro works", { "ERY == 'R' & age > 60" ~ "Elderly Type B", as_factor = TRUE) expect_output(print(custom)) - x <- mdro(example_isolates, guideline = custom, info = TRUE) - expect_equal(as.double(table(x)), c(43, 891, 1066)) + expect_output(x <- mdro(example_isolates, guideline = custom, info = TRUE)) + expect_equal(as.double(table(x)), c(1066, 43, 891)) expect_output(print(custom_mdro_guideline(AMX == "R" ~ "test", as_factor = FALSE))) expect_error(custom_mdro_guideline()) expect_error(custom_mdro_guideline("test")) expect_error(custom_mdro_guideline("test" ~ c(1:3))) expect_error(custom_mdro_guideline("test" ~ A)) - expect_error(custom_mdro_guideline(test ~ "A")) expect_warning(mdro(example_isolates, # since `test` gives an error, it will be ignored with a warning guideline = custom_mdro_guideline(test ~ "A"), diff --git a/tests/testthat/test-resistance_predict.R b/tests/testthat/test-resistance_predict.R index 1515be9d..2b0c5bb4 100644 --- a/tests/testthat/test-resistance_predict.R +++ b/tests/testthat/test-resistance_predict.R @@ -27,25 +27,25 @@ context("resistance_predict.R") test_that("prediction of rsi works", { skip_on_cran() - AMX_R <- example_isolates %>% - filter(mo == "B_ESCHR_COLI") %>% - rsi_predict(col_ab = "AMX", - col_date = "date", - model = "binomial", - minimum = 10, - info = TRUE) %>% - pull("value") + + library(dplyr) + expect_output(AMX_R <- example_isolates %>% + filter(mo == "B_ESCHR_COLI") %>% + rsi_predict(col_ab = "AMX", + col_date = "date", + model = "binomial", + minimum = 10, + info = TRUE) %>% + pull("value")) # AMX resistance will increase according to data set `example_isolates` expect_true(AMX_R[3] < AMX_R[20]) - - x <- resistance_predict(example_isolates, col_ab = "AMX", year_min = 2010, model = "binomial") + + expect_output(x <- suppressMessages(resistance_predict(example_isolates, col_ab = "AMX", year_min = 2010, model = "binomial", info = TRUE))) pdf(NULL) # prevent Rplots.pdf being created expect_silent(plot(x)) expect_silent(ggplot_rsi_predict(x)) expect_error(ggplot_rsi_predict(example_isolates)) - library(dplyr, warn.conflicts = FALSE) - expect_output(rsi_predict(x = filter(example_isolates, mo == "B_ESCHR_COLI"), model = "binomial", col_ab = "AMX",