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

(v1.7.1.9048) unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-10-04 10:22:10 +02:00
parent 7a0ecd6c3b
commit d1b16ce641
20 changed files with 299 additions and 299 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.7.1.9046
Date: 2021-10-03
Version: 1.7.1.9048
Date: 2021-10-04
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by

View File

@ -1,5 +1,5 @@
# `AMR` 1.7.1.9046
## <small>Last updated: 3 October 2021</small>
# `AMR` 1.7.1.9048
## <small>Last updated: 4 October 2021</small>
### Breaking changes
* Removed `p_symbol()` and all `filter_*()` functions (except for `filter_first_isolate()`), which were all deprecated in a previous package version

Binary file not shown.

View File

@ -44,7 +44,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.7.1.9040</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9048</span>
</span>
</div>
@ -191,7 +191,7 @@
<h1 data-toc-skip>How to conduct AMR data analysis</h1>
<h4 data-toc-skip class="author">Matthijs S. Berends</h4>
<h4 data-toc-skip class="date">29 September 2021</h4>
<h4 data-toc-skip class="date">04 October 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/AMR.Rmd" class="external-link"><code>vignettes/AMR.Rmd</code></a></small>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -200,7 +200,7 @@
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/" class="external-link">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 29 September 2021.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/" class="external-link">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 04 October 2021.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor" aria-hidden="true"></a>Introduction</h1>
@ -231,21 +231,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2021-09-29</td>
<td align="center">2021-10-04</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2021-09-29</td>
<td align="center">2021-10-04</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2021-09-29</td>
<td align="center">2021-10-04</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -342,52 +342,52 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2017-08-27</td>
<td align="center">L5</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">2017-02-15</td>
<td align="center">L4</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2010-01-01</td>
<td align="center">H4</td>
<td align="center">2017-09-21</td>
<td align="center">T1</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">M</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2014-12-09</td>
<td align="center">C5</td>
<td align="center">Hospital B</td>
<td align="center">2016-12-13</td>
<td align="center">P9</td>
<td align="center">Hospital D</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>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2010-02-19</td>
<td align="center">W1</td>
<td align="center">2013-09-17</td>
<td align="center">S3</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2017-10-22</td>
<td align="center">R4</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</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="odd">
<td align="center">2012-01-06</td>
<td align="center">P6</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
@ -397,15 +397,15 @@
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-11-16</td>
<td align="center">X9</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">2014-06-30</td>
<td align="center">D3</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</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">M</td>
</tr>
</tbody>
</table>
@ -439,16 +439,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,412</td>
<td align="right">52.06%</td>
<td align="right">10,412</td>
<td align="right">52.06%</td>
<td align="right">10,351</td>
<td align="right">51.76%</td>
<td align="right">10,351</td>
<td align="right">51.76%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,588</td>
<td align="right">47.94%</td>
<td align="right">9,649</td>
<td align="right">48.25%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -501,9 +501,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,617 'phenotype-based' first isolates (53.1% of total where a</span>
<span class="co"># =&gt; Found 10,567 'phenotype-based' first isolates (52.8% of total where a</span>
<span class="co"># microbial ID was available)</span></code></pre></div>
<p>So only 53.1% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html" class="external-link">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" class="external-link">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" class="external-link">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>
@ -511,10 +511,10 @@ 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,617 isolates for analysis. Now our data looks like:</p>
<p>So we end up with 10,567 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" class="external-link">head</a></span><span class="op">(</span><span class="va">data_1st</span><span class="op">)</span></code></pre></div>
<table class="table">
<table style="width:100%;" class="table">
<colgroup>
<col width="2%">
<col width="9%">
@ -528,7 +528,7 @@ Longest: 1</p>
<col width="6%">
<col width="11%">
<col width="12%">
<col width="7%">
<col width="9%">
<col width="5%">
</colgroup>
<thead><tr class="header">
@ -549,94 +549,94 @@ Longest: 1</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="left">2</td>
<td align="center">2016-12-13</td>
<td align="center">P9</td>
<td align="center">Hospital D</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">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">3</td>
<td align="center">2010-01-01</td>
<td align="center">H4</td>
<td align="center">2013-09-17</td>
<td align="center">S3</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</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">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">
<tr class="odd">
<td align="left">4</td>
<td align="center">2014-12-09</td>
<td align="center">C5</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="odd">
<td align="left">6</td>
<td align="center">2010-11-16</td>
<td align="center">X9</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="even">
<td align="left">8</td>
<td align="center">2011-07-04</td>
<td align="center">T1</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</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">2012-05-19</td>
<td align="center">M7</td>
<td align="center">Hospital D</td>
<td align="center">2017-10-22</td>
<td align="center">R4</td>
<td align="center">Hospital C</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">S</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">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">14</td>
<td align="center">2016-05-14</td>
<td align="center">C2</td>
<td align="center">Hospital D</td>
<td align="left">9</td>
<td align="center">2014-05-28</td>
<td align="center">Y8</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</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">11</td>
<td align="center">2010-02-13</td>
<td align="center">Y5</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="even">
<td align="left">12</td>
<td align="center">2010-01-30</td>
<td align="center">F3</td>
<td align="center">Hospital C</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">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
@ -665,8 +665,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" class="external-link">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,617<br>
Available: 10,617 (100.0%, NA: 0 = 0.0%)<br>
Length: 10,567<br>
Available: 10,567 (100.0%, NA: 0 = 0.0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -683,33 +683,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">4,569</td>
<td align="right">43.03%</td>
<td align="right">4,569</td>
<td align="right">43.03%</td>
<td align="right">4,623</td>
<td align="right">43.75%</td>
<td align="right">4,623</td>
<td align="right">43.75%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">2,718</td>
<td align="right">25.60%</td>
<td align="right">7,287</td>
<td align="right">68.64%</td>
<td align="right">2,765</td>
<td align="right">26.17%</td>
<td align="right">7,388</td>
<td align="right">69.92%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,158</td>
<td align="right">20.33%</td>
<td align="right">9,445</td>
<td align="right">88.96%</td>
<td align="right">2,017</td>
<td align="right">19.09%</td>
<td align="right">9,405</td>
<td align="right">89.00%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,172</td>
<td align="right">11.04%</td>
<td align="right">10,617</td>
<td align="right">1,162</td>
<td align="right">11.00%</td>
<td align="right">10,567</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -728,14 +728,14 @@ Longest: 24</p>
<col width="9%">
<col width="9%">
<col width="9%">
<col width="10%">
<col width="11%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="6%">
<col width="11%">
<col width="12%">
<col width="11%">
<col width="9%">
<col width="5%">
</colgroup>
@ -756,13 +756,28 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-05-14</td>
<td align="center">C2</td>
<td align="center">Hospital D</td>
<td align="center">2013-09-17</td>
<td align="center">S3</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</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">2010-01-30</td>
<td align="center">F3</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_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">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
@ -770,28 +785,13 @@ Longest: 24</p>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2013-08-08</td>
<td align="center">C10</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="odd">
<td align="center">2017-08-12</td>
<td align="center">H8</td>
<td align="center">Hospital D</td>
<td align="center">2011-10-02</td>
<td align="center">B9</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">I</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
@ -801,42 +801,12 @@ Longest: 24</p>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2012-09-19</td>
<td align="center">S7</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</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">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2016-07-27</td>
<td align="center">I10</td>
<td align="center">Hospital C</td>
<td align="center">2017-09-14</td>
<td align="center">Y3</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</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>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2013-11-25</td>
<td align="center">P4</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>
@ -845,6 +815,36 @@ Longest: 24</p>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2013-01-07</td>
<td align="center">L2</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">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">2015-06-10</td>
<td align="center">O6</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">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>
</tbody>
</table>
<p>If you want to get a quick glance of the number of isolates in different bug/drug combinations, you can use the <code><a href="../reference/bug_drug_combinations.html">bug_drug_combinations()</a></code> function:</p>
@ -866,50 +866,50 @@ Longest: 24</p>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">AMX</td>
<td align="center">2159</td>
<td align="center">142</td>
<td align="center">2268</td>
<td align="center">4569</td>
<td align="center">2182</td>
<td align="center">119</td>
<td align="center">2322</td>
<td align="center">4623</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">AMC</td>
<td align="center">3349</td>
<td align="center">169</td>
<td align="center">1051</td>
<td align="center">4569</td>
<td align="center">3388</td>
<td align="center">143</td>
<td align="center">1092</td>
<td align="center">4623</td>
</tr>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">CIP</td>
<td align="center">3375</td>
<td align="center">3434</td>
<td align="center">0</td>
<td align="center">1194</td>
<td align="center">4569</td>
<td align="center">1189</td>
<td align="center">4623</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">3985</td>
<td align="center">4002</td>
<td align="center">0</td>
<td align="center">584</td>
<td align="center">4569</td>
<td align="center">621</td>
<td align="center">4623</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">1172</td>
<td align="center">1172</td>
<td align="center">1162</td>
<td align="center">1162</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">AMC</td>
<td align="center">930</td>
<td align="center">35</td>
<td align="center">207</td>
<td align="center">1172</td>
<td align="center">928</td>
<td align="center">43</td>
<td align="center">191</td>
<td align="center">1162</td>
</tr>
</tbody>
</table>
@ -932,34 +932,34 @@ Longest: 24</p>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">3985</td>
<td align="center">4002</td>
<td align="center">0</td>
<td align="center">584</td>
<td align="center">4569</td>
<td align="center">621</td>
<td align="center">4623</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">GEN</td>
<td align="center">1073</td>
<td align="center">1043</td>
<td align="center">0</td>
<td align="center">99</td>
<td align="center">1172</td>
<td align="center">119</td>
<td align="center">1162</td>
</tr>
<tr class="odd">
<td align="center">S. aureus</td>
<td align="center">GEN</td>
<td align="center">2409</td>
<td align="center">2461</td>
<td align="center">0</td>
<td align="center">309</td>
<td align="center">2718</td>
<td align="center">304</td>
<td align="center">2765</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">2158</td>
<td align="center">2158</td>
<td align="center">2017</td>
<td align="center">2017</td>
</tr>
</tbody>
</table>
@ -973,7 +973,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.5429029</span></code></pre></div>
<span class="co"># [1] 0.5489732</span></code></pre></div>
<p>Or can be used in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">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>
@ -987,19 +987,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5478773</td>
<td align="center">0.5483971</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5516767</td>
<td align="center">0.5501101</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5306768</td>
<td align="center">0.5632754</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5297098</td>
<td align="center">0.5369668</td>
</tr>
</tbody>
</table>
@ -1018,23 +1018,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5478773</td>
<td align="center">3227</td>
<td align="center">0.5483971</td>
<td align="center">3213</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5516767</td>
<td align="center">3638</td>
<td align="center">0.5501101</td>
<td align="center">3632</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5306768</td>
<td align="center">1581</td>
<td align="center">0.5632754</td>
<td align="center">1612</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5297098</td>
<td align="center">2171</td>
<td align="center">0.5369668</td>
<td align="center">2110</td>
</tr>
</tbody>
</table>
@ -1055,27 +1055,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.7699715</td>
<td align="center">0.8721821</td>
<td align="center">0.9748304</td>
<td align="center">0.7637897</td>
<td align="center">0.8656716</td>
<td align="center">0.9781527</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8233788</td>
<td align="center">0.9155290</td>
<td align="center">0.9872014</td>
<td align="center">0.8356282</td>
<td align="center">0.8975904</td>
<td align="center">0.9845095</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.7969095</td>
<td align="center">0.8863135</td>
<td align="center">0.9790287</td>
<td align="center">0.7949367</td>
<td align="center">0.8900542</td>
<td align="center">0.9804702</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5338276</td>
<td align="center">0.5389192</td>
<td align="center">0.0000000</td>
<td align="center">0.5338276</td>
<td align="center">0.5389192</td>
</tr>
</tbody>
</table>
@ -1090,33 +1090,33 @@ Longest: 24</p>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">summarise</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><span class="op">(</span><span class="fu"><a href="../reference/antibiotic_class_selectors.html">penicillins</a></span><span class="op">(</span><span class="op">)</span>, <span class="va">resistance</span>, as_percent <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span> <span class="op">%&gt;%</span>
<span class="co"># format the antibiotic column names, using so-called snake case,</span>
<span class="co"># so 'Amoxicillin/clavulanic acid' becomes 'amoxicillin_clavulanic_acid'</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/rename.html" class="external-link">rename_with</a></span><span class="op">(</span>.fn <span class="op">=</span> <span class="va">ab_name</span>, .cols <span class="op">=</span> <span class="fu"><a href="../reference/antibiotic_class_selectors.html">penicillins</a></span><span class="op">(</span><span class="op">)</span>, snake_case <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/rename.html" class="external-link">rename_with</a></span><span class="op">(</span><span class="va">set_ab_names</span>, <span class="fu"><a href="../reference/antibiotic_class_selectors.html">penicillins</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="left">hospital</th>
<th align="right">Amoxicillin</th>
<th align="right">Amoxicillin/clavulanic acid</th>
<th align="right">amoxicillin</th>
<th align="right">amoxicillin_clavulanic_acid</th>
</tr></thead>
<tbody>
<tr class="odd">
<td align="left">Hospital A</td>
<td align="right">54.8%</td>
<td align="right">26.7%</td>
<td align="right">27.0%</td>
</tr>
<tr class="even">
<td align="left">Hospital B</td>
<td align="right">55.2%</td>
<td align="right">26.9%</td>
<td align="right">55.0%</td>
<td align="right">26.1%</td>
</tr>
<tr class="odd">
<td align="left">Hospital C</td>
<td align="right">53.1%</td>
<td align="right">56.3%</td>
<td align="right">26.9%</td>
</tr>
<tr class="even">
<td align="left">Hospital D</td>
<td align="right">53.0%</td>
<td align="right">25.4%</td>
<td align="right">53.7%</td>
<td align="right">25.3%</td>
</tr>
</tbody>
</table>
@ -1200,18 +1200,18 @@ 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] 0.005 0.125 32 0.0625 0.5 0.125 16 0.25 0.025 </span>
<span class="co"># [10] &lt;=0.001 &lt;=0.001 0.0625 0.01 1 2 32 0.01 8 </span>
<span class="co"># [19] 0.005 32 0.005 32 128 0.125 0.125 2 &lt;=0.001</span>
<span class="co"># [28] 4 8 0.005 0.002 0.5 0.002 0.5 64 0.125 </span>
<span class="co"># [37] 0.01 0.002 0.0625 128 0.5 1 0.125 0.0625 0.002 </span>
<span class="co"># [46] 32 0.025 0.005 8 0.002 &lt;=0.001 8 1 16 </span>
<span class="co"># [55] &lt;=0.001 0.25 0.125 0.025 4 8 0.0625 16 4 </span>
<span class="co"># [64] 64 &lt;=0.001 128 0.125 0.5 4 32 &lt;=0.001 128 </span>
<span class="co"># [73] 16 64 16 0.125 4 2 0.002 0.025 8 </span>
<span class="co"># [82] 4 2 0.01 4 0.125 &lt;=0.001 0.002 0.01 0.5 </span>
<span class="co"># [91] 32 128 0.01 1 0.125 4 0.002 0.25 0.25 </span>
<span class="co"># [100] 16</span></code></pre></div>
<span class="co"># [1] 0.5 0.125 0.002 2 0.0625 128 64 0.002 0.002 </span>
<span class="co"># [10] 8 0.025 256 0.0625 0.25 128 256 0.0625 4 </span>
<span class="co"># [19] 0.025 256 64 256 4 &lt;=0.001 128 0.0625 0.025 </span>
<span class="co"># [28] 256 0.25 0.25 0.01 0.002 0.125 16 0.002 2 </span>
<span class="co"># [37] 0.01 2 8 8 0.125 64 4 128 32 </span>
<span class="co"># [46] 0.25 32 1 1 256 128 128 64 4 </span>
<span class="co"># [55] 128 128 128 0.025 1 4 16 0.01 0.005 </span>
<span class="co"># [64] 0.025 2 0.002 0.25 0.0625 0.005 0.005 16 8 </span>
<span class="co"># [73] 32 0.002 0.01 256 256 1 8 32 8 </span>
<span class="co"># [82] 0.125 0.002 0.005 32 16 8 256 32 0.5 </span>
<span class="co"># [91] 4 0.25 1 0.25 2 2 0.125 0.25 16 </span>
<span class="co"># [100] 4</span></code></pre></div>
<div class="sourceCode" id="cb37"><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>
@ -1240,10 +1240,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] 26 27 19 22 20 17 23 26 26 17 21 21 22 18 19 25 18 20 17 20 20 22 17 31 24</span>
<span class="co"># [26] 28 22 20 31 18 19 26 25 19 22 19 26 26 24 18 18 19 31 25 31 21 28 23 22 21</span>
<span class="co"># [51] 22 18 22 18 29 25 29 29 29 24 22 19 23 23 23 22 17 24 17 26 23 25 30 26 17</span>
<span class="co"># [76] 17 20 31 17 30 25 18 18 22 29 25 24 29 27 26 30 29 18 21 18 24 25 26 31 25</span></code></pre></div>
<span class="co"># [1] 20 29 17 26 24 21 24 26 23 31 21 20 29 20 23 20 20 31 21 22 24 19 28 29 24</span>
<span class="co"># [26] 31 31 25 30 24 30 30 30 25 22 30 25 22 27 28 19 18 19 31 20 18 18 23 25 23</span>
<span class="co"># [51] 27 21 24 25 25 21 22 23 25 29 22 21 22 28 30 27 25 21 18 27 30 21 29 25 31</span>
<span class="co"># [76] 18 19 17 18 23 24 26 30 29 24 24 20 29 28 27 18 31 23 26 30 23 17 23 28 31</span></code></pre></div>
<div class="sourceCode" id="cb43"><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: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 53 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

