mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 04:06:12 +01:00
(v1.2.0.9036) unit test fix
This commit is contained in:
parent
09fba38ea6
commit
ab2b359e6b
@ -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
2
NEWS.md
@ -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
9
R/mo.R
@ -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,
|
||||
# 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) {
|
||||
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) {
|
||||
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
|
||||
}
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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 @@
|
||||
<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">
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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,
|
||||
|
@ -38,11 +38,12 @@ test_that("rsi works", {
|
||||
|
||||
expect_equal(suppressWarnings(as.logical(as.rsi("INVALID VALUE"))), NA)
|
||||
|
||||
expect_equal(summary(as.rsi(c("S", "R"))), c("Class" = "rsi",
|
||||
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)"))
|
||||
"- %I" = "0% (n=0)"), class = c("summaryDefault", "table")))
|
||||
|
||||
expect_identical(as.logical(lapply(example_isolates, is.rsi.eligible)),
|
||||
rep(FALSE, length(example_isolates)))
|
||||
|
Loading…
Reference in New Issue
Block a user