Browse Source

(v1.2.0.9036) unit test fix

main
parent
commit
ab2b359e6b
  1. 2
      DESCRIPTION
  2. 2
      NEWS.md
  3. 9
      R/mo.R
  4. 2
      docs/404.html
  5. 2
      docs/LICENSE-text.html
  6. 2
      docs/articles/index.html
  7. 2
      docs/authors.html
  8. 2
      docs/index.html
  9. 8
      docs/news/index.html
  10. 2
      docs/pkgdown.yml
  11. 2
      docs/reference/index.html
  12. 2
      tests/testthat/test-mo_property.R
  13. 17
      tests/testthat/test-rsi.R

2
DESCRIPTION

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Package: AMR
Version: 1.2.0.9035
Version: 1.2.0.9036
Date: 2020-07-22
Title: Antimicrobial Resistance Analysis
Authors@R: c(

2
NEWS.md

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# AMR 1.2.0.9035
# AMR 1.2.0.9036
## <small>Last updated: 22 July 2020</small>
### New

9
R/mo.R

@ -178,7 +178,7 @@ as.mo <- function(x, @@ -178,7 +178,7 @@ as.mo <- function(x,
# start off with replaced language-specific non-ASCII characters with ASCII characters
x <- parse_and_convert(x)
# replace mo codes used in older package versions
x <- replace_old_mo_codes(x)
x <- replace_old_mo_codes(x, property = "mo")
# WHONET: xxx = no growth
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
@ -291,7 +291,7 @@ exec_as.mo <- function(x, @@ -291,7 +291,7 @@ exec_as.mo <- function(x,
# start off with replaced language-specific non-ASCII characters with ASCII characters
x <- parse_and_convert(x)
# replace mo codes used in older package versions
x <- replace_old_mo_codes(x)
x <- replace_old_mo_codes(x, property)
# WHONET: xxx = no growth
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
@ -1782,7 +1782,7 @@ parse_and_convert <- function(x) { @@ -1782,7 +1782,7 @@ parse_and_convert <- function(x) {
parsed
}
replace_old_mo_codes <- function(x) {
replace_old_mo_codes <- function(x, property) {
if (any(toupper(x) %in% microorganisms.translation$mo_old, na.rm = TRUE)) {
# get the ones that match
matched <- match(toupper(x), microorganisms.translation$mo_old)
@ -1790,6 +1790,9 @@ replace_old_mo_codes <- function(x) { @@ -1790,6 +1790,9 @@ replace_old_mo_codes <- function(x) {
mo_new <- microorganisms.translation$mo_new[matched]
# assign on places where a match was found
x[which(!is.na(matched))] <- mo_new[which(!is.na(matched))]
if (property != "mo") {
message(font_blue("NOTE: Old microbial codes (from previous package versions) were replaced with current codes used by this package.\n Please update your MO codes with as.mo()." ))
}
}
x
}

2
docs/404.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9035</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
</span>
</div>

2
docs/LICENSE-text.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9035</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
</span>
</div>

2
docs/articles/index.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9035</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
</span>
</div>

2
docs/authors.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9035</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
</span>
</div>

2
docs/index.html

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9035</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
</span>
</div>

8
docs/news/index.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9035</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
</span>
</div>
@ -229,9 +229,9 @@ @@ -229,9 +229,9 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1209035" class="section level1">
<h1 class="page-header" data-toc-text="1.2.0.9035">
<a href="#amr-1209035" class="anchor"></a>AMR 1.2.0.9035<small> Unreleased </small>
<div id="amr-1209036" class="section level1">
<h1 class="page-header" data-toc-text="1.2.0.9036">
<a href="#amr-1209036" class="anchor"></a>AMR 1.2.0.9036<small> Unreleased </small>
</h1>
<div id="last-updated-22-july-2020" class="section level2">
<h2 class="hasAnchor">

2
docs/pkgdown.yml

@ -10,7 +10,7 @@ articles: @@ -10,7 +10,7 @@ articles:
WHONET: WHONET.html
benchmarks: benchmarks.html
resistance_predict: resistance_predict.html
last_built: 2020-07-22T08:18Z
last_built: 2020-07-22T10:28Z
urls:
reference: https://msberends.github.io/AMR/reference
article: https://msberends.github.io/AMR/articles

2
docs/reference/index.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9035</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
</span>
</div>

2
tests/testthat/test-mo_property.R

@ -97,7 +97,7 @@ test_that("mo_property works", { @@ -97,7 +97,7 @@ test_that("mo_property works", {
expect_equal(mo_snomed("Escherichia coli"), 112283007)
# old codes must throw a warning in mo_* family
expect_warning(mo_name(c("B_ESCHR_COL", "B_STPHY_AUR")))
expect_message(mo_name(c("B_ESCHR_COL", "B_STPHY_AUR")))
# outcome of mo_fullname must always return the fullname from the data set
x <- data.frame(mo = microorganisms$mo,

17
tests/testthat/test-rsi.R

@ -37,16 +37,17 @@ test_that("rsi works", { @@ -37,16 +37,17 @@ test_that("rsi works", {
expect_equal(as.character(as.rsi(c(1:3))), c("S", "I", "R"))
expect_equal(suppressWarnings(as.logical(as.rsi("INVALID VALUE"))), NA)
expect_equal(summary(as.rsi(c("S", "R"))), c("Class" = "rsi",
"%R" = "50% (n=1)",
"%SI" = "50% (n=1)",
"- %S" = "50% (n=1)",
"- %I" = "0% (n=0)"))
expect_equal(summary(as.rsi(c("S", "R"))),
structure(c("Class" = "rsi",
"%R" = "50% (n=1)",
"%SI" = "50% (n=1)",
"- %S" = "50% (n=1)",
"- %I" = "0% (n=0)"), class = c("summaryDefault", "table")))
expect_identical(as.logical(lapply(example_isolates, is.rsi.eligible)),
rep(FALSE, length(example_isolates)))
library(dplyr)
# 40 rsi columns
expect_equal(example_isolates %>%

Loading…
Cancel
Save