1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 05:26:13 +01:00

Built site for AMR: 1.8.2.9054@6017f81

This commit is contained in:
github-actions 2022-11-29 18:45:20 +00:00
parent 0bc2afafe9
commit a153eb2626
37 changed files with 436 additions and 435 deletions

View File

@ -168,7 +168,7 @@
<h4 data-toc-skip class="author">Dr. Matthijs
Berends</h4>
<h4 data-toc-skip class="date">28 November 2022</h4>
<h4 data-toc-skip class="date">29 November 2022</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/vignettes/AMR.Rmd" class="external-link"><code>vignettes/AMR.Rmd</code></a></small>
<div class="d-none name"><code>AMR.Rmd</code></div>
@ -180,7 +180,7 @@ Berends</h4>
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 28 November 2022.</p>
generated on 29 November 2022.</p>
<div class="section level2">
<h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
</h2>
@ -236,21 +236,21 @@ make the structure of your data generally look like this:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2022-11-28</td>
<td align="center">2022-11-29</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">2022-11-28</td>
<td align="center">2022-11-29</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">2022-11-28</td>
<td align="center">2022-11-29</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -400,71 +400,71 @@ data set:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-12-09</td>
<td align="center">B5</td>
<td align="center">2016-02-08</td>
<td align="center">L4</td>
<td align="center">Hospital A</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">Escherichia 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">M</td>
</tr>
<tr class="even">
<td align="center">2013-12-22</td>
<td align="center">V7</td>
<td align="center">2011-06-04</td>
<td align="center">B4</td>
<td align="center">Hospital B</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>
</tr>
<tr class="odd">
<td align="center">2010-12-27</td>
<td align="center">U10</td>
<td align="center">Hospital B</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">2013-08-11</td>
<td align="center">H1</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</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>
</tr>
<tr class="odd">
<td align="center">2011-09-01</td>
<td align="center">J7</td>
<td align="center">2011-08-27</td>
<td align="center">M9</td>
<td align="center">Hospital B</td>
<td align="center">Streptococcus 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">M</td>
</tr>
<tr class="even">
<td align="center">2015-04-24</td>
<td align="center">L8</td>
<td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</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>
</tr>
<tr class="even">
<td align="center">2010-09-10</td>
<td align="center">N5</td>
<td align="center">Hospital A</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="odd">
<td align="center">2015-12-02</td>
<td align="center">E9</td>
<td align="center">Hospital B</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">M</td>
</tr>
<tr class="even">
<td align="center">2012-01-20</td>
<td align="center">V9</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</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>
</tbody>
</table>
<p>Now, lets start the cleaning and the analysis!</p>
@ -499,16 +499,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,502</td>
<td align="right">52.51%</td>
<td align="right">10,502</td>
<td align="right">52.51%</td>
<td align="right">10,441</td>
<td align="right">52.21%</td>
<td align="right">10,441</td>
<td align="right">52.21%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,498</td>
<td align="right">47.49%</td>
<td align="right">9,559</td>
<td align="right">47.80%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -621,9 +621,9 @@ takes into account the antimicrobial susceptibility test results using
<span><span class="co"># Basing inclusion on all antimicrobial results, using a points threshold of</span></span>
<span><span class="co"># 2</span></span>
<span><span class="co"># Including isolates from ICU.</span></span>
<span><span class="co"># =&gt; Found 10,638 'phenotype-based' first isolates (53.2% of total where a</span></span>
<span><span class="co"># =&gt; Found 10,709 'phenotype-based' first isolates (53.5% of total where a</span></span>
<span><span class="co"># microbial ID was available)</span></span></code></pre></div>
<p>So only 53.2% is suitable for resistance analysis! We can now filter
<p>So only 53.5% 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">
@ -634,12 +634,13 @@ on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html"
<code class="sourceCode R"><span><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span>
<span> <span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co"># Including isolates from ICU.</span></span></code></pre></div>
<p>So we end up with 10,638 isolates for analysis. Now our data looks
<p>So we end up with 10,709 isolates for analysis. Now our data looks
like:</p>
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><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></span></code></pre></div>
<table class="table">
<table style="width:100%;" class="table">
<colgroup>
<col width="2%">
<col width="9%">
<col width="9%">
<col width="9%">
@ -655,6 +656,7 @@ like:</p>
<col width="5%">
</colgroup>
<thead><tr class="header">
<th align="left"></th>
<th align="center">date</th>
<th align="center">patient_id</th>
<th align="center">hospital</th>
@ -671,90 +673,96 @@ like:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-12-09</td>
<td align="center">B5</td>
<td align="center">Hospital A</td>
<td align="left">3</td>
<td align="center">2010-12-27</td>
<td align="center">U10</td>
<td align="center">Hospital B</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2013-12-22</td>
<td align="center">V7</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">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">2011-09-01</td>
<td align="center">J7</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="even">
<td align="center">2010-09-10</td>
<td align="center">N5</td>
<td align="center">Hospital A</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="center">2015-12-02</td>
<td align="center">E9</td>
<td align="center">Hospital B</td>
<td align="left">4</td>
<td align="center">2013-08-11</td>
<td align="center">H1</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AURS</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-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">7</td>
<td align="center">2013-10-25</td>
<td align="center">I3</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">R</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="center">2012-01-20</td>
<td align="center">V9</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="left">9</td>
<td align="center">2011-08-23</td>
<td align="center">Y10</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">11</td>
<td align="center">2012-08-03</td>
<td align="center">U10</td>
<td align="center">Hospital A</td>
<td align="center">B_KLBSL_PNMN</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">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">12</td>
<td align="center">2013-12-31</td>
<td align="center">L3</td>
<td align="center">Hospital A</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">S</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
@ -793,8 +801,8 @@ readable:</p>
<code class="sourceCode R"><span><span class="va">data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span> <span class="fu"><a href="https://msberends.github.io/cleaner/reference/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></span></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 10,638<br>
Available: 10,638 (100%, NA: 0 = 0%)<br>
Length: 10,709<br>
Available: 10,709 (100%, NA: 0 = 0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -819,33 +827,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">4,646</td>
<td align="right">43.67%</td>
<td align="right">4,646</td>
<td align="right">43.67%</td>
<td align="right">4,635</td>
<td align="right">43.28%</td>
<td align="right">4,635</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,743</td>
<td align="right">25.78%</td>
<td align="right">7,389</td>
<td align="right">69.46%</td>
<td align="right">2,757</td>
<td align="right">25.74%</td>
<td align="right">7,392</td>
<td align="right">69.03%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,065</td>
<td align="right">19.41%</td>
<td align="right">9,454</td>
<td align="right">88.87%</td>
<td align="right">2,115</td>
<td align="right">19.75%</td>
<td align="right">9,507</td>
<td align="right">88.78%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,184</td>
<td align="right">11.13%</td>
<td align="right">10,638</td>
<td align="right">1,202</td>
<td align="right">11.22%</td>
<td align="right">10,709</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -894,8 +902,38 @@ antibiotic class they are in:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2011-09-01</td>
<td align="center">J7</td>
<td align="center">2014-06-23</td>
<td align="center">T5</td>
<td align="center">Hospital B</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">2016-09-29</td>
<td align="center">N9</td>
<td align="center">Hospital A</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">2011-01-04</td>
<td align="center">E8</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
@ -909,54 +947,24 @@ antibiotic class they are in:</p>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2014-11-04</td>
<td align="center">C7</td>
<td align="center">2017-12-28</td>
<td align="center">Z5</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="odd">
<td align="center">2010-05-22</td>
<td align="center">X1</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">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="even">
<td align="center">2011-03-20</td>
<td align="center">A1</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="odd">
<td align="center">2016-05-13</td>
<td align="center">K9</td>
<td align="center">Hospital A</td>
<td align="center">2010-08-11</td>
<td align="center">C6</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
@ -969,9 +977,9 @@ antibiotic class they are in:</p>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2014-01-21</td>
<td align="center">Q10</td>
<td align="center">Hospital D</td>
<td align="center">2012-08-24</td>
<td align="center">Z9</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
@ -1005,50 +1013,50 @@ different bug/drug combinations, you can use the
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">AMX</td>
<td align="center">2171</td>
<td align="center">147</td>
<td align="center">2328</td>
<td align="center">4646</td>
<td align="center">2204</td>
<td align="center">121</td>
<td align="center">2310</td>
<td align="center">4635</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">AMC</td>
<td align="center">3429</td>
<td align="center">157</td>
<td align="center">1060</td>
<td align="center">4646</td>
<td align="center">3389</td>
<td align="center">150</td>
<td align="center">1096</td>
<td align="center">4635</td>
</tr>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">CIP</td>
<td align="center">3354</td>
<td align="center">3408</td>
<td align="center">0</td>
<td align="center">1292</td>
<td align="center">4646</td>
<td align="center">1227</td>
<td align="center">4635</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">4083</td>
<td align="center">4065</td>
<td align="center">0</td>
<td align="center">563</td>
<td align="center">4646</td>
<td align="center">570</td>
<td align="center">4635</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">1184</td>
<td align="center">1184</td>
<td align="center">1202</td>
<td align="center">1202</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">AMC</td>
<td align="center">936</td>
<td align="center">42</td>
<td align="center">206</td>
<td align="center">1184</td>
<td align="center">927</td>
<td align="center">50</td>
<td align="center">225</td>
<td align="center">1202</td>
</tr>
</tbody>
</table>
@ -1070,34 +1078,34 @@ different bug/drug combinations, you can use the
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">4083</td>
<td align="center">4065</td>
<td align="center">0</td>
<td align="center">563</td>
<td align="center">4646</td>
<td align="center">570</td>
<td align="center">4635</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">GEN</td>
<td align="center">1073</td>
<td align="center">1095</td>
<td align="center">0</td>
<td align="center">111</td>
<td align="center">1184</td>
<td align="center">107</td>
<td align="center">1202</td>
</tr>
<tr class="odd">
<td align="center">S. aureus</td>
<td align="center">GEN</td>
<td align="center">2435</td>
<td align="center">2408</td>
<td align="center">0</td>
<td align="center">308</td>
<td align="center">2743</td>
<td align="center">349</td>
<td align="center">2757</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">2065</td>
<td align="center">2065</td>
<td align="center">2115</td>
<td align="center">2115</td>
</tr>
</tbody>
</table>
@ -1129,7 +1137,7 @@ I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equa
own:</p>
<div class="sourceCode" id="cb25"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></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>
<span><span class="co"># [1] 0.5455913</span></span></code></pre></div>
<span><span class="co"># [1] 0.5429078</span></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="cb26"><pre class="downlit sourceCode r">
@ -1144,19 +1152,19 @@ own:</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5382918</td>
<td align="center">0.5461974</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5347408</td>
<td align="center">0.5343758</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5776965</td>
<td align="center">0.5487149</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5509126</td>
<td align="center">0.5482517</td>
</tr>
</tbody>
</table>
@ -1181,23 +1189,23 @@ all isolates available for every group (i.e. values S, I or R):</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5382918</td>
<td align="center">3173</td>
<td align="center">0.5461974</td>
<td align="center">3182</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5347408</td>
<td align="center">3742</td>
<td align="center">0.5343758</td>
<td align="center">3709</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5776965</td>
<td align="center">1641</td>
<td align="center">0.5487149</td>
<td align="center">1673</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5509126</td>
<td align="center">2082</td>
<td align="center">0.5482517</td>
<td align="center">2145</td>
</tr>
</tbody>
</table>
@ -1222,27 +1230,27 @@ therapies very easily:</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.7718467</td>
<td align="center">0.8788205</td>
<td align="center">0.9750323</td>
<td align="center">0.7635383</td>
<td align="center">0.8770227</td>
<td align="center">0.9766990</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8260135</td>
<td align="center">0.9062500</td>
<td align="center">0.9873311</td>
<td align="center">0.8128120</td>
<td align="center">0.9109817</td>
<td align="center">0.9833611</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.7907401</td>
<td align="center">0.8877142</td>
<td align="center">0.9817718</td>
<td align="center">0.7972434</td>
<td align="center">0.8734131</td>
<td align="center">0.9818643</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5438257</td>
<td align="center">0.5399527</td>
<td align="center">0.0000000</td>
<td align="center">0.5438257</td>
<td align="center">0.5399527</td>
</tr>
</tbody>
</table>
@ -1270,23 +1278,23 @@ classes, use a antibiotic class selector such as
<tbody>
<tr class="odd">
<td align="left">Hospital A</td>
<td align="right">53.8%</td>
<td align="right">25.3%</td>
<td align="right">54.6%</td>
<td align="right">27.7%</td>
</tr>
<tr class="even">
<td align="left">Hospital B</td>
<td align="right">53.5%</td>
<td align="right">25.1%</td>
<td align="right">53.4%</td>
<td align="right">26.4%</td>
</tr>
<tr class="odd">
<td align="left">Hospital C</td>
<td align="right">57.8%</td>
<td align="right">30.1%</td>
<td align="right">54.9%</td>
<td align="right">25.2%</td>
</tr>
<tr class="even">
<td align="left">Hospital D</td>
<td align="right">55.1%</td>
<td align="right">26.3%</td>
<td align="right">54.8%</td>
<td align="right">26.7%</td>
</tr>
</tbody>
</table>
@ -1402,18 +1410,16 @@ classes) <code>&lt;mic&gt;</code> and <code>&lt;disk&gt;</code>:</p>
<code class="sourceCode R"><span><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>
<span><span class="va">mic_values</span></span>
<span><span class="co"># Class 'mic'</span></span>
<span><span class="co"># [1] 8 0.01 0.025 32 0.01 16 32 &gt;=256 0.125 </span></span>
<span><span class="co"># [10] 128 0.5 0.125 128 0.005 4 2 0.01 0.0625 </span></span>
<span><span class="co"># [19] 0.025 4 &lt;=0.001 0.025 0.002 0.125 0.0625 0.0625 0.01 </span></span>
<span><span class="co"># [28] 0.025 &lt;=0.001 16 8 0.005 0.0625 2 2 0.002 </span></span>
<span><span class="co"># [37] 0.0625 64 0.025 0.005 0.125 0.002 2 16 0.005 </span></span>
<span><span class="co"># [46] 4 16 &gt;=256 0.25 64 128 1 8 0.0625 </span></span>
<span><span class="co"># [55] 4 0.002 32 0.0625 8 128 0.0625 64 0.0625 </span></span>
<span><span class="co"># [64] 8 0.125 1 &lt;=0.001 128 0.002 8 1 0.002 </span></span>
<span><span class="co"># [73] 0.002 64 0.125 0.005 0.5 8 0.025 0.125 0.005 </span></span>
<span><span class="co"># [82] 0.005 0.002 &lt;=0.001 0.0625 2 0.125 2 0.25 64 </span></span>
<span><span class="co"># [91] 0.25 4 &lt;=0.001 0.125 0.005 0.5 4 0.0625 64 </span></span>
<span><span class="co"># [100] 2</span></span></code></pre></div>
<span><span class="co"># [1] 8 64 2 1 0.002 128 0.01 0.25 2 0.125 </span></span>
<span><span class="co"># [11] 16 0.01 256 4 64 2 0.002 256 0.01 8 </span></span>
<span><span class="co"># [21] 0.025 0.025 16 0.025 8 1 128 0.125 4 0.001 </span></span>
<span><span class="co"># [31] 4 256 4 1 0.01 0.025 1 0.001 0.002 2 </span></span>
<span><span class="co"># [41] 0.001 2 0.01 128 0.01 1 16 0.5 64 0.0625</span></span>
<span><span class="co"># [51] 8 0.005 16 32 128 4 0.01 32 0.025 0.005 </span></span>
<span><span class="co"># [61] 32 0.01 0.125 256 32 16 8 0.025 4 1 </span></span>
<span><span class="co"># [71] 16 16 0.125 0.002 16 32 0.5 0.0625 256 2 </span></span>
<span><span class="co"># [81] 0.005 0.01 1 0.005 0.125 0.0625 0.001 0.025 4 0.01 </span></span>
<span><span class="co"># [91] 2 1 0.025 256 0.0625 0.001 0.125 0.005 0.0625 0.001</span></span></code></pre></div>
<div class="sourceCode" id="cb36"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># base R:</span></span>
<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></span></code></pre></div>
@ -1447,10 +1453,10 @@ plotting:</p>
<code class="sourceCode R"><span><span class="va">disk_values</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/random.html">random_disk</a></span><span class="op">(</span>size <span class="op">=</span> <span class="fl">100</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></span>
<span><span class="va">disk_values</span></span>
<span><span class="co"># Class 'disk'</span></span>
<span><span class="co"># [1] 31 26 24 18 17 18 27 18 28 19 17 23 30 18 22 25 28 27 19 21 27 31 27 20 31</span></span>
<span><span class="co"># [26] 20 18 24 17 17 30 18 24 25 29 29 17 25 18 18 17 31 20 29 30 18 24 29 23 27</span></span>
<span><span class="co"># [51] 17 19 29 17 29 24 22 17 19 19 28 25 25 25 31 30 30 23 28 29 27 20 18 31 28</span></span>
<span><span class="co"># [76] 24 30 22 27 20 20 28 23 31 25 19 30 20 19 19 21 28 27 19 31 21 28 30 17 18</span></span></code></pre></div>
<span><span class="co"># [1] 31 26 18 31 23 20 17 17 28 29 27 20 23 19 19 24 23 29 20 17 24 26 31 21 20</span></span>
<span><span class="co"># [26] 26 19 20 18 31 18 17 31 19 26 20 19 27 20 22 17 25 24 29 19 24 28 25 20 22</span></span>
<span><span class="co"># [51] 30 23 18 28 29 22 18 23 30 18 18 22 24 29 26 23 31 31 21 20 31 21 26 23 25</span></span>
<span><span class="co"># [76] 23 26 25 29 22 26 18 23 29 26 31 25 17 30 23 21 28 31 26 30 29 29 25 28 27</span></span></code></pre></div>
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># base R:</span></span>
<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></span></code></pre></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -375,17 +375,17 @@ names or codes, this would have worked exactly the same way:</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><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">my_TB_data</span><span class="op">)</span></span>
<span><span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span></span>
<span><span class="co"># 1 I R R S R I</span></span>
<span><span class="co"># 2 R R S S I R</span></span>
<span><span class="co"># 3 R S I I R S</span></span>
<span><span class="co"># 4 S S I I R R</span></span>
<span><span class="co"># 5 I R S R I R</span></span>
<span><span class="co"># 6 R I I I S I</span></span>
<span><span class="co"># 1 R R S I R I</span></span>
<span><span class="co"># 2 S I I R I I</span></span>
<span><span class="co"># 3 I R S R R I</span></span>
<span><span class="co"># 4 R R R R R S</span></span>
<span><span class="co"># 5 R I I I I R</span></span>
<span><span class="co"># 6 S S S I S S</span></span>
<span><span class="co"># kanamycin</span></span>
<span><span class="co"># 1 S</span></span>
<span><span class="co"># 1 R</span></span>
<span><span class="co"># 2 R</span></span>
<span><span class="co"># 3 S</span></span>
<span><span class="co"># 4 I</span></span>
<span><span class="co"># 4 S</span></span>
<span><span class="co"># 5 I</span></span>
<span><span class="co"># 6 I</span></span></code></pre></div>
<p>We can now add the interpretation of MDR-TB to our data set. You can
@ -428,40 +428,40 @@ Unique: 5</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Mono-resistant</td>
<td align="right">3140</td>
<td align="right">62.80%</td>
<td align="right">3140</td>
<td align="right">62.80%</td>
<td align="right">3210</td>
<td align="right">64.20%</td>
<td align="right">3210</td>
<td align="right">64.20%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Negative</td>
<td align="right">1047</td>
<td align="right">20.94%</td>
<td align="right">4187</td>
<td align="right">83.74%</td>
<td align="right">1010</td>
<td align="right">20.20%</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">456</td>
<td align="right">9.12%</td>
<td align="right">4643</td>
<td align="right">92.86%</td>
<td align="right">451</td>
<td align="right">9.02%</td>
<td align="right">4671</td>
<td align="right">93.42%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Poly-resistant</td>
<td align="right">254</td>
<td align="right">5.08%</td>
<td align="right">4897</td>
<td align="right">97.94%</td>
<td align="right">235</td>
<td align="right">4.70%</td>
<td align="right">4906</td>
<td align="right">98.12%</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="left">Extensively drug-resistant</td>
<td align="right">103</td>
<td align="right">2.06%</td>
<td align="right">94</td>
<td align="right">1.88%</td>
<td align="right">5000</td>
<td align="right">100.00%</td>
</tr>

