From 412077a6f2a6d2bac116f35757de6a05c64a3a1a Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Sat, 26 Oct 2019 22:21:26 +0200 Subject: [PATCH] (v0.8.0.9005) fix unit tests --- .gitlab-ci.yml | 2 +- DESCRIPTION | 2 +- NEWS.md | 2 +- R/globals.R | 1 + R/mdro.R | 2 +- R/mo.R | 2 -- codecov.yml | 1 - docs/404.html | 2 +- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 8 ++++---- docs/reference/index.html | 2 +- tests/testthat/test-mdro.R | 10 +++++----- 15 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d6ec3501..e931eda2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -117,7 +117,7 @@ coverage: script: - apt-get install --yes git # codecov token is set in https://gitlab.com/msberends/AMR/settings/ci_cd - - Rscript -e "cc <- covr::package_coverage(); covr::codecov(coverage = cc, token = '$codecov'); cat('Code coverage:', covr::percent_coverage(cc))" + - Rscript -e "Sys.setenv(NOT_CRAN = 'true'); cc <- covr::package_coverage(); covr::codecov(coverage = cc, token = '$codecov'); cat('Code coverage:', covr::percent_coverage(cc))" coverage: '/Code coverage: \d+\.\d+/' pages: diff --git a/DESCRIPTION b/DESCRIPTION index 7c7edde2..ef335c31 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.8.0.9004 +Version: 0.8.0.9005 Date: 2019-10-26 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index 66d7e65e..9627f8cd 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.8.0.9004 +# AMR 0.8.0.9005 Last updated: 26-Oct-2019 ### New diff --git a/R/globals.R b/R/globals.R index 5db2422b..8f0ac9d6 100755 --- a/R/globals.R +++ b/R/globals.R @@ -52,6 +52,7 @@ globalVariables(c(".", "Last name", "lookup", "mdr", + "MDRO", "median", "microorganisms", "microorganisms.codes", diff --git a/R/mdro.R b/R/mdro.R index 5ef60add..206de2b9 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -461,7 +461,7 @@ mdro <- function(x, left_join_microorganisms(by = col_mo) %>% # add unconfirmed to where genus is available mutate(MDRO = ifelse(!is.na(genus), 1, NA_integer_), - row_number = 1:nrow(x)) %>% + row_number = seq_len(nrow(x))) %>% # transform to data.frame so subsetting is possible with x[y, z] (might not be the case with tibble/data.table/...) as.data.frame(stringsAsFactors = FALSE) diff --git a/R/mo.R b/R/mo.R index 5ee429ce..d6eff413 100755 --- a/R/mo.R +++ b/R/mo.R @@ -241,7 +241,6 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE, pull(mo) # don't save valid fullnames to history (i.e. values that are in microorganisms$fullname) - # set_mo_history(x, y, 0, force = isTRUE(list(...)$force_mo_history), disable = isTRUE(list(...)$disable_mo_history)) } else { # will be checked for mo class in validation and uses exec_as.mo internally if necessary @@ -636,7 +635,6 @@ exec_as.mo <- function(x, x[i] <- found[1L] if (initial_search == TRUE) { # don't save valid fullnames to history (i.e. values that are in microorganisms$fullname) - # set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history) } next } diff --git a/codecov.yml b/codecov.yml index fea6aac8..13bb0025 100644 --- a/codecov.yml +++ b/codecov.yml @@ -19,4 +19,3 @@ ignore: - "R/atc_online.R" - "R/mo_source.R" - "R/resistance_predict.R" - - "R/aa_test.R" diff --git a/docs/404.html b/docs/404.html index 7fd4293e..6c2205c5 100644 --- a/docs/404.html +++ b/docs/404.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9004 + 0.8.0.9005 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index c1050c8f..896e346a 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9004 + 0.8.0.9005 diff --git a/docs/articles/index.html b/docs/articles/index.html index 3136c996..aa9e1380 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9004 + 0.8.0.9005 diff --git a/docs/authors.html b/docs/authors.html index 26436eaf..859e03c2 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9004 + 0.8.0.9005 diff --git a/docs/index.html b/docs/index.html index 1cb0d83e..1749dd9b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -45,7 +45,7 @@ AMR (for R) - 0.8.0.9004 + 0.8.0.9005 diff --git a/docs/news/index.html b/docs/news/index.html index 35e7d21c..14ef92d4 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9004 + 0.8.0.9005 @@ -231,9 +231,9 @@ -
+

