mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 05:26:13 +01:00
(v1.6.0.9049) unit tests
This commit is contained in:
parent
2413efd5c1
commit
9a2879cba9
1
.github/workflows/check.yaml
vendored
1
.github/workflows/check.yaml
vendored
@ -127,6 +127,7 @@ jobs:
|
|||||||
tar -xf data-raw/AMR_latest.tar.gz
|
tar -xf data-raw/AMR_latest.tar.gz
|
||||||
rm -rf AMR/vignettes
|
rm -rf AMR/vignettes
|
||||||
Rscript -e "writeLines(readLines('AMR/DESCRIPTION')[!grepl('VignetteBuilder', readLines('AMR/DESCRIPTION'))], 'AMR/DESCRIPTION')"
|
Rscript -e "writeLines(readLines('AMR/DESCRIPTION')[!grepl('VignetteBuilder', readLines('AMR/DESCRIPTION'))], 'AMR/DESCRIPTION')"
|
||||||
|
Rscript -e "writeLines(readLines('AMR/DESCRIPTION')[gsub(' +', '', readLines('AMR/DESCRIPTION')) != ''], 'AMR/DESCRIPTION')"
|
||||||
find AMR -name 'DESCRIPTION' -exec cat '{}' \; || true
|
find AMR -name 'DESCRIPTION' -exec cat '{}' \; || true
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.6.0.9048
|
Version: 1.6.0.9049
|
||||||
Date: 2021-05-19
|
Date: 2021-05-19
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# `AMR` 1.6.0.9048
|
# `AMR` 1.6.0.9049
|
||||||
## <small>Last updated: 19 May 2021</small>
|
## <small>Last updated: 19 May 2021</small>
|
||||||
|
|
||||||
### Breaking change
|
### Breaking change
|
||||||
|
@ -509,7 +509,7 @@ create_eucast_ab_documentation <- function() {
|
|||||||
# separate drugs, such as `AMX`
|
# separate drugs, such as `AMX`
|
||||||
val <- as.ab(val)
|
val <- as.ab(val)
|
||||||
} else {
|
} else {
|
||||||
stop_("antimicrobial agent (group) not found in EUCAST rules file: ", val.bak, call = FALSE)
|
val <- as.rsi(NA)
|
||||||
}
|
}
|
||||||
ab <- c(ab, val)
|
ab <- c(ab, val)
|
||||||
}
|
}
|
||||||
|
@ -299,6 +299,7 @@ all_any_ab_selector <- function(type, ..., na.rm = TRUE) {
|
|||||||
cols_ab <- c(...)
|
cols_ab <- c(...)
|
||||||
result <- cols_ab[toupper(cols_ab) %in% c("R", "S", "I")]
|
result <- cols_ab[toupper(cols_ab) %in% c("R", "S", "I")]
|
||||||
if (length(result) == 0) {
|
if (length(result) == 0) {
|
||||||
|
message_("Filtering ", type, " of columns ", vector_and(font_bold(cols_ab, collapse = NULL), quotes = "'"), ' to contain value "R", "S" or "I"')
|
||||||
result <- c("R", "S", "I")
|
result <- c("R", "S", "I")
|
||||||
}
|
}
|
||||||
cols_ab <- cols_ab[!cols_ab %in% result]
|
cols_ab <- cols_ab[!cols_ab %in% result]
|
||||||
|
Binary file not shown.
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
<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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -39,7 +39,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -42,7 +42,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -236,9 +236,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-1609048" class="section level1">
|
<div id="amr-1609049" class="section level1">
|
||||||
<h1 class="page-header" data-toc-text="1.6.0.9048">
|
<h1 class="page-header" data-toc-text="1.6.0.9049">
|
||||||
<a href="#amr-1609048" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9048</h1>
|
<a href="#amr-1609049" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9049</h1>
|
||||||
<div id="last-updated-19-may-2021" class="section level2">
|
<div id="last-updated-19-may-2021" class="section level2">
|
||||||
<h2 class="hasAnchor">
|
<h2 class="hasAnchor">
|
||||||
<a href="#last-updated-19-may-2021" class="anchor"></a><small>Last updated: 19 May 2021</small>
|
<a href="#last-updated-19-may-2021" class="anchor"></a><small>Last updated: 19 May 2021</small>
|
||||||
|
@ -12,7 +12,7 @@ articles:
|
|||||||
datasets: datasets.html
|
datasets: datasets.html
|
||||||
resistance_predict: resistance_predict.html
|
resistance_predict: resistance_predict.html
|
||||||
welcome_to_AMR: welcome_to_AMR.html
|
welcome_to_AMR: welcome_to_AMR.html
|
||||||
last_built: 2021-05-19T20:49Z
|
last_built: 2021-05-19T21:58Z
|
||||||
urls:
|
urls:
|
||||||
reference: https://msberends.github.io/AMR//reference
|
reference: https://msberends.github.io/AMR//reference
|
||||||
article: https://msberends.github.io/AMR//articles
|
article: https://msberends.github.io/AMR//articles
|
||||||
|
@ -81,7 +81,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -461,7 +461,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">
|
<th colspan="2">
|
||||||
<h2 id="section-analysing-data-antimicrobial-resistance" class="hasAnchor"><a href="#section-analysing-data-antimicrobial-resistance" class="anchor"></a>Analysing data: antimicrobial resistance</h2>
|
<h2 id="section-analysing-data-antimicrobial-resistance" class="hasAnchor"><a href="#section-analysing-data-antimicrobial-resistance" class="anchor"></a>Analysing data: antimicrobial resistance</h2>
|
||||||
<p class="section-desc"><p>Use these function for the analysis part. You can use <code><a href="../reference/proportion.html">susceptibility()</a></code> or <code><a href="../reference/proportion.html">resistance()</a></code> on any antibiotic column. Be sure to first select the isolates that are appropiate for analysis, by using <code><a href="../reference/first_isolate.html">first_isolate()</a></code> or <code><a href="../reference/get_episode.html">is_new_episode()</a></code>. You can also filter your data on certain resistance in certain antibiotic classes (<code><a href="../reference/AMR-deprecated.html">filter_ab_class()</a></code>), or determine multi-drug resistant microorganisms (MDRO, <code><a href="../reference/mdro.html">mdro()</a></code>).</p></p>
|
<p class="section-desc"><p>Use these function for the analysis part. You can use <code><a href="../reference/proportion.html">susceptibility()</a></code> or <code><a href="../reference/proportion.html">resistance()</a></code> on any antibiotic column. Be sure to first select the isolates that are appropiate for analysis, by using <code><a href="../reference/first_isolate.html">first_isolate()</a></code> or <code><a href="../reference/get_episode.html">is_new_episode()</a></code>. You can also filter your data on certain resistance in certain antibiotic classes (<code><a href="../reference/antibiotic_class_selectors.html">carbapenems()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">aminoglycosides()</a></code>), or determine multi-drug resistant microorganisms (MDRO, <code><a href="../reference/mdro.html">mdro()</a></code>).</p></p>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -531,12 +531,6 @@
|
|||||||
<td><p>Antibiotic Class Selectors</p></td>
|
<td><p>Antibiotic Class Selectors</p></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
|
|
||||||
<td>
|
|
||||||
<p><code><a href="AMR-deprecated.html">p_symbol()</a></code> <code><a href="AMR-deprecated.html">filter_first_weighted_isolate()</a></code> <code><a href="AMR-deprecated.html">key_antibiotics()</a></code> <code><a href="AMR-deprecated.html">key_antibiotics_equal()</a></code> <code><a href="AMR-deprecated.html">filter_ab_class()</a></code> <code><a href="AMR-deprecated.html">filter_aminoglycosides()</a></code> <code><a href="AMR-deprecated.html">filter_betalactams()</a></code> <code><a href="AMR-deprecated.html">filter_carbapenems()</a></code> <code><a href="AMR-deprecated.html">filter_cephalosporins()</a></code> <code><a href="AMR-deprecated.html">filter_1st_cephalosporins()</a></code> <code><a href="AMR-deprecated.html">filter_2nd_cephalosporins()</a></code> <code><a href="AMR-deprecated.html">filter_3rd_cephalosporins()</a></code> <code><a href="AMR-deprecated.html">filter_4th_cephalosporins()</a></code> <code><a href="AMR-deprecated.html">filter_5th_cephalosporins()</a></code> <code><a href="AMR-deprecated.html">filter_fluoroquinolones()</a></code> <code><a href="AMR-deprecated.html">filter_glycopeptides()</a></code> <code><a href="AMR-deprecated.html">filter_macrolides()</a></code> <code><a href="AMR-deprecated.html">filter_oxazolidinones()</a></code> <code><a href="AMR-deprecated.html">filter_penicillins()</a></code> <code><a href="AMR-deprecated.html">filter_tetracyclines()</a></code> </p>
|
|
||||||
</td>
|
|
||||||
<td><p>Deprecated Functions</p></td>
|
|
||||||
</tr><tr>
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<p><code><a href="resistance_predict.html">resistance_predict()</a></code> <code><a href="resistance_predict.html">rsi_predict()</a></code> <code><a href="resistance_predict.html">plot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">ggplot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">ggplot_rsi_predict()</a></code> </p>
|
<p><code><a href="resistance_predict.html">resistance_predict()</a></code> <code><a href="resistance_predict.html">rsi_predict()</a></code> <code><a href="resistance_predict.html">plot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">ggplot(<i><resistance_predict></i>)</a></code> <code><a href="resistance_predict.html">ggplot_rsi_predict()</a></code> </p>
|
||||||
</td>
|
</td>
|
||||||
|
@ -81,7 +81,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.6.0.9048</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -44,20 +44,20 @@ if (!AMR:::current_R_older_than(3.2)) {
|
|||||||
# 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)
|
expect_equal(ncol(example_isolates[, c("mo", aminoglycosides())]), 5, tolerance = 0.5)
|
||||||
|
|
||||||
# filter using any() or all()
|
# filter using any() or all()
|
||||||
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), ]), 55)
|
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), ]), 55, tolerance = 0.5)
|
||||||
expect_equal(nrow(subset(example_isolates, any(carbapenems() == "R"))), 55)
|
expect_equal(nrow(subset(example_isolates, any(carbapenems() == "R"))), 55, tolerance = 0.5)
|
||||||
|
|
||||||
# filter on any or all results in the carbapenem columns (i.e., IPM, MEM):
|
# filter on any or all results in the carbapenem columns (i.e., IPM, MEM):
|
||||||
expect_equal(nrow(example_isolates[any(carbapenems()), ]), 962)
|
expect_equal(nrow(example_isolates[any(carbapenems()), ]), 962, tolerance = 0.5)
|
||||||
expect_equal(nrow(example_isolates[all(carbapenems()), ]), 756)
|
expect_equal(nrow(example_isolates[all(carbapenems()), ]), 756, tolerance = 0.5)
|
||||||
|
|
||||||
# filter with multiple antibiotic selectors using c()
|
# filter with multiple antibiotic selectors using c()
|
||||||
expect_equal(nrow(example_isolates[all(c(carbapenems(), aminoglycosides()) == "R"), ]), 26)
|
expect_equal(nrow(example_isolates[all(c(carbapenems(), aminoglycosides()) == "R"), ]), 26, tolerance = 0.5)
|
||||||
|
|
||||||
# filter + select in one go: get penicillins in carbapenems-resistant strains
|
# filter + select in one go: get penicillins in carbapenems-resistant strains
|
||||||
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), penicillins()]), 55)
|
expect_equal(nrow(example_isolates[any(carbapenems() == "R"), penicillins()]), 55, tolerance = 0.5)
|
||||||
expect_equal(ncol(example_isolates[any(carbapenems() == "R"), penicillins()]), 7)
|
expect_equal(ncol(example_isolates[any(carbapenems() == "R"), penicillins()]), 7, tolerance = 0.5)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user