View File

@ -168,7 +168,7 @@
<h4 data-toc-skip class="author">Dr. Matthijs
Berends</h4>
<h4 data-toc-skip class="date">28 November 2022</h4>
<h4 data-toc-skip class="date">29 November 2022</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/vignettes/SPSS.Rmd" class="external-link"><code>vignettes/SPSS.Rmd</code></a></small>
<div class="d-none name"><code>SPSS.Rmd</code></div>

View File

@ -166,7 +166,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.svg" class="logo" alt=""><h1>Data sets for download / own use</h1>
<h4 data-toc-skip class="date">28 November 2022</h4>
<h4 data-toc-skip class="date">29 November 2022</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small>
<div class="d-none name"><code>datasets.Rmd</code></div>

View File

@ -11,7 +11,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2022-11-28T18:44Z
last_built: 2022-11-29T18:41Z
urls:
reference: https://msberends.github.io/AMR/reference
article: https://msberends.github.io/AMR/articles

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -195,16 +195,16 @@
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">df</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> birth_date age age_exact age_at_y2k</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 1945-01-28 77 77.83288 54</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1998-08-27 24 24.25479 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1937-06-29 85 85.41644 62</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1946-11-17 76 76.03014 53</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1963-03-27 59 59.67397 36</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1952-04-02 70 70.65753 47</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1948-07-15 74 74.37260 51</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1933-10-22 89 89.10137 66</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1949-08-07 73 73.30959 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1959-08-15 63 63.28767 40</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 1944-12-30 77 77.91507 55</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1946-04-06 76 76.64932 53</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1933-09-07 89 89.22740 66</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1992-05-18 30 30.53425 7</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1970-02-25 52 52.75890 29</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1944-11-05 78 78.06575 55</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1950-02-10 72 72.80000 49</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1995-05-07 27 27.56438 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1998-09-17 24 24.20000 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1969-01-26 53 53.84110 30</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -506,16 +506,16 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 50 × 12</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> datetime index ab_input ab_gu…¹ mo_in…² mo_guideline guide…³</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dttm&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;ab&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 2022-11-28 <span style="color: #949494;">18:44:52</span> 1 ampicillin AMP Strep … B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2022-11-28 <span style="color: #949494;">18:44:52</span> 1 AMP AMP Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2022-11-28 <span style="color: #949494;">18:44:53</span> 1 CIP CIP Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2022-11-28 <span style="color: #949494;">18:44:53</span> 1 GEN GEN Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2022-11-28 <span style="color: #949494;">18:44:53</span> 1 TOB TOB Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2022-11-28 <span style="color: #949494;">18:44:54</span> 1 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2022-11-28 <span style="color: #949494;">18:44:55</span> 1 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2022-11-28 <span style="color: #949494;">18:44:55</span> 2 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2022-11-28 <span style="color: #949494;">18:44:55</span> 3 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2022-11-28 <span style="color: #949494;">18:44:55</span> 4 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 2022-11-29 <span style="color: #949494;">18:42:02</span> 1 ampicillin AMP Strep … B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2022-11-29 <span style="color: #949494;">18:42:03</span> 1 AMP AMP Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2022-11-29 <span style="color: #949494;">18:42:03</span> 1 CIP CIP Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2022-11-29 <span style="color: #949494;">18:42:03</span> 1 GEN GEN Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2022-11-29 <span style="color: #949494;">18:42:04</span> 1 TOB TOB Escher… B_[ORD]_ENTRBCTR EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2022-11-29 <span style="color: #949494;">18:42:05</span> 1 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2022-11-29 <span style="color: #949494;">18:42:05</span> 1 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2022-11-29 <span style="color: #949494;">18:42:05</span> 2 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2022-11-29 <span style="color: #949494;">18:42:05</span> 3 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2022-11-29 <span style="color: #949494;">18:42:05</span> 4 AMX AMX B_STRP… B_STRPT_PNMN EUCAST…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># … with 40 more rows, 5 more variables: ref_table &lt;chr&gt;, method &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># input &lt;dbl&gt;, outcome &lt;rsi&gt;, breakpoint_S_R &lt;chr&gt;, and abbreviated variable</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># names ¹ab_guideline, ²mo_input, ³guideline</span></span>

