1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:46:11 +01:00

(v1.7.0) unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-05-26 14:04:12 +02:00
parent 41d279daa1
commit f1d9b489c5
26 changed files with 333 additions and 351 deletions

View File

@ -91,5 +91,3 @@ jobs:
library(tinytest)
covr::codecov(line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"))
shell: Rscript {0}

View File

@ -2,8 +2,6 @@
# `AMR` (for R)
[![CRAN](https://www.r-pkg.org/badges/version-ago/AMR)](https://cran.r-project.org/package=AMR)
[![CRANlogs](https://cranlogs.r-pkg.org/badges/grand-total/AMR)](https://cran.r-project.org/package=AMR)
![R-code-check](https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master)
[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
[![Codecov](https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=master)
@ -25,7 +23,7 @@ This is the development source of the `AMR` package for R. Not a developer? Then
### How to get this package
Please see [our website](https://msberends.github.io/AMR/#get-this-package).
Bottom line: `install.packages("AMR")`
Bottom line: `install.packages("AMR", repos = "https://msberends.r-universe.dev")`
### Copyright

Binary file not shown.

View File

@ -26,6 +26,7 @@
# 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/AMR_latest.tar.gz", dependencies = FALSE)
install.packages("covr")
pkg_suggests <- gsub("[^a-zA-Z0-9]+", "", unlist(strsplit(packageDescription("AMR", fields = "Suggests"), ", ?")))
cat("Packages listed in Suggests:", paste(pkg_suggests, collapse = ", "), "\n")

View File

@ -344,30 +344,52 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2013-01-28</td>
<td align="center">G4</td>
<td align="center">2013-04-02</td>
<td align="center">X1</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2015-07-17</td>
<td align="center">X6</td>
<td align="center">Hospital A</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2012-09-03</td>
<td align="center">C4</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2010-02-11</td>
<td align="center">D2</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2014-08-13</td>
<td align="center">O10</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2011-10-06</td>
<td align="center">N1</td>
<td align="center">2012-12-14</td>
<td align="center">L5</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
@ -377,36 +399,14 @@
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2016-08-07</td>
<td align="center">J6</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2010-06-21</td>
<td align="center">Q4</td>
<td align="center">2016-01-30</td>
<td align="center">S3</td>
<td align="center">Hospital D</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2016-04-25</td>
<td align="center">R4</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
</tbody>
@ -441,16 +441,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,403</td>
<td align="right">52.02%</td>
<td align="right">10,403</td>
<td align="right">52.02%</td>
<td align="right">10,375</td>
<td align="right">51.88%</td>
<td align="right">10,375</td>
<td align="right">51.88%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,597</td>
<td align="right">47.99%</td>
<td align="right">9,625</td>
<td align="right">48.13%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -505,9 +505,9 @@ Longest: 1</p>
<span class="co"># Using column 'patient_id' as input for `col_patient_id`.</span>
<span class="co"># Basing inclusion on all antimicrobial results, using a points threshold of</span>
<span class="co"># 2</span>
<span class="co"># =&gt; Found 10,682 first weighted isolates (phenotype-based, 53.4% of total</span>
<span class="co"># =&gt; Found 10,550 first weighted isolates (phenotype-based, 52.8% of total</span>
<span class="co"># where a microbial ID was available)</span></code></pre></div>
<p>So only 53.4% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<p>So only 52.8% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="va">first</span> <span class="op">==</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
@ -515,7 +515,7 @@ Longest: 1</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
<p>So we end up with 10,682 isolates for analysis. Now our data looks like:</p>
<p>So we end up with 10,550 isolates for analysis. Now our data looks like:</p>
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">data_1st</span><span class="op">)</span></code></pre></div>
<table class="table">
@ -531,7 +531,7 @@ Longest: 1</p>
<col width="3%">
<col width="6%">
<col width="11%">
<col width="11%">
<col width="12%">
<col width="9%">
<col width="5%">
</colgroup>
@ -553,93 +553,93 @@ Longest: 1</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="left">4</td>
<td align="center">2016-08-07</td>
<td align="center">J6</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="left">1</td>
<td align="center">2013-04-02</td>
<td align="center">X1</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="center">2015-07-17</td>
<td align="center">X6</td>
<td align="center">Hospital A</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">4</td>
<td align="center">2010-02-11</td>
<td align="center">D2</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">6</td>
<td align="center">2016-04-25</td>
<td align="center">R4</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">10</td>
<td align="center">2016-01-17</td>
<td align="center">R3</td>
<td align="center">2016-01-30</td>
<td align="center">S3</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">11</td>
<td align="center">2013-01-18</td>
<td align="center">S1</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">16</td>
<td align="center">2017-07-05</td>
<td align="center">X9</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">19</td>
<td align="center">2013-10-30</td>
<td align="center">D4</td>
<tr class="odd">
<td align="left">7</td>
<td align="center">2012-10-20</td>
<td align="center">D10</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">8</td>
<td align="center">2016-03-28</td>
<td align="center">K7</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
@ -669,8 +669,8 @@ Longest: 1</p>
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">genus</span>, <span class="va">species</span><span class="op">)</span></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 10,682<br>
Available: 10,682 (100.0%, NA: 0 = 0.0%)<br>
Length: 10,550<br>
Available: 10,550 (100.0%, NA: 0 = 0.0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -687,33 +687,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">4,559</td>
<td align="right">42.68%</td>
<td align="right">4,559</td>
<td align="right">42.68%</td>
<td align="right">4,566</td>
<td align="right">43.28%</td>
<td align="right">4,566</td>
<td align="right">43.28%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">2,844</td>
<td align="right">26.62%</td>
<td align="right">7,403</td>
<td align="right">69.30%</td>
<td align="right">2,786</td>
<td align="right">26.41%</td>
<td align="right">7,352</td>
<td align="right">69.69%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,082</td>
<td align="right">19.49%</td>
<td align="right">9,485</td>
<td align="right">88.79%</td>
<td align="right">2,025</td>
<td align="right">19.19%</td>
<td align="right">9,377</td>
<td align="right">88.88%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,197</td>
<td align="right">11.21%</td>
<td align="right">10,682</td>
<td align="right">1,173</td>
<td align="right">11.12%</td>
<td align="right">10,550</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -760,8 +760,23 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-08-07</td>
<td align="center">J6</td>
<td align="center">2016-03-28</td>
<td align="center">K7</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2010-01-30</td>
<td align="center">A1</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
@ -774,58 +789,13 @@ Longest: 24</p>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2016-01-17</td>
<td align="center">R3</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2017-07-05</td>
<td align="center">X9</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2013-10-30</td>
<td align="center">D4</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2012-02-20</td>
<td align="center">2012-12-10</td>
<td align="center">M7</td>
<td align="center">Hospital B</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
@ -835,13 +805,43 @@ Longest: 24</p>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2010-02-18</td>
<td align="center">F5</td>
<td align="center">Hospital C</td>
<td align="center">2012-08-04</td>
<td align="center">Y7</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2016-08-05</td>
<td align="center">I4</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2011-05-15</td>
<td align="center">H2</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
@ -870,50 +870,50 @@ Longest: 24</p>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">AMX</td>
<td align="center">2129</td>
<td align="center">151</td>
<td align="center">2279</td>
<td align="center">4559</td>
<td align="center">2148</td>
<td align="center">153</td>
<td align="center">2265</td>
<td align="center">4566</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">AMC</td>
<td align="center">3355</td>
<td align="center">151</td>
<td align="center">1053</td>
<td align="center">4559</td>
<td align="center">3344</td>
<td align="center">157</td>
<td align="center">1065</td>
<td align="center">4566</td>
</tr>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">CIP</td>
<td align="center">3320</td>
<td align="center">3356</td>
<td align="center">0</td>
<td align="center">1239</td>
<td align="center">4559</td>
<td align="center">1210</td>
<td align="center">4566</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">3995</td>
<td align="center">3983</td>
<td align="center">0</td>
<td align="center">564</td>
<td align="center">4559</td>
<td align="center">583</td>
<td align="center">4566</td>
</tr>
<tr class="odd">
<td align="center">K. pneumoniae</td>
<td align="center">AMX</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">1197</td>
<td align="center">1197</td>
<td align="center">1173</td>
<td align="center">1173</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">AMC</td>
<td align="center">949</td>
<td align="center">46</td>
<td align="center">202</td>
<td align="center">1197</td>
<td align="center">930</td>
<td align="center">43</td>
<td align="center">200</td>
<td align="center">1173</td>
</tr>
</tbody>
</table>
@ -936,34 +936,34 @@ Longest: 24</p>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">3995</td>
<td align="center">3983</td>
<td align="center">0</td>
<td align="center">564</td>
<td align="center">4559</td>
<td align="center">583</td>
<td align="center">4566</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">GEN</td>
<td align="center">1077</td>
<td align="center">1063</td>
<td align="center">0</td>
<td align="center">120</td>
<td align="center">1197</td>
<td align="center">110</td>
<td align="center">1173</td>
</tr>
<tr class="odd">
<td align="center">S. aureus</td>
<td align="center">GEN</td>
<td align="center">2523</td>
<td align="center">2490</td>
<td align="center">0</td>
<td align="center">321</td>
<td align="center">2844</td>
<td align="center">296</td>
<td align="center">2786</td>
</tr>
<tr class="even">
<td align="center">S. pneumoniae</td>
<td align="center">GEN</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">2082</td>
<td align="center">2082</td>
<td align="center">2025</td>
<td align="center">2025</td>
</tr>
</tbody>
</table>
@ -977,7 +977,7 @@ Longest: 24</p>
<p>As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to <code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to <code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span><span class="op">(</span><span class="va">AMX</span><span class="op">)</span>
<span class="co"># [1] 0.5449354</span></code></pre></div>
<span class="co"># [1] 0.5443602</span></code></pre></div>
<p>Or can be used in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span>
@ -991,19 +991,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5437286</td>
<td align="center">0.5542598</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5478284</td>
<td align="center">0.5400160</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5407268</td>
<td align="center">0.5508217</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5448113</td>
<td align="center">0.5322972</td>
</tr>
</tbody>
</table>
@ -1022,23 +1022,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5437286</td>
<td align="center">3213</td>
<td align="center">0.5542598</td>
<td align="center">3087</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5478284</td>
<td align="center">3753</td>
<td align="center">0.5400160</td>
<td align="center">3761</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5407268</td>
<td align="center">1596</td>
<td align="center">0.5508217</td>
<td align="center">1643</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5448113</td>
<td align="center">2120</td>
<td align="center">0.5322972</td>
<td align="center">2059</td>
</tr>
</tbody>
</table>
@ -1059,27 +1059,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.7690283</td>
<td align="center">0.8762887</td>
<td align="center">0.9782847</td>
<td align="center">0.7667543</td>
<td align="center">0.8723171</td>
<td align="center">0.9770039</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8312448</td>
<td align="center">0.8997494</td>
<td align="center">0.9874687</td>
<td align="center">0.8294970</td>
<td align="center">0.9062234</td>
<td align="center">0.9795396</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.7960619</td>
<td align="center">0.8871308</td>
<td align="center">0.9820675</td>
<td align="center">0.7910983</td>
<td align="center">0.8937545</td>
<td align="center">0.9852836</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5249760</td>
<td align="center">0.5387654</td>
<td align="center">0.0000000</td>
<td align="center">0.5249760</td>
<td align="center">0.5387654</td>
</tr>
</tbody>
</table>
@ -1163,19 +1163,16 @@ Longest: 24</p>
<code class="sourceCode R"><span class="va">mic_values</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/random.html">random_mic</a></span><span class="op">(</span>size <span class="op">=</span> <span class="fl">100</span><span class="op">)</span>
<span class="va">mic_values</span>
<span class="co"># Class &lt;mic&gt;</span>
<span class="co"># [1] 4 &lt;=0.0625 64 0.5 0.5 0.125 128 128 </span>
<span class="co"># [9] 0.5 &lt;=0.0625 4 32 256 0.25 64 8 </span>
<span class="co"># [17] 32 64 4 2 1 4 16 128 </span>
<span class="co"># [25] 128 32 &lt;=0.0625 32 2 4 16 0.125 </span>
<span class="co"># [33] 0.25 0.5 32 128 64 128 0.125 256 </span>
<span class="co"># [41] 1 &lt;=0.0625 64 1 0.25 0.5 &lt;=0.0625 64 </span>
<span class="co"># [49] 8 1 4 2 32 &lt;=0.0625 &lt;=0.0625 4 </span>
<span class="co"># [57] 128 4 32 128 128 32 0.25 64 </span>
<span class="co"># [65] 16 0.5 4 0.5 0.25 4 &lt;=0.0625 2 </span>
<span class="co"># [73] 0.125 0.5 256 &lt;=0.0625 0.5 1 256 0.25 </span>
<span class="co"># [81] 64 64 8 256 16 256 64 16 </span>
<span class="co"># [89] 128 0.125 8 &lt;=0.0625 4 16 128 128 </span>
<span class="co"># [97] 16 128 0.5 1</span></code></pre></div>
<span class="co"># [1] 2 2 16 4 0.125 0.5 64 16 128 32 </span>
<span class="co"># [11] 4 32 1 0.125 128 2 8 64 64 2 </span>
<span class="co"># [21] 8 0.125 0.25 1 16 64 0.25 0.5 0.25 4 </span>
<span class="co"># [31] 16 32 0.25 1 0.5 8 64 2 0.25 0.0625</span>
<span class="co"># [41] 128 1 2 2 0.0625 0.125 64 8 8 8 </span>
<span class="co"># [51] 4 8 0.125 1 128 1 128 2 2 0.5 </span>
<span class="co"># [61] 32 64 16 32 32 16 4 1 16 2 </span>
<span class="co"># [71] 1 0.125 2 4 0.125 32 2 0.125 8 0.25 </span>
<span class="co"># [81] 0.0625 4 0.5 16 128 8 128 0.125 0.0625 1 </span>
<span class="co"># [91] 1 0.25 0.0625 128 128 8 0.0625 32 128 0.25</span></code></pre></div>
<div class="sourceCode" id="cb36"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># base R:</span>
<span class="fu"><a href="../reference/plot.html">plot</a></span><span class="op">(</span><span class="va">mic_values</span><span class="op">)</span></code></pre></div>
@ -1204,10 +1201,10 @@ Longest: 24</p>
<span class="co"># to review it.</span>
<span class="va">disk_values</span>
<span class="co"># Class &lt;disk&gt;</span>
<span class="co"># [1] 22 19 28 26 29 31 30 27 29 17 20 21 19 28 28 24 30 31 17 26 19 30 31 29 24</span>
<span class="co"># [26] 18 22 25 26 25 26 21 25 25 21 29 29 22 30 25 30 28 29 29 21 20 22 18 20 25</span>
<span class="co"># [51] 25 21 27 31 26 17 23 28 21 22 24 25 30 18 26 24 22 22 18 31 20 21 25 22 26</span>
<span class="co"># [76] 31 30 23 18 31 20 24 21 28 31 18 24 27 28 30 28 29 29 22 28 30 30 25 24 31</span></code></pre></div>
<span class="co"># [1] 31 27 25 19 19 17 23 24 30 28 22 26 18 29 25 24 22 30 17 20 23 24 26 24 27</span>
<span class="co"># [26] 22 27 22 17 26 22 31 27 31 31 25 21 18 26 22 21 25 21 26 22 21 20 20 24 19</span>
<span class="co"># [51] 25 17 29 26 28 30 30 29 30 28 19 28 22 21 26 25 24 23 21 18 27 20 17 29 30</span>
<span class="co"># [76] 17 25 19 30 22 26 22 31 18 19 26 20 18 23 17 30 30 22 21 25 21 17 30 30 24</span></code></pre></div>
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># base R:</span>
<span class="fu"><a href="../reference/plot.html">plot</a></span><span class="op">(</span><span class="va">disk_values</span>, mo <span class="op">=</span> <span class="st">"E. coli"</span>, ab <span class="op">=</span> <span class="st">"cipro"</span><span class="op">)</span></code></pre></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -339,17 +339,17 @@ Unique: 2</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">)</span>
<span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span>
<span class="co"># 1 R I I I S R</span>
<span class="co"># 2 R R S R S S</span>
<span class="co"># 3 I R S S S R</span>
<span class="co"># 4 I I I R S I</span>
<span class="co"># 5 I R R I R S</span>
<span class="co"># 6 R R R R I S</span>
<span class="co"># 1 I I I I S S</span>
<span class="co"># 2 R I S I I I</span>
<span class="co"># 3 S R R R R I</span>
<span class="co"># 4 S R S S R S</span>
<span class="co"># 5 R S I R S R</span>
<span class="co"># 6 R R R R I I</span>
<span class="co"># kanamycin</span>
<span class="co"># 1 S</span>
<span class="co"># 1 I</span>
<span class="co"># 2 I</span>
<span class="co"># 3 R</span>
<span class="co"># 4 S</span>
<span class="co"># 3 S</span>
<span class="co"># 4 R</span>
<span class="co"># 5 I</span>
<span class="co"># 6 I</span></code></pre></div>
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
@ -367,7 +367,7 @@ Unique: 2</p>
<p>Class: factor &gt; ordered (numeric)<br>
Length: 5,000<br>
Levels: 5: Negative &lt; Mono-resistant &lt; Poly-resistant &lt; Multi-drug-resistant &lt;<br>
Available: 5,000 (100%, NA: 0 = 0%)<br>
Available: 5,000 (100.0%, NA: 0 = 0.0%)<br>
Unique: 5</p>
<table class="table">
<thead><tr class="header">
@ -382,40 +382,40 @@ Unique: 5</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Mono-resistant</td>
<td align="right">3200</td>
<td align="right">64.00%</td>
<td align="right">3200</td>
<td align="right">64.00%</td>
<td align="right">3271</td>
<td align="right">65.42%</td>
<td align="right">3271</td>
<td align="right">65.42%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Negative</td>
<td align="right">1014</td>
<td align="right">20.28%</td>
<td align="right">4214</td>
<td align="right">84.28%</td>
<td align="right">949</td>
<td align="right">18.98%</td>
<td align="right">4220</td>
<td align="right">84.40%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Multi-drug-resistant</td>
<td align="right">455</td>
<td align="right">9.10%</td>
<td align="right">449</td>
<td align="right">8.98%</td>
<td align="right">4669</td>
<td align="right">93.38%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Poly-resistant</td>
<td align="right">252</td>
<td align="right">5.04%</td>
<td align="right">4921</td>
<td align="right">98.42%</td>
<td align="right">240</td>
<td align="right">4.80%</td>
<td align="right">4909</td>
<td align="right">98.18%</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="left">Extensively drug-resistant</td>
<td align="right">79</td>
<td align="right">1.58%</td>
<td align="right">91</td>
<td align="right">1.82%</td>
<td align="right">5000</td>
<td align="right">100.00%</td>
</tr>

View File

@ -193,7 +193,7 @@
<h1 data-toc-skip>How to import data from SPSS / SAS / Stata</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">24 May 2021</h4>
<h4 class="date">26 May 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/SPSS.Rmd"><code>vignettes/SPSS.Rmd</code></a></small>
<div class="hidden name"><code>SPSS.Rmd</code></div>

View File

@ -240,7 +240,7 @@
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 500<br>
Available: 500 (100%, NA: 0 = 0%)<br>
Available: 500 (100.0%, NA: 0 = 0.0%)<br>
Unique: 37</p>
<p>Shortest: 11<br>
Longest: 40</p>

View File

@ -226,32 +226,19 @@
times <span class="op">=</span> <span class="fl">25</span><span class="op">)</span>
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">S.aureus</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">2</span><span class="op">)</span>
<span class="co"># Unit: milliseconds</span>
<span class="co"># expr min lq mean median uq max</span>
<span class="co"># as.mo("sau") 10.0 11.0 14.0 12.0 13.0 47.0</span>
<span class="co"># as.mo("stau") 53.0 56.0 78.0 58.0 94.0 220.0</span>
<span class="co"># as.mo("STAU") 53.0 54.0 69.0 58.0 92.0 99.0</span>
<span class="co"># as.mo("staaur") 10.0 11.0 15.0 11.0 12.0 47.0</span>
<span class="co"># as.mo("STAAUR") 9.4 11.0 14.0 11.0 12.0 64.0</span>
<span class="co"># as.mo("S. aureus") 24.0 26.0 44.0 33.0 63.0 69.0</span>
<span class="co"># as.mo("S aureus") 24.0 27.0 40.0 30.0 61.0 70.0</span>
<span class="co"># as.mo("Staphylococcus aureus") 2.6 3.1 3.2 3.2 3.3 3.8</span>
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 230.0 250.0 250.0 250.0 250.0 280.0</span>
<span class="co"># as.mo("Sthafilokkockus aaureuz") 180.0 190.0 200.0 190.0 200.0 330.0</span>
<span class="co"># as.mo("MRSA") 10.0 11.0 16.0 12.0 13.0 47.0</span>
<span class="co"># as.mo("VISA") 17.0 19.0 22.0 19.0 22.0 63.0</span>
<span class="co"># neval</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span>
<span class="co"># 25</span></code></pre></div>
<span class="co"># expr min lq mean median uq max neval</span>
<span class="co"># as.mo("sau") 10.0 11.0 16.0 11.0 13.0 50 25</span>
<span class="co"># as.mo("stau") 54.0 58.0 72.0 61.0 89.0 99 25</span>
<span class="co"># as.mo("STAU") 53.0 55.0 67.0 56.0 91.0 95 25</span>
<span class="co"># as.mo("staaur") 10.0 11.0 16.0 11.0 13.0 47 25</span>
<span class="co"># as.mo("STAAUR") 10.0 11.0 17.0 12.0 13.0 58 25</span>
<span class="co"># as.mo("S. aureus") 26.0 27.0 36.0 31.0 33.0 70 25</span>
<span class="co"># as.mo("S aureus") 26.0 27.0 40.0 29.0 61.0 68 25</span>
<span class="co"># as.mo("Staphylococcus aureus") 2.6 3.2 6.5 3.5 3.8 42 25</span>
<span class="co"># as.mo("Staphylococcus aureus (MRSA)") 240.0 250.0 260.0 260.0 270.0 290 25</span>
<span class="co"># as.mo("Sthafilokkockus aaureuz") 190.0 190.0 200.0 200.0 210.0 300 25</span>
<span class="co"># as.mo("MRSA") 10.0 11.0 13.0 12.0 13.0 40 25</span>
<span class="co"># as.mo("VISA") 18.0 19.0 32.0 20.0 24.0 130 25</span></code></pre></div>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="750"></p>
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 200 milliseconds, this is only 5 input values per second. It is clear that accepted taxonomic names are extremely fast, but some variations are up to 200 times slower to determine.</p>
<p>To improve performance, we implemented two important algorithms to save unnecessary calculations: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
@ -273,8 +260,8 @@
<span class="co"># what do these values look like? They are of class &lt;mo&gt;:</span>
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
<span class="co"># Class &lt;mo&gt;</span>
<span class="co"># [1] B_STRPT_PNMN B_STPHY_CONS B_ESCHR_COLI B_STRPT_PNMN B_ESCHR_COLI</span>
<span class="co"># [6] B_ENTRC_FCLS</span>
<span class="co"># [1] B_STPHY_EPDR B_STRPT_GRPA B_STPHY_AURS B_BCTRD_FRGL B_STPHY_HMNS</span>
<span class="co"># [6] B_STPHY_CONS</span>
<span class="co"># as the example_isolates data set has 2,000 rows, we should have 2 million items</span>
<span class="fu"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
@ -290,8 +277,8 @@
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
<span class="co"># Unit: milliseconds</span>
<span class="co"># expr min lq mean median uq max neval</span>
<span class="co"># mo_name(x) 180 186 215 221 222 281 10</span></code></pre></div>
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.221 seconds. That is 110 nanoseconds on average. You only lose time on your unique input values.</p>
<span class="co"># mo_name(x) 187 223 233 226 229 318 10</span></code></pre></div>
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.226 seconds. That is 113 nanoseconds on average. You only lose time on your unique input values.</p>
</div>
<div id="precalculated-results" class="section level3">
<h3 class="hasAnchor">
@ -305,10 +292,10 @@
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
<span class="co"># Unit: milliseconds</span>
<span class="co"># expr min lq mean median uq max neval</span>
<span class="co"># A 7.45 7.68 8.13 8.23 8.39 8.95 10</span>
<span class="co"># B 22.70 22.90 31.30 23.90 26.50 62.00 10</span>
<span class="co"># C 1.51 1.58 1.79 1.84 1.97 1.99 10</span></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0018 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<span class="co"># A 7.28 7.59 8.01 8.03 8.45 8.66 10</span>
<span class="co"># B 23.00 24.10 30.30 25.50 27.30 75.30 10</span>
<span class="co"># C 1.55 1.74 7.31 1.95 2.01 56.10 10</span></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0019 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">run_it</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span><span class="op">(</span>A <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_species</a></span><span class="op">(</span><span class="st">"aureus"</span><span class="op">)</span>,
B <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="st">"Staphylococcus"</span><span class="op">)</span>,
@ -322,14 +309,14 @@
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">3</span><span class="op">)</span>
<span class="co"># Unit: milliseconds</span>
<span class="co"># expr min lq mean median uq max neval</span>
<span class="co"># A 1.44 1.44 1.51 1.46 1.56 1.68 10</span>
<span class="co"># B 1.37 1.40 1.53 1.48 1.67 1.81 10</span>
<span class="co"># C 1.42 1.47 1.61 1.59 1.68 1.84 10</span>
<span class="co"># D 1.39 1.43 1.52 1.46 1.53 1.92 10</span>
<span class="co"># E 1.41 1.46 1.58 1.50 1.70 1.91 10</span>
<span class="co"># F 1.36 1.44 1.49 1.46 1.57 1.64 10</span>
<span class="co"># G 1.37 1.44 1.64 1.48 1.82 2.40 10</span>
<span class="co"># H 1.41 1.43 1.52 1.48 1.54 1.87 10</span></code></pre></div>
<span class="co"># A 1.42 1.45 1.56 1.50 1.57 2.00 10</span>
<span class="co"># B 1.43 1.46 1.49 1.47 1.55 1.59 10</span>
<span class="co"># C 1.41 1.43 1.58 1.49 1.57 2.19 10</span>
<span class="co"># D 1.41 1.48 1.61 1.54 1.63 2.33 10</span>
<span class="co"># E 1.41 1.45 1.64 1.51 1.56 2.68 10</span>
<span class="co"># F 1.42 1.52 1.63 1.57 1.71 1.99 10</span>
<span class="co"># G 1.41 1.46 1.65 1.56 1.90 1.98 10</span>
<span class="co"># H 1.42 1.46 1.59 1.55 1.70 1.88 10</span></code></pre></div>
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> anyway, there is no point in calculating the result. And because this package contains all phyla of all known bacteria, it can just return the initial value immediately.</p>
</div>
<div id="results-in-other-languages" class="section level3">
@ -357,13 +344,13 @@
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><span class="op">(</span><span class="va">run_it</span>, unit <span class="op">=</span> <span class="st">"ms"</span>, signif <span class="op">=</span> <span class="fl">4</span><span class="op">)</span>
<span class="co"># Unit: milliseconds</span>
<span class="co"># expr min lq mean median uq max neval</span>
<span class="co"># en 17.63 17.96 22.55 18.30 18.78 68.16 100</span>
<span class="co"># de 28.48 28.93 33.83 29.18 29.85 76.90 100</span>
<span class="co"># nl 32.10 33.11 43.48 33.70 35.84 202.50 100</span>
<span class="co"># es 32.17 32.67 43.51 33.33 66.07 78.29 100</span>
<span class="co"># it 21.95 22.29 26.55 22.59 23.13 70.41 100</span>
<span class="co"># fr 21.59 21.94 25.36 22.31 22.88 63.46 100</span>
<span class="co"># pt 21.75 22.15 28.50 22.48 23.01 68.10 100</span></code></pre></div>
<span class="co"># en 17.81 18.24 21.93 18.78 19.44 60.56 100</span>
<span class="co"># de 28.82 29.53 37.92 30.33 32.62 81.75 100</span>
<span class="co"># nl 32.65 33.61 44.22 34.43 37.44 193.90 100</span>
<span class="co"># es 32.51 32.95 41.88 33.70 36.39 80.63 100</span>
<span class="co"># it 22.00 22.57 27.98 23.15 25.14 67.04 100</span>
<span class="co"># fr 21.71 22.22 27.20 22.83 24.41 66.08 100</span>
<span class="co"># pt 21.71 22.54 26.97 23.06 23.94 67.41 100</span></code></pre></div>
<p>Currently supported non-English languages are German, Dutch, Spanish, Italian, French and Portuguese.</p>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -376,7 +376,7 @@
<div id="latest-released-version" class="section level4">
<h4 class="hasAnchor">
<a href="#latest-released-version" class="anchor"></a>Latest released version</h4>
<p>This package is available on the <a href="https://ropensci.org/r-universe/">rOpenSci R-universe platform</a>, as CRAN does not allow frequent updates of large packages. With CRAN, we cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.</p>
<p>This package is <a href="https://msberends.r-universe.dev">available here</a> on the <a href="https://ropensci.org/r-universe/">rOpenSci R-universe platform</a>, as CRAN does not allow frequent updates of large packages (though the <code>AMR</code> package is only 7-9 MB). With CRAN, we apparently cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.</p>
<p>Install this package in R by using the command:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span><span class="op">(</span><span class="st">"AMR"</span>, repos <span class="op">=</span> <span class="st">"https://msberends.r-universe.dev"</span><span class="op">)</span></code></pre></div>
@ -386,11 +386,11 @@
<div id="latest-development-version" class="section level4">
<h4 class="hasAnchor">
<a href="#latest-development-version" class="anchor"></a>Latest development version</h4>
<p><img src="https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master" alt="R-code-check"><a href="https://www.codefactor.io/repository/github/msberends/amr"><img src="https://www.codefactor.io/repository/github/msberends/amr/badge" alt="CodeFactor"></a> <a href="https://codecov.io/gh/msberends/AMR?branch=master"><img src="https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg" alt="Codecov"></a></p>
<p>The latest and unpublished development version can be installed from GitHub using:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span><span class="op">(</span><span class="st">"remotes"</span><span class="op">)</span> <span class="co"># if you haven't already</span>
<span class="fu">remotes</span><span class="fu">::</span><span class="fu"><a href="https://remotes.r-lib.org/reference/install_github.html">install_github</a></span><span class="op">(</span><span class="st">"msberends/AMR"</span><span class="op">)</span></code></pre></div>
<p><img src="https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master" alt="R-code-check"><img src="https://www.codefactor.io/repository/github/msberends/amr" alt="CodeFactor"><img src="https://codecov.io/gh/msberends/AMR?branch=master" alt="Codecov"></p>
<p>You can also download the latest build from our repository: <a href="https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz" class="uri">https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz</a></p>
</div>
</div>

View File

@ -456,7 +456,7 @@
<code><a href="../reference/as.rsi.html">is.rsi.eligible()</a></code> now detects if the column name resembles an antibiotic name or code and now returns <code>TRUE</code> immediately if the input contains any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.</li>
<li>Functions <code><a href="../reference/get_episode.html">get_episode()</a></code> and <code><a href="../reference/get_episode.html">is_new_episode()</a></code> now support less than a day as value for argument <code>episode_days</code> (e.g., to include one patient/test per hour)</li>
<li>Argument <code>ampc_cephalosporin_resistance</code> in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> now also applies to value “I” (not only “S”)</li>
<li>Functions <code><a href="https://rdrr.io/r/base/print.html">print()</a></code> and <code><a href="https://rdrr.io/r/base/summary.html">summary()</a></code> on a Principal Components Analysis object (<code><a href="../reference/pca.html">pca()</a></code>) now print additional group info if the original data was grouped using <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">dplyr::group_by()</a></code>
<li>Functions <code><a href="https://docs.ropensci.org/skimr/reference/print.html">print()</a></code> and <code><a href="https://rdrr.io/r/base/summary.html">summary()</a></code> on a Principal Components Analysis object (<code><a href="../reference/pca.html">pca()</a></code>) now print additional group info if the original data was grouped using <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">dplyr::group_by()</a></code>
</li>
<li>Improved speed and reliability of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>. As this also internally improves the reliability of <code><a href="../reference/first_isolate.html">first_isolate()</a></code> and <code><a href="../reference/mdro.html">mdro()</a></code>, this might have a slight impact on the results of those functions.</li>
<li>Fix for <code><a href="../reference/mo_property.html">mo_name()</a></code> when used in other languages than English</li>

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2021-05-26T09:09Z
last_built: 2021-05-26T12:00Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles

View File

@ -276,7 +276,7 @@
<span class='fu'><a href='plot.html'>plot</a></span><span class='op'>(</span><span class='va'>x</span>, main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Prediction of"</span>, <span class='va'>x_name</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='co'># S3 method for resistance_predict</span>
<span class='fu'>ggplot</span><span class='op'>(</span><span class='va'>x</span>, main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Prediction of"</span>, <span class='va'>x_name</span><span class='op'>)</span>, ribbon <span class='op'>=</span> <span class='cn'>TRUE</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span><span class='va'>x</span>, main <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Prediction of"</span>, <span class='va'>x_name</span><span class='op'>)</span>, ribbon <span class='op'>=</span> <span class='cn'>TRUE</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='fu'>ggplot_rsi_predict</span><span class='op'>(</span>
<span class='va'>x</span>,

View File

@ -98,7 +98,7 @@ This package can be used for:
#### Latest released version
This package is available on the [rOpenSci R-universe platform](https://ropensci.org/r-universe/), as CRAN does not allow frequent updates of large packages. With CRAN, we cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.
This package is [available here](https://msberends.r-universe.dev) on the [rOpenSci R-universe platform](https://ropensci.org/r-universe/), as CRAN does not allow frequent updates of large packages (though the `AMR` package is only 7-9 MB). With CRAN, we apparently cannot update this package frequently enough to implement the latest EUCAST/CLSI guidelines or the latest microbial taxonomy.
Install this package in R by using the command:
@ -111,9 +111,6 @@ It will be downloaded and installed automatically.
**Note:** Not all functions on this website may be available in this latest release. To use all functions and data sets mentioned on this website, install the latest development version.
#### Latest development version
![R-code-check](https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master)
[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
[![Codecov](https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=master)
The latest and unpublished development version can be installed from GitHub using:
@ -122,6 +119,10 @@ install.packages("remotes") # if you haven't already
remotes::install_github("msberends/AMR")
```
![R-code-check](https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master)
![[CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
![[Codecov](https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=master)
You can also download the latest build from our repository: <https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz>
### Get started

View File

@ -102,7 +102,7 @@ for (i in seq_len(length(import_functions))) {
fn <- names(import_functions)[i]
pkg <- unname(import_functions[i])
# function should exist in foreign pkg namespace
if (pkg %in% rownames(installed.packages())) {
if (AMR:::pkg_is_available(pkg, also_load = FALSE)) {
tst <- !is.null(AMR:::import_fn(name = fn, pkg = pkg, error_on_fail = FALSE))
expect_true(tst,
info = ifelse(tst,