-AMR 0.8.0.9004 Unreleased +AMR 0.8.0.9005 Unreleased

Last updated: 26-Oct-2019

@@ -1321,7 +1321,7 @@ Using as.mo(..., allow_uncertain = 3)

Contents

diff --git a/tests/testthat/test-mdro.R b/tests/testthat/test-mdro.R index cd822671..a117f67d 100755 --- a/tests/testthat/test-mdro.R +++ b/tests/testthat/test-mdro.R @@ -125,7 +125,7 @@ test_that("mdro works", { 2) # check the guideline by Magiorakos et al. (2012), the default guideline - stau <- tibble::tribble( + stau <- tribble( ~mo, ~GEN, ~RIF, ~CPT, ~OXA, ~CIP, ~MFX, ~SXT, ~FUS, ~VAN, ~TEC, ~TLV, ~TGC, ~CLI, ~DAP, ~ERY, ~LNZ, ~CHL, ~FOS, ~QDA, ~TCY, ~DOX, ~MNO, "S. aureus", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S. aureus", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", @@ -134,7 +134,7 @@ test_that("mdro works", { ) expect_equal(as.integer(mdro(stau)), c(1:4)) - ente <- tibble::tribble( + ente <- tribble( ~mo, ~GEH, ~STH, ~IPM, ~MEM, ~DOR, ~CIP, ~LVX, ~MFX, ~VAN, ~TEC, ~TGC, ~DAP, ~LNZ, ~AMP, ~QDA, ~DOX, ~MNO, "Enterococcus", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "Enterococcus", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", @@ -143,7 +143,7 @@ test_that("mdro works", { ) expect_equal(as.integer(mdro(ente)), c(1:4)) - entero <- tibble::tribble( + entero <- tribble( ~mo, ~GEN, ~TOB, ~AMK, ~NET, ~CPT, ~TCC, ~TZP, ~ETP, ~IPM, ~MEM, ~DOR, ~CZO, ~CXM, ~CTX, ~CAZ, ~FEP, ~FOX, ~CTT, ~CIP, ~SXT, ~TGC, ~ATM, ~AMP, ~AMC, ~SAM, ~CHL, ~FOS, ~COL, ~TCY, ~DOX, ~MNO, "E. coli", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "E. coli", "R", "R", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", @@ -152,7 +152,7 @@ test_that("mdro works", { ) expect_equal(as.integer(mdro(entero)), c(1:4)) - pseud <- tibble::tribble( + pseud <- tribble( ~mo, ~GEN, ~TOB, ~AMK, ~NET, ~IPM, ~MEM, ~DOR, ~CAZ, ~FEP, ~CIP, ~LVX, ~TCC, ~TZP, ~ATM, ~FOS, ~COL, ~PLB, "P. aeruginosa", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "P. aeruginosa", "R", "S", "S", "S", "R", "S", "S", "S", "R", "S", "S", "S", "S", "S", "S", "S", "S", @@ -161,7 +161,7 @@ test_that("mdro works", { ) expect_equal(as.integer(mdro(pseud)), c(1:4)) - acin <- tibble::tribble( + acin <- tribble( ~mo, ~GEN, ~TOB, ~AMK, ~NET, ~IPM, ~MEM, ~DOR, ~CIP, ~LVX, ~TZP, ~TCC, ~CTX, ~CRO, ~CAZ, ~FEP, ~SXT, ~SAM, ~COL, ~PLB, ~TCY, ~DOX, ~MNO, "A. baumannii", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A. baumannii", "R", "R", "R", "R", "S", "R", "S", "S", "S", "S", "S", "S", "S", "S", "R", "S", "S", "S", "S", "S", "S", "S",