@ -44,7 +44,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.7.1.9046</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9048</span>
</span>
</div>
@ -190,7 +190,7 @@
<div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1>
<h4 data-toc-skip class="date">03 October 2021</h4>
<h4 data-toc-skip class="date">04 October 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small>
<div class="hidden name"><code>datasets.Rmd</code></div>

View File

@ -92,7 +92,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.7.1.9040</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9048</span>
</span>
</div>

View File

@ -44,7 +44,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.7.1.9040</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9048</span>
</span>
</div>

View File

@ -92,7 +92,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.7.1.9046</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9048</span>
</span>
</div>
@ -240,12 +240,12 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1719046" class="section level1">
<h1 class="page-header" data-toc-text="1.7.1.9046">
<a href="#amr-1719046" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9046</h1>
<div id="last-updated-3-october-2021" class="section level2">
<div id="amr-1719048" class="section level1">
<h1 class="page-header" data-toc-text="1.7.1.9048">
<a href="#amr-1719048" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9048</h1>
<div id="last-updated-4-october-2021" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-3-october-2021" class="anchor" aria-hidden="true"></a><small>Last updated: 3 October 2021</small>
<a href="#last-updated-4-october-2021" class="anchor" aria-hidden="true"></a><small>Last updated: 4 October 2021</small>
</h2>
<div id="breaking-changes" class="section level3">
<h3 class="hasAnchor">