View File

@ -182,45 +182,40 @@
<span class="r-in"><span><span class="va">df</span> <span class="op">&lt;-</span> <span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/seq.html" class="external-link">seq_len</a></span><span class="op">(</span><span class="fl">2000</span><span class="op">)</span>, size <span class="op">=</span> <span class="fl">200</span><span class="op">)</span>, <span class="op">]</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="fu">get_episode</span><span class="op">(</span><span class="va">df</span><span class="op">$</span><span class="va">date</span>, episode_days <span class="op">=</span> <span class="fl">60</span><span class="op">)</span> <span class="co"># indices</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 3 60 40 53 59 20 23 5 19 39 19 12 16 54 9 20 31 7 12 2 46 44 4 44 56</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [26] 15 58 25 39 43 9 12 35 8 18 37 58 5 46 4 17 47 10 26 11 7 34 31 11 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [51] 23 49 8 46 26 55 25 54 26 55 28 29 35 27 38 36 3 54 41 60 13 48 52 59 24</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [76] 6 6 14 15 15 1 26 19 10 62 51 10 24 16 49 22 2 25 58 12 48 19 59 34 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [101] 59 51 49 61 36 53 52 23 38 10 57 49 51 58 58 45 50 59 30 52 6 51 20 1 3</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [126] 33 38 6 14 45 42 16 54 47 4 50 22 37 59 28 40 9 43 19 61 17 51 32 54 24</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [151] 59 23 42 50 12 43 44 59 8 60 10 12 7 43 3 11 30 3 39 56 8 28 5 3 47</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [176] 54 3 16 16 9 5 43 33 58 61 21 12 10 23 59 43 29 56 59 26 10 29 15 12 32</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 53 62 32 61 13 24 5 35 42 38 15 9 6 4 24 17 13 61 29 35 46 18 27 5 29</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [26] 15 43 28 19 12 13 32 59 8 32 6 20 2 5 23 21 32 43 45 32 56 37 48 38 29</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [51] 13 18 53 7 48 52 24 7 36 52 60 6 32 29 31 5 21 12 58 15 44 31 25 8 41</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [76] 29 8 44 32 56 11 44 9 32 39 31 13 60 30 33 17 49 10 47 8 19 19 11 7 46</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [101] 31 15 47 3 25 30 61 36 1 22 55 23 20 60 60 44 63 36 46 58 58 26 51 12 41</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [126] 13 11 7 2 63 12 23 18 45 26 51 46 54 32 21 11 1 59 9 53 59 62 59 47 8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [151] 54 10 15 56 39 36 50 38 40 57 42 22 31 34 14 49 34 4 26 29 63 59 62 31 8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [176] 4 63 33 28 40 40 3 32 4 58 13 11 16 5 58 29 1 46 38 61 59 7 51 34 27</span>
<span class="r-in"><span><span class="fu">is_new_episode</span><span class="op">(</span><span class="va">df</span><span class="op">$</span><span class="va">date</span>, episode_days <span class="op">=</span> <span class="fl">60</span><span class="op">)</span> <span class="co"># TRUE/FALSE</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [37] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [49] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [61] TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [73] FALSE FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [85] TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [97] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [109] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [121] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [133] FALSE TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [145] TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [157] TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [169] FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [181] FALSE TRUE FALSE FALSE FALSE TRUE FALSE TRUE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [193] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] FALSE FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [37] FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [49] FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [61] FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [73] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [85] TRUE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [97] TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [109] TRUE FALSE TRUE TRUE TRUE FALSE TRUE FALSE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [121] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [133] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [145] TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [157] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [169] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [181] TRUE TRUE TRUE TRUE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [193] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># filter on results from the third 60-day episode only, using base R</span></span></span>
<span class="r-in"><span><span class="va">df</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/which.html" class="external-link">which</a></span><span class="op">(</span><span class="fu">get_episode</span><span class="op">(</span><span class="va">df</span><span class="op">$</span><span class="va">date</span>, <span class="fl">60</span><span class="op">)</span> <span class="op">==</span> <span class="fl">3</span><span class="op">)</span>, <span class="op">]</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 7 × 46</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> date patient age gender ward mo PEN OXA FLC AMX </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;date&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 2002-07-30 218912 76 F ICU B_ESCHR_COLI R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2002-09-08 B8CB09 60 F Outpatie… B_STPHY_CONS S NA S NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> 2002-08-19 A49852 70 M Clinical B_ESCHR_COLI R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> 2002-07-23 F35553 51 M ICU B_STPHY_AURS R NA S R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> 2002-07-15 426426 67 F ICU B_ESCHR_COLI R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">6</span> 2002-08-31 149442 80 F ICU B_STPHY_AURS R NA S R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">7</span> 2002-07-21 955940 82 F Clinical B_PSDMN_AERG R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2 × 46</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> date patient age gender ward mo PEN OXA FLC AMX </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;date&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span> <span style="color: #949494; font-style: italic;">&lt;rsi&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 2002-06-22 FD8039 75 F ICU B_ESCHR_COLI R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2002-06-18 012595 30 M ICU B_CRYNB I NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># … with 36 more variables: AMC &lt;rsi&gt;, AMP &lt;rsi&gt;, TZP &lt;rsi&gt;, CZO &lt;rsi&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># FEP &lt;rsi&gt;, CXM &lt;rsi&gt;, FOX &lt;rsi&gt;, CTX &lt;rsi&gt;, CAZ &lt;rsi&gt;, CRO &lt;rsi&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># GEN &lt;rsi&gt;, TOB &lt;rsi&gt;, AMK &lt;rsi&gt;, KAN &lt;rsi&gt;, TMP &lt;rsi&gt;, SXT &lt;rsi&gt;,</span></span>
@ -256,16 +251,16 @@
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: condition [3]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> patient date condition new_episode</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;date&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 218912 2002-07-30 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> C72224 2017-08-09 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 207804 2012-10-04 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 329C35 2016-04-03 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 647993 2017-05-16 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> E19253 2006-08-22 C FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> F37316 2007-07-07 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 151041 2003-01-31 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> C34072 2006-07-05 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> C2846C 2012-06-29 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> F76601 2015-09-20 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> D20588 2017-08-17 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 48BB05 2010-03-15 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 871020 2017-07-20 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 554965 2005-08-29 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 451990 2008-03-22 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> E44854 2003-03-22 C FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> D91230 2010-12-06 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 743093 2012-09-14 C FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> BC9909 2011-07-08 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># … with 190 more rows</span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">df</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
@ -277,19 +272,19 @@
<span class="r-in"><span> <span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 200 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: ward, patient [184]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward date patient new_index new_logical</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;date&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> ICU 2002-07-30 218912 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> Clinical 2017-08-09 C72224 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> Clinical 2012-10-04 207804 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> Clinical 2016-04-03 329C35 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> Clinical 2017-05-16 647993 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> Clinical 2006-08-22 E19253 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> ICU 2007-07-07 F37316 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> Clinical 2003-01-31 151041 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> Clinical 2006-07-05 C34072 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> ICU 2012-06-29 C2846C 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: ward, patient [182]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward date patient new_index new_logical</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;date&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> ICU 2015-09-20 F76601 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> ICU 2017-08-17 D20588 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> Clinical 2010-03-15 48BB05 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> Clinical 2017-07-20 871020 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> Clinical 2005-08-29 554965 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> Clinical 2008-03-22 451990 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> ICU 2003-03-22 E44854 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> Clinical 2010-12-06 D91230 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> Outpatient 2012-09-14 743093 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> Clinical 2011-07-08 BC9909 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># … with 190 more rows</span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">df</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
@ -304,9 +299,9 @@
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 3 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward n_patients n_episodes_365 n_episodes_60 n_episodes_30</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clinical 112 14 54 72</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 62 14 34 43</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 10 6 9 10</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clinical 112 15 51 70</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 61 13 37 43</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 9 6 9 9</span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="co"># grouping on patients and microorganisms leads to the same</span></span></span>
@ -336,19 +331,19 @@
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_data.html" class="external-link">group_vars</a></span><span class="op">(</span><span class="va">.</span><span class="op">)</span>, <span class="va">flag_episode</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 200 × 4</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: patient, mo, ward [189]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> patient mo ward flag_episode</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 218912 B_ESCHR_COLI ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> C72224 B_STRPT_AGLC Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 207804 B_STRPT_PNMN Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 329C35 B_ESCHR_COLI Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 647993 B_STPHY_AURS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> E19253 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> F37316 B_STRPT_PNMN ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 151041 B_ESCHR_COLI Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> C34072 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> C2846C B_ESCHR_COLI ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: patient, mo, ward [188]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> patient mo ward flag_episode</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> F76601 B_ESCHR_COLI ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> D20588 B_STPHY_HMNS ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 48BB05 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 871020 B_STPHY_EPDR Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 554965 B_STPHY_AURS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 451990 B_ESCHR_COLI Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> E44854 B_STRPT_PNMN ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> D91230 B_STPHY_EPDR Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 743093 B_ENTRBC_CLOC Outpatient TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> BC9909 B_ENTRBC_CLOC Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># … with 190 more rows</span></span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>

