mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 06:06:12 +01:00
(v1.7.1.9027) fix unit test
This commit is contained in:
parent
2ab21b7af3
commit
41f35c73cd
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.7.1.9026
|
Version: 1.7.1.9027
|
||||||
Date: 2021-08-19
|
Date: 2021-08-19
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# `AMR` 1.7.1.9026
|
# `AMR` 1.7.1.9027
|
||||||
## <small>Last updated: 19 August 2021</small>
|
## <small>Last updated: 19 August 2021</small>
|
||||||
|
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
|
Binary file not shown.
@ -24,7 +24,7 @@
|
|||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
# some old R instances have trouble installing tinytest, so we ship it too
|
# some old R instances have trouble installing tinytest, so we ship it too
|
||||||
install.packages("data-raw/tinytest_1.2.4.10.tar.gz")
|
install.packages("data-raw/tinytest_1.2.4.10.tar.gz", dependencies = c("Depends", "Imports"))
|
||||||
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
|
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
|
||||||
|
|
||||||
pkg_suggests <- gsub("[^a-zA-Z0-9]+", "",
|
pkg_suggests <- gsub("[^a-zA-Z0-9]+", "",
|
||||||
@ -39,7 +39,7 @@ if (length(to_install) == 0) {
|
|||||||
}
|
}
|
||||||
for (i in seq_len(length(to_install))) {
|
for (i in seq_len(length(to_install))) {
|
||||||
cat("Installing package", to_install[i], "\n")
|
cat("Installing package", to_install[i], "\n")
|
||||||
tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = TRUE, quiet = FALSE),
|
tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = c("Depends", "Imports"), quiet = FALSE),
|
||||||
# message = function(m) invisible(),
|
# message = function(m) invisible(),
|
||||||
warning = function(w) message(w$message),
|
warning = function(w) message(w$message),
|
||||||
error = function(e) message(e$message))
|
error = function(e) message(e$message))
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<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.7.1.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<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.7.1.9026</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9027</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -240,9 +240,9 @@
|
|||||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-1719026" class="section level1">
|
<div id="amr-1719027" class="section level1">
|
||||||
<h1 class="page-header" data-toc-text="1.7.1.9026">
|
<h1 class="page-header" data-toc-text="1.7.1.9027">
|
||||||
<a href="#amr-1719026" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9026</h1>
|
<a href="#amr-1719027" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9027</h1>
|
||||||
<div id="last-updated-19-august-2021" class="section level2">
|
<div id="last-updated-19-august-2021" class="section level2">
|
||||||
<h2 class="hasAnchor">
|
<h2 class="hasAnchor">
|
||||||
<a href="#last-updated-19-august-2021" class="anchor" aria-hidden="true"></a><small>Last updated: 19 August 2021</small>
|
<a href="#last-updated-19-august-2021" class="anchor" aria-hidden="true"></a><small>Last updated: 19 August 2021</small>
|
||||||
|
@ -24,38 +24,38 @@
|
|||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
# antibiotic class selectors
|
# antibiotic class selectors
|
||||||
expect_true(ncol(example_isolates[, ab_class("antimyco"), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, ab_class("antimyco"), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, aminoglycosides(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, aminoglycosides(), drop = FALSE]), 4, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, aminopenicillins(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, aminopenicillins(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, betalactams(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, betalactams(), drop = FALSE]), 16, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, carbapenems(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, carbapenems(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, cephalosporins(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, cephalosporins(), drop = FALSE]), 7, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, cephalosporins_1st(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, cephalosporins_1st(), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, cephalosporins_2nd(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, cephalosporins_2nd(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, cephalosporins_3rd(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, cephalosporins_3rd(), drop = FALSE]), 3, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, cephalosporins_4th(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, cephalosporins_4th(), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, cephalosporins_5th(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, cephalosporins_5th(), drop = FALSE]), 0, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, fluoroquinolones(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, fluoroquinolones(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, glycopeptides(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, glycopeptides(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, lincosamides(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, lincosamides(), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, lipoglycopeptides(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, lipoglycopeptides(), drop = FALSE]), 0, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, macrolides(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, macrolides(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, oxazolidinones(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, oxazolidinones(), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, penicillins(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, penicillins(), drop = FALSE]), 7, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, polymyxins(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, polymyxins(), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, streptogramins(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, streptogramins(), drop = FALSE]), 0, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, quinolones(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, quinolones(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, tetracyclines(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, tetracyclines(), drop = FALSE]), 3, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, trimethoprims(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, trimethoprims(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_true(ncol(example_isolates[, ureidopenicillins(), drop = FALSE]) < ncol(example_isolates))
|
expect_equal(ncol(example_isolates[, ureidopenicillins(), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
|
|
||||||
# Examples:
|
# Examples:
|
||||||
|
|
||||||
# select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
|
# select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
|
||||||
expect_equal(ncol(example_isolates[, c("mo", aminoglycosides())]), 5, tolerance = 0.5)
|
expect_equal(ncol(example_isolates[, c("mo", aminoglycosides())]), 5, tolerance = 0.5)
|
||||||
|
|
||||||
expect_equal(ncol(example_isolates[, c(administerable_per_os() & penicillins())]), 5, tolerance = 0.5)
|
expect_equal(ncol(example_isolates[, c(administrable_per_os() & penicillins())]), 5, tolerance = 0.5)
|
||||||
expect_equal(ncol(example_isolates[, c(administerable_iv() & penicillins())]), 7, tolerance = 0.5)
|
expect_equal(ncol(example_isolates[, c(administrable_iv() & penicillins())]), 7, tolerance = 0.5)
|
||||||
|
|
||||||
# filter using any() or all()
|
# filter using any() or all()
|
||||||
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), ]), 55, tolerance = 0.5)
|
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), ]), 55, tolerance = 0.5)
|
||||||
|
Loading…
Reference in New Issue
Block a user