View File

@ -69,7 +69,7 @@ expect_identical(colnames(set_ab_names(example_isolates[, 20:25], language = "nl
c("Cefoxitine", "Cefotaxim", "Ceftazidim", "Ceftriaxon", "Gentamicine", "Tobramycine"))
expect_identical(colnames(set_ab_names(example_isolates[, 20:25], "atc")),
c("J01DC01", "J01DD01", "J01DD02", "J01DD04", "J01GB03", "J01GB01"))
if (AMR:::pkg_is_available("dplyr")) {
if (AMR:::pkg_is_available("dplyr") && packageVersion("dplyr") >= "1.0.0") {
expect_identical(example_isolates %>% set_ab_names(),
example_isolates %>% rename_with(set_ab_names))
}

View File

@ -385,13 +385,13 @@ data_1st %>%
summarise(across(penicillins(), resistance, as_percent = TRUE)) %>%
# format the antibiotic column names, using so-called snake case,
# so 'Amoxicillin/clavulanic acid' becomes 'amoxicillin_clavulanic_acid'
rename_with(.fn = ab_name, .cols = penicillins(), snake_case = TRUE)
rename_with(set_ab_names, penicillins())
```
```{r, echo = FALSE, message = FALSE}
data_1st %>%
group_by(hospital) %>%
summarise(across(penicillins(), resistance, as_percent = TRUE)) %>%
rename_with(.fn = ab_name, .cols = penicillins(), snake_case = TRUE) %>%
rename_with(set_ab_names, penicillins()) %>%
knitr::kable(align = "lrr")
```