View File

@ -172,9 +172,9 @@
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">kurtosis</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">10000</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 2.94123</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 3.060168</span>
<span class="r-in"><span><span class="fu">kurtosis</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">10000</span><span class="op">)</span>, excess <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.05912825</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.01364338</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -200,10 +200,10 @@
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="random.html">random_mic</a></span><span class="op">(</span><span class="fl">10</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">x</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 64 1 8 0.025 0.002 0.005 0.0625 16 0.01 32 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.5 32 1 4 256 64 4 0.002 0.025 0.5 </span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">x</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.3091844 0.2558741 0.7825293 -0.6783995 -1.3180848 -1.0860180</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.4463328 0.9580810 -0.9104663 1.1336327</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.3241709 0.8396588 -0.1301993 0.2577439 1.4215736 1.0336304</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 0.2577439 -1.8693070 -1.1625023 -0.3241709</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">y</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span></span>
<span class="r-in"><span> id <span class="op">=</span> <span class="va">LETTERS</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">10</span><span class="op">]</span>,</span></span>
@ -213,38 +213,38 @@
<span class="r-in"><span> tobr <span class="op">=</span> <span class="fu"><a href="random.html">random_mic</a></span><span class="op">(</span><span class="fl">10</span>, ab <span class="op">=</span> <span class="st">"tobr"</span>, mo <span class="op">=</span> <span class="st">"Escherichia coli"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">y</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A 8 0.025 1 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B &lt;=4 0.125 0.5 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C &lt;=4 &gt;=1 4 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D &lt;=4 0.125 1 &gt;=8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E &gt;=16 &gt;=1 2 0.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F &gt;=16 0.025 1 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G &lt;=4 0.25 4 0.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H &gt;=16 0.125 0.5 &gt;=8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I 8 0.5 0.5 &gt;=8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J &lt;=4 0.25 1 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A 4 &lt;=0.125 &lt;=0.5 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B 4 0.25 1 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C 32 0.25 1 8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D 2 &lt;=0.125 &lt;=0.5 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E 8 &lt;=0.125 8 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F 32 0.25 2 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G 8 0.5 1 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H 2 &gt;=1 8 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I 32 &lt;=0.125 4 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J 16 0.25 2 2</span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">y</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Calculating mean AMR distance based on columns "amox", "cipr", "gent",</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> "id" and "tobr"</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>NAs introduced by coercion</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.55426393 -0.42949279 0.62941387 -0.05490015 0.49015830 -0.12782528</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.09926391 0.26899945 0.26246847 -0.38529402</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.51912782 -0.09831951 0.63538430 -1.20290099 -0.21181627 0.27774576</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 0.04628481 0.49245479 0.45927606 0.12101887</span>
<span class="r-in"><span><span class="va">y</span><span class="op">$</span><span class="va">amr_distance</span> <span class="op">&lt;-</span> <span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">y</span>, <span class="fu">where</span><span class="op">(</span><span class="va">is.mic</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Calculating mean AMR distance based on columns "amox", "cipr", "gent" and</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> "tobr"</span>
<span class="r-in"><span><span class="va">y</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">y</span><span class="op">$</span><span class="va">amr_distance</span><span class="op">)</span>, <span class="op">]</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr amr_distance</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A 8 0.025 1 1 -0.55426393</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B &lt;=4 0.125 0.5 4 -0.42949279</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J &lt;=4 0.25 1 1 -0.38529402</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F &gt;=16 0.025 1 2 -0.12782528</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G &lt;=4 0.25 4 0.5 -0.09926391</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D &lt;=4 0.125 1 &gt;=8 -0.05490015</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I 8 0.5 0.5 &gt;=8 0.26246847</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H &gt;=16 0.125 0.5 &gt;=8 0.26899945</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E &gt;=16 &gt;=1 2 0.5 0.49015830</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C &lt;=4 &gt;=1 4 4 0.62941387</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr amr_distance</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D 2 &lt;=0.125 &lt;=0.5 1 -1.20290099</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A 4 &lt;=0.125 &lt;=0.5 4 -0.51912782</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E 8 &lt;=0.125 8 1 -0.21181627</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B 4 0.25 1 4 -0.09831951</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G 8 0.5 1 2 0.04628481</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J 16 0.25 2 2 0.12101887</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F 32 0.25 2 2 0.27774576</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I 32 &lt;=0.125 4 4 0.45927606</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H 2 &gt;=1 8 2 0.49245479</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C 32 0.25 1 8 0.63538430</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">y</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
@ -256,17 +256,17 @@
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Calculating mean AMR distance based on columns "amox", "cipr", "gent" and</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> "tobr"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr amr_distance check_id_C</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 C &lt;=4 &gt;=1 4 4 0.62941387 0.0000000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 E &gt;=16 &gt;=1 2 0.5 0.49015830 0.1392556</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 H &gt;=16 0.125 0.5 &gt;=8 0.26899945 0.3604144</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 I 8 0.5 0.5 &gt;=8 0.26246847 0.3669454</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 D &lt;=4 0.125 1 &gt;=8 -0.05490015 0.6843140</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 G &lt;=4 0.25 4 0.5 -0.09926391 0.7286778</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 F &gt;=16 0.025 1 2 -0.12782528 0.7572391</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 J &lt;=4 0.25 1 1 -0.38529402 1.0147079</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 B &lt;=4 0.125 0.5 4 -0.42949279 1.0589067</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 A 8 0.025 1 1 -0.55426393 1.1836778</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr amr_distance check_id_C</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 C 32 0.25 1 8 0.63538430 0.0000000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 H 2 &gt;=1 8 2 0.49245479 0.1429295</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 I 32 &lt;=0.125 4 4 0.45927606 0.1761082</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 F 32 0.25 2 2 0.27774576 0.3576385</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 J 16 0.25 2 2 0.12101887 0.5143654</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 G 8 0.5 1 2 0.04628481 0.5890995</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 B 4 0.25 1 4 -0.09831951 0.7337038</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 E 8 &lt;=0.125 8 1 -0.21181627 0.8472006</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 A 4 &lt;=0.125 &lt;=0.5 4 -0.51912782 1.1545121</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 D 2 &lt;=0.125 &lt;=0.5 1 -1.20290099 1.8382853</span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="co"># support for groups</span></span></span>
<span class="r-in"><span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -183,42 +183,42 @@
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">random_mic</span><span class="op">(</span><span class="fl">25</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 2 64 0.25 2 1 2 0.125 4 0.25 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [10] 1 0.025 &lt;=0.002 0.25 64 0.0625 0.005 0.01 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [19] 8 1 2 0.025 &lt;=0.002 &gt;=256 0.25 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 32 4 0.001 8 2 0.025 4 128 128 0.5 0.025 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] 0.025 16 64 1 64 8 0.125 128 0.25 &gt;=256 2 0.025</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] 16 </span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 30 26 41 36 23 42 33 16 10 41 21 24 39 49 34 47 32 44 20 33 41 48 15 9 6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 29 13 31 34 33 32 7 8 18 32 46 16 14 41 10 26 10 45 41 39 40 13 18 13 35</span>
<span class="r-in"><span><span class="fu">random_rsi</span><span class="op">(</span><span class="fl">25</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'rsi'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] S S S I S I R I S I R I I R R I S S I S I I I I S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] S I R S I R S R I R S R S I I I I I R R R R S I I</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># \donttest{</span></span></span>
<span class="r-in"><span><span class="co"># make the random generation more realistic by setting a bug and/or drug:</span></span></span>
<span class="r-in"><span><span class="fu">random_mic</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span><span class="op">)</span> <span class="co"># range 0.0625-64</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.125 0.25 0.025 16 0.005 0.125 0.5 0.0625 4 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [11] 16 1 2 1 0.01 0.005 0.125 0.002 0.01 0.25 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [21] 0.5 0.002 0.0625 &gt;=32 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 32 128 0.025 0.125 1 64 0.5 16 0.025 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [10] 0.25 0.25 0.25 0.25 0.0625 &lt;=0.001 0.005 0.25 0.0625 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [19] 0.0625 0.025 &lt;=0.001 16 2 32 0.0625 </span>
<span class="r-in"><span><span class="fu">random_mic</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span>, <span class="st">"meropenem"</span><span class="op">)</span> <span class="co"># range 0.0625-16</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 2 2 1 &gt;=16 2 &gt;=16 2 4 8 2 2 8 2 2 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [16] &gt;=16 &gt;=16 4 2 2 1 2 4 &gt;=16 2 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.5 1 8 2 2 16 8 8 16 0.5 4 8 4 8 0.5 2 16 0.5 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [20] 8 0.5 16 2 8 0.5</span>
<span class="r-in"><span><span class="fu">random_mic</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Streptococcus pneumoniae"</span>, <span class="st">"meropenem"</span><span class="op">)</span> <span class="co"># range 0.0625-4</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.25 0.5 8 0.0625 1 0.5 &lt;=0.025 0.125 &lt;=0.025</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [10] 4 0.0625 0.25 0.0625 &lt;=0.025 0.25 0.0625 1 0.125 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [19] 2 &lt;=0.025 2 0.25 8 1 0.125 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.125 0.0625 0.125 0.25 2 0.25 0.0625 2 0.125 0.125 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [11] 0.125 &gt;=4 &gt;=4 0.5 0.125 &gt;=4 0.25 0.125 1 0.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [21] 0.0625 1 &gt;=4 0.0625 &gt;=4 </span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span><span class="op">)</span> <span class="co"># range 8-50</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 16 50 45 44 44 18 37 24 21 47 26 16 15 43 43 15 40 35 30 15 21 41 8 29 15</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 17 36 40 30 8 48 50 21 28 8 12 20 34 17 20 47 46 49 25 20 47 42 36 25 47</span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span>, <span class="st">"ampicillin"</span><span class="op">)</span> <span class="co"># range 11-17</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 15 11 14 15 11 16 16 14 17 13 14 11 16 12 14 12 17 12 15 11 14 11 14 13 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 12 14 14 13 14 14 17 14 14 14 12 17 13 11 14 11 13 11 14 13 11 12 16 14 14</span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Streptococcus pneumoniae"</span>, <span class="st">"ampicillin"</span><span class="op">)</span> <span class="co"># range 12-27</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 21 16 18 21 25 26 19 21 26 17 18 15 24 15 18 20 17 24 17 19 26 18 17 16 15</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 23 23 16 26 18 20 22 15 18 19 27 15 16 21 21 21 25 23 22 18 17 17 25 18 16</span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>
</div>

View File

@ -171,7 +171,7 @@ When negative ('left-skewed'): the left tail is longer; the mass of the distribu
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">skewness</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Uniform.html" class="external-link">runif</a></span><span class="op">(</span><span class="fl">1000</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.01809232</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.0009022991</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

File diff suppressed because one or more lines are too long