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

Built site for AMR: 1.8.2.9096@af139a3

This commit is contained in:
github-actions 2023-01-21 23:00:34 +00:00
parent e289d2568d
commit a7dcf5719c
35 changed files with 445 additions and 445 deletions

View File

@ -380,12 +380,12 @@ data set:</p>
<col width="13%">
<col width="13%">
<col width="13%">
<col width="26%">
<col width="28%">
<col width="5%">
<col width="5%">
<col width="5%">
<col width="5%">
<col width="9%">
<col width="8%">
</colgroup>
<thead><tr class="header">
<th align="center">date</th>
@ -400,70 +400,70 @@ data set:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2011-09-07</td>
<td align="center">C1</td>
<td align="center">2013-10-31</td>
<td align="center">J1</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2010-06-25</td>
<td align="center">F2</td>
<td align="center">2014-11-26</td>
<td align="center">I8</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">Staphylococcus aureus</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2011-12-31</td>
<td align="center">A5</td>
<td align="center">Hospital D</td>
<td align="center">2015-03-23</td>
<td align="center">L5</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2013-12-18</td>
<td align="center">H2</td>
<td align="center">2013-01-05</td>
<td align="center">Q3</td>
<td align="center">Hospital C</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2014-05-11</td>
<td align="center">S9</td>
<td align="center">2017-12-24</td>
<td align="center">E9</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">I</td>
<td align="center">S</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">M</td>
</tr>
<tr class="even">
<td align="center">2011-02-06</td>
<td align="center">S9</td>
<td align="center">2017-04-23</td>
<td align="center">E8</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">I</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">R</td>
<td align="center">M</td>
</tr>
</tbody>
</table>
@ -499,16 +499,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,446</td>
<td align="right">52.23%</td>
<td align="right">10,446</td>
<td align="right">52.23%</td>
<td align="right">10,481</td>
<td align="right">52.41%</td>
<td align="right">10,481</td>
<td align="right">52.41%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,554</td>
<td align="right">47.77%</td>
<td align="right">9,519</td>
<td align="right">47.60%</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 12,360 'phenotype-based' first isolates (61.8% of total where a</span></span>
<span><span class="co"># =&gt; Found 12,319 'phenotype-based' first isolates (61.6% of total where a</span></span>
<span><span class="co"># microbial ID was available)</span></span></code></pre></div>
<p>So only 61.8% is suitable for resistance analysis! We can now filter
<p>So only 61.6% 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,25 +634,25 @@ 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 12,360 isolates for analysis. Now our data looks
<p>So we end up with 12,319 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%">
<col width="11%">
<col width="4%">
<col width="4%">
<col width="4%">
<col width="4%">
<col width="6%">
<col width="12%">
<col width="10%">
<col width="7%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="6%">
<col width="11%">
<col width="12%">
<col width="9%">
<col width="5%">
</colgroup>
<thead><tr class="header">
@ -673,15 +673,15 @@ like:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="left">2</td>
<td align="center">2010-06-25</td>
<td align="center">F2</td>
<td align="left">1</td>
<td align="center">2013-10-31</td>
<td align="center">J1</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">R</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
@ -689,79 +689,79 @@ like:</p>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">3</td>
<td align="center">2011-12-31</td>
<td align="center">A5</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COLI</td>
<td align="left">2</td>
<td align="center">2014-11-26</td>
<td align="center">I8</td>
<td align="center">Hospital A</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</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">4</td>
<td align="center">2013-01-05</td>
<td align="center">Q3</td>
<td align="center">Hospital C</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">I</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">5</td>
<td align="center">2017-12-24</td>
<td align="center">E9</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">I</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">2014-12-06</td>
<td align="center">Q7</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="center">2014-05-11</td>
<td align="center">S9</td>
<tr class="even">
<td align="left">10</td>
<td align="center">2014-08-11</td>
<td align="center">X6</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">6</td>
<td align="center">2011-02-06</td>
<td align="center">S9</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">I</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">8</td>
<td align="center">2014-02-12</td>
<td align="center">E6</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">9</td>
<td align="center">2015-08-18</td>
<td align="center">Q1</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
@ -801,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: 12,360<br>
Available: 12,360 (100%, NA: 0 = 0%)<br>
Length: 12,319<br>
Available: 12,319 (100%, NA: 0 = 0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -827,33 +827,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">5,843</td>
<td align="right">47.27%</td>
<td align="right">5,843</td>
<td align="right">47.27%</td>
<td align="right">5,888</td>
<td align="right">47.80%</td>
<td align="right">5,888</td>
<td align="right">47.80%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,316</td>
<td align="right">26.83%</td>
<td align="right">9,159</td>
<td align="right">74.10%</td>
<td align="right">3,213</td>
<td align="right">26.08%</td>
<td align="right">9,101</td>
<td align="right">73.88%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">1,866</td>
<td align="right">15.10%</td>
<td align="right">11,025</td>
<td align="right">1,887</td>
<td align="right">15.32%</td>
<td align="right">10,988</td>
<td align="right">89.20%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,335</td>
<td align="right">1,331</td>
<td align="right">10.80%</td>
<td align="right">12,360</td>
<td align="right">12,319</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -902,13 +902,28 @@ antibiotic class they are in:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2014-05-11</td>
<td align="center">S9</td>
<td align="center">2014-11-26</td>
<td align="center">I8</td>
<td align="center">Hospital A</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2014-08-11</td>
<td align="center">X6</td>
<td align="center">Hospital B</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">I</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
@ -916,13 +931,28 @@ antibiotic class they are in:</p>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2017-09-06</td>
<td align="center">N1</td>
<tr class="odd">
<td align="center">2015-06-18</td>
<td align="center">D8</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">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">2017-10-11</td>
<td align="center">L2</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">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
@ -932,65 +962,35 @@ antibiotic class they are in:</p>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2014-10-21</td>
<td align="center">U6</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">2011-02-28</td>
<td align="center">B10</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2016-07-17</td>
<td align="center">T2</td>
<td align="center">Hospital A</td>
<td align="center">2012-10-28</td>
<td align="center">L6</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">F</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="center">2014-09-22</td>
<td align="center">F8</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2014-04-21</td>
<td align="center">E7</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>If you want to get a quick glance of the number of isolates in
@ -1013,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">1469</td>
<td align="center">1254</td>
<td align="center">3120</td>
<td align="center">5843</td>
<td align="center">1515</td>
<td align="center">1214</td>
<td align="center">3159</td>
<td align="center">5888</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">AMC</td>
<td align="center">2702</td>
<td align="center">1194</td>
<td align="center">1947</td>
<td align="center">5843</td>
<td align="center">2728</td>
<td align="center">1171</td>
<td align="center">1989</td>
<td align="center">5888</td>
</tr>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">CIP</td>
<td align="center">1973</td>
<td align="center">1812</td>
<td align="center">2058</td>
<td align="center">5843</td>
<td align="center">1970</td>
<td align="center">1842</td>
<td align="center">2076</td>
<td align="center">5888</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">2020</td>
<td align="center">1806</td>
<td align="center">2017</td>
<td align="center">5843</td>
<td align="center">2001</td>
<td align="center">1793</td>
<td align="center">2094</td>
<td align="center">5888</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">1335</td>
<td align="center">1335</td>
<td align="center">1331</td>
<td align="center">1331</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">AMC</td>
<td align="center">599</td>
<td align="center">293</td>
<td align="center">443</td>
<td align="center">1335</td>
<td align="center">593</td>
<td align="center">289</td>
<td align="center">449</td>
<td align="center">1331</td>
</tr>
</tbody>
</table>
@ -1078,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">2020</td>
<td align="center">1806</td>
<td align="center">2017</td>
<td align="center">5843</td>
<td align="center">2001</td>
<td align="center">1793</td>
<td align="center">2094</td>
<td align="center">5888</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">GEN</td>
<td align="center">471</td>
<td align="center">430</td>
<td align="center">434</td>
<td align="center">1335</td>
<td align="center">400</td>
<td align="center">460</td>
<td align="center">1331</td>
</tr>
<tr class="odd">
<td align="center">S. aureus</td>
<td align="center">GEN</td>
<td align="center">1109</td>
<td align="center">1086</td>
<td align="center">1121</td>
<td align="center">3316</td>
<td align="center">1094</td>
<td align="center">982</td>
<td align="center">1137</td>
<td align="center">3213</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">1866</td>
<td align="center">1866</td>
<td align="center">1887</td>
<td align="center">1887</td>
</tr>
</tbody>
</table>
@ -1137,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.5817152</span></span></code></pre></div>
<span><span class="co"># [1] 0.5826772</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">
@ -1152,19 +1152,19 @@ own:</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5845627</td>
<td align="center">0.5808320</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5830477</td>
<td align="center">0.5845366</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5790359</td>
<td align="center">0.5761047</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5767790</td>
<td align="center">0.5873016</td>
</tr>
</tbody>
</table>
@ -1189,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.5845627</td>
<td align="center">3796</td>
<td align="center">0.5808320</td>
<td align="center">3798</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5830477</td>
<td align="center">4377</td>
<td align="center">0.5845366</td>
<td align="center">4294</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5790359</td>
<td align="center">1784</td>
<td align="center">0.5761047</td>
<td align="center">1833</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5767790</td>
<td align="center">2403</td>
<td align="center">0.5873016</td>
<td align="center">2394</td>
</tr>
</tbody>
</table>
@ -1230,27 +1230,27 @@ therapies very easily:</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.6667808</td>
<td align="center">0.6548006</td>
<td align="center">0.8867020</td>
<td align="center">0.6621943</td>
<td align="center">0.6443614</td>
<td align="center">0.8773777</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.6681648</td>
<td align="center">0.6749064</td>
<td align="center">0.8936330</td>
<td align="center">0.6626597</td>
<td align="center">0.6543952</td>
<td align="center">0.8918107</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.6628468</td>
<td align="center">0.6619421</td>
<td align="center">0.8808806</td>
<td align="center">0.6644880</td>
<td align="center">0.6461251</td>
<td align="center">0.8801743</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.4764202</td>
<td align="center">0.4886063</td>
<td align="center">0.0000000</td>
<td align="center">0.4764202</td>
<td align="center">0.4886063</td>
</tr>
</tbody>
</table>
@ -1278,23 +1278,23 @@ classes, use a antibiotic class selector such as
<tbody>
<tr class="odd">
<td align="left">Hospital A</td>
<td align="right">58.5%</td>
<td align="right">36.8%</td>
<td align="right">58.1%</td>
<td align="right">36.1%</td>
</tr>
<tr class="even">
<td align="left">Hospital B</td>
<td align="right">58.3%</td>
<td align="right">36.2%</td>
<td align="right">58.5%</td>
<td align="right">36.4%</td>
</tr>
<tr class="odd">
<td align="left">Hospital C</td>
<td align="right">57.9%</td>
<td align="right">37.7%</td>
<td align="right">57.6%</td>
<td align="right">36.2%</td>
</tr>
<tr class="even">
<td align="left">Hospital D</td>
<td align="right">57.7%</td>
<td align="right">34.5%</td>
<td align="right">58.7%</td>
<td align="right">36.9%</td>
</tr>
</tbody>
</table>
@ -1410,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] 0.002 64 16 0.125 2 64 8 0.025 0.01 </span></span>
<span><span class="co"># [10] 0.002 128 0.5 1 0.01 0.005 &gt;=256 0.0625 4 </span></span>
<span><span class="co"># [19] 64 0.01 128 2 0.25 0.5 0.0625 64 8 </span></span>
<span><span class="co"># [28] &gt;=256 8 0.0625 0.5 0.005 0.025 2 0.005 4 </span></span>
<span><span class="co"># [37] 64 &lt;=0.001 0.01 1 &lt;=0.001 0.0625 1 64 32 </span></span>
<span><span class="co"># [46] 0.5 0.005 4 0.25 0.01 64 0.5 &lt;=0.001 0.25 </span></span>
<span><span class="co"># [55] &lt;=0.001 1 0.002 4 32 0.005 4 128 &lt;=0.001</span></span>
<span><span class="co"># [64] 0.025 0.25 &lt;=0.001 64 &lt;=0.001 0.0625 128 &gt;=256 8 </span></span>
<span><span class="co"># [73] 2 0.125 &gt;=256 8 0.005 &gt;=256 0.125 16 2 </span></span>
<span><span class="co"># [82] 2 0.025 64 &gt;=256 &lt;=0.001 32 &gt;=256 2 2 </span></span>
<span><span class="co"># [91] 64 0.0625 &gt;=256 0.002 0.025 0.125 64 0.01 0.002 </span></span>
<span><span class="co"># [100] 0.5</span></span></code></pre></div>
<span><span class="co"># [1] 64 0.125 64 4 256 0.01 0.125 2 128 0.002 </span></span>
<span><span class="co"># [11] 2 0.125 0.01 0.01 8 0.0625 0.5 32 0.01 0.0625</span></span>
<span><span class="co"># [21] 8 16 32 16 0.001 0.005 4 128 0.025 128 </span></span>
<span><span class="co"># [31] 2 256 0.5 8 0.25 256 16 0.025 0.001 32 </span></span>
<span><span class="co"># [41] 16 2 16 0.025 1 32 64 4 16 32 </span></span>
<span><span class="co"># [51] 0.005 0.025 0.001 0.025 64 2 0.125 1 0.5 0.125 </span></span>
<span><span class="co"># [61] 16 0.002 0.25 16 0.002 4 0.5 2 128 128 </span></span>
<span><span class="co"># [71] 8 1 0.002 32 0.0625 8 128 0.125 1 0.25 </span></span>
<span><span class="co"># [81] 0.002 8 128 16 256 0.125 2 4 1 0.0625</span></span>
<span><span class="co"># [91] 4 0.025 16 0.5 64 0.002 128 0.0625 1 64</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>
@ -1455,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 28 26 25 25 26 25 19 31 31 30 27 23 29 18 31 21 18 31 19 29 24 20 28 18</span></span>
<span><span class="co"># [26] 28 30 22 18 20 22 19 26 25 29 26 26 31 17 17 18 26 25 26 30 20 27 20 28 20</span></span>
<span><span class="co"># [51] 17 20 30 23 18 31 23 18 22 20 24 31 19 27 18 21 25 25 22 26 21 29 26 24 20</span></span>
<span><span class="co"># [76] 24 20 31 22 18 23 26 28 20 26 20 17 28 31 24 31 28 21 19 26 26 22 24 18 31</span></span></code></pre></div>
<span><span class="co"># [1] 30 20 18 25 20 24 23 23 19 30 23 27 24 19 18 25 21 26 21 26 29 18 25 29 31</span></span>
<span><span class="co"># [26] 19 25 30 19 24 25 26 21 22 28 17 24 17 31 28 20 29 31 21 29 18 25 19 25 22</span></span>
<span><span class="co"># [51] 24 27 29 27 19 26 20 27 24 18 22 22 26 31 19 24 22 29 20 22 31 19 22 21 18</span></span>
<span><span class="co"># [76] 22 17 23 21 20 19 28 21 24 23 25 30 26 26 17 17 20 18 28 24 18 25 29 17 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: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

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

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 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,18 +375,18 @@ 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 S S I S I</span></span>
<span><span class="co"># 2 R R R R I S</span></span>
<span><span class="co"># 3 R I R R I R</span></span>
<span><span class="co"># 4 R S I S S I</span></span>
<span><span class="co"># 5 I I S S S I</span></span>
<span><span class="co"># 6 I I I R R I</span></span>
<span><span class="co"># 1 S I I I S I</span></span>
<span><span class="co"># 2 S S I S I I</span></span>
<span><span class="co"># 3 S S S R I S</span></span>
<span><span class="co"># 4 R S S I S S</span></span>
<span><span class="co"># 5 I S I R I R</span></span>
<span><span class="co"># 6 S R S I S R</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 S</span></span>
<span><span class="co"># 3 I</span></span>
<span><span class="co"># 3 S</span></span>
<span><span class="co"># 4 R</span></span>
<span><span class="co"># 5 I</span></span>
<span><span class="co"># 5 S</span></span>
<span><span class="co"># 6 S</span></span></code></pre></div>
<p>We can now add the interpretation of MDR-TB to our data set. You can
use:</p>
@ -428,40 +428,40 @@ Unique: 5</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Mono-resistant</td>
<td align="right">3238</td>
<td align="right">64.76%</td>
<td align="right">3238</td>
<td align="right">64.76%</td>
<td align="right">3193</td>
<td align="right">63.86%</td>
<td align="right">3193</td>
<td align="right">63.86%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Negative</td>
<td align="right">994</td>
<td align="right">19.88%</td>
<td align="right">4232</td>
<td align="right">84.64%</td>
<td align="right">981</td>
<td align="right">19.62%</td>
<td align="right">4174</td>
<td align="right">83.48%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Multi-drug-resistant</td>
<td align="right">425</td>
<td align="right">8.50%</td>
<td align="right">4657</td>
<td align="right">93.14%</td>
<td align="right">472</td>
<td align="right">9.44%</td>
<td align="right">4646</td>
<td align="right">92.92%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Poly-resistant</td>
<td align="right">247</td>
<td align="right">4.94%</td>
<td align="right">4904</td>
<td align="right">98.08%</td>
<td align="right">262</td>
<td align="right">5.24%</td>
<td align="right">4908</td>
<td align="right">98.16%</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="left">Extensively drug-resistant</td>
<td align="right">96</td>
<td align="right">1.92%</td>
<td align="right">92</td>
<td align="right">1.84%</td>
<td align="right">5000</td>
<td align="right">100.00%</td>
</tr>

View File

@ -11,7 +11,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2023-01-21T22:50Z
last_built: 2023-01-21T22:56Z
urls:
reference: https://msberends.github.io/AMR/reference
article: https://msberends.github.io/AMR/articles

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 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: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 8.2 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-02-17 77 77.92603 54</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1972-10-10 50 50.28219 27</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1972-01-31 50 50.97260 27</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1968-07-02 54 54.55616 31</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1943-04-09 79 79.78630 56</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1934-02-05 88 88.95890 65</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1990-08-18 32 32.42740 9</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1936-05-31 86 86.64384 63</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1971-03-22 51 51.83562 28</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1944-04-09 78 78.78630 55</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 1965-10-22 57 57.24932 34</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1950-02-25 72 72.90411 49</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1941-03-11 81 81.86575 58</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1936-05-01 86 86.72603 63</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1953-01-08 70 70.03562 46</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1959-03-10 63 63.86849 40</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1983-09-13 39 39.35616 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1983-06-07 39 39.62466 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1986-04-01 36 36.80822 13</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1998-01-24 24 24.99178 1</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -507,16 +507,16 @@ A microorganism is categorised as "Resistant" when there is a high likelihood of
<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> 2023-01-21 <span style="color: #949494;">22:50:34</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> 2023-01-21 <span style="color: #949494;">22:50:35</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> 2023-01-21 <span style="color: #949494;">22:50:35</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> 2023-01-21 <span style="color: #949494;">22:50:35</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> 2023-01-21 <span style="color: #949494;">22:50:35</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> 2023-01-21 <span style="color: #949494;">22:50:36</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> 2023-01-21 <span style="color: #949494;">22:50:36</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> 2023-01-21 <span style="color: #949494;">22:50:36</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> 2023-01-21 <span style="color: #949494;">22:50:36</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> 2023-01-21 <span style="color: #949494;">22:50:36</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> 2023-01-21 <span style="color: #949494;">22:57:11</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> 2023-01-21 <span style="color: #949494;">22:57:11</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> 2023-01-21 <span style="color: #949494;">22:57:11</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> 2023-01-21 <span style="color: #949494;">22:57:12</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> 2023-01-21 <span style="color: #949494;">22:57:12</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> 2023-01-21 <span style="color: #949494;">22:57:13</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> 2023-01-21 <span style="color: #949494;">22:57:13</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> 2023-01-21 <span style="color: #949494;">22:57:13</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> 2023-01-21 <span style="color: #949494;">22:57:13</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> 2023-01-21 <span style="color: #949494;">22:57:13</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;sir&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,39 +182,41 @@
<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] 67 46 16 36 38 5 49 55 15 40 15 27 43 31 1 8 65 17 32 23 21 42 55 33 12</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [26] 40 37 19 63 16 16 13 18 40 58 28 58 60 22 59 41 1 60 46 9 31 1 67 16 12</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [51] 66 56 3 5 53 48 6 25 64 28 13 34 48 11 25 15 54 23 58 10 49 2 29 65 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [76] 42 19 34 51 38 52 2 42 9 45 62 59 1 60 14 36 59 39 15 1 63 66 11 57 27</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [101] 24 38 42 44 9 14 45 31 7 1 64 20 24 24 43 64 33 43 20 57 63 30 28 38 13</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [126] 20 10 46 14 7 47 22 28 51 9 6 46 11 53 40 44 56 44 13 61 30 67 35 13 33</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [151] 7 58 63 62 37 49 60 5 12 10 38 11 33 33 62 17 13 53 62 60 15 8 21 39 28</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [176] 4 52 65 21 19 40 23 8 25 50 21 13 35 57 23 66 13 65 65 26 12 62 2 27 59</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 9 46 28 50 35 57 44 17 9 56 15 7 12 51 27 22 32 14 29 44 55 54 12 3 15</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [26] 46 6 5 47 12 40 5 51 16 40 46 26 37 1 50 3 23 13 11 19 25 54 36 49 15</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [51] 63 19 55 54 5 62 11 55 6 50 60 44 52 45 57 40 10 46 19 2 6 2 12 19 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [76] 37 7 16 47 59 49 24 57 19 25 48 43 28 59 56 59 41 4 23 25 58 56 32 43 34</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [101] 33 42 33 17 7 48 12 50 48 15 49 8 34 59 25 49 29 35 61 58 23 63 59 25 40</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [126] 57 46 20 21 26 16 12 16 7 27 8 21 38 48 8 26 52 51 41 24 42 60 11 52 31</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [151] 36 26 24 54 20 53 23 61 52 57 25 55 43 63 30 38 47 60 5 62 3 61 5 27 14</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [176] 37 12 25 63 54 30 39 1 15 55 5 55 34 38 63 20 18 24 31 12 32 20 2 7 32</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 FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] FALSE TRUE TRUE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] FALSE TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [37] FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [49] TRUE FALSE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [61] FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [73] TRUE FALSE FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [85] FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [97] FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [109] FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [121] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [133] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [145] TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [157] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [169] FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [181] FALSE TRUE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [193] FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] FALSE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [37] FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [49] TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [61] TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [73] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [85] FALSE FALSE TRUE TRUE TRUE TRUE FALSE FALSE TRUE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [97] FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [109] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [121] TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [133] FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [145] TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [157] FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [169] FALSE TRUE TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [181] FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [193] FALSE TRUE FALSE TRUE FALSE TRUE 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: 1 × 46</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 3 × 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;sir&gt;</span> <span style="color: #949494; font-style: italic;">&lt;sir&gt;</span> <span style="color: #949494; font-style: italic;">&lt;sir&gt;</span> <span style="color: #949494; font-style: italic;">&lt;sir&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 2002-05-16 E52286 47 M Clinical B_STPHY_AURS R NA S R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 2002-11-16 762305 87 F Clinical B_BCTRD_FRGL R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2002-11-16 762305 87 F Clinical B_PROTS_MRBL R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> 2002-09-23 F35553 51 M ICU B_STPHY_AURS S NA S NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># … with 36 more variables: AMC &lt;sir&gt;, AMP &lt;sir&gt;, TZP &lt;sir&gt;, CZO &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># FEP &lt;sir&gt;, CXM &lt;sir&gt;, FOX &lt;sir&gt;, CTX &lt;sir&gt;, CAZ &lt;sir&gt;, CRO &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># GEN &lt;sir&gt;, TOB &lt;sir&gt;, AMK &lt;sir&gt;, KAN &lt;sir&gt;, TMP &lt;sir&gt;, SXT &lt;sir&gt;,</span></span>
@ -250,16 +252,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> 904640 2017-11-08 C FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 685398 2013-04-16 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> B82692 2005-09-18 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> D19627 2010-08-15 C TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 414930 2011-01-10 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 384360 2003-01-09 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 479516 2013-09-30 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 375220 2014-12-22 C TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> C82046 2005-08-08 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 035268 2011-05-31 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> F24801 2004-02-10 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 263940 2013-03-05 C FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> E95747 2008-06-30 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 414858 2014-08-29 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 823896 2010-03-04 B FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 976813 2016-05-09 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 107DD1 2012-09-03 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 89F819 2005-11-27 C FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 89F578 2004-02-28 A FALSE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 329C35 2016-04-03 B 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>
@ -271,19 +273,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 [180]</span></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 2017-11-08 904640 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> Clinical 2013-04-16 685398 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> Clinical 2005-09-18 B82692 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> Clinical 2010-08-15 D19627 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> Clinical 2011-01-10 414930 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> Clinical 2003-01-09 384360 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> Clinical 2013-09-30 479516 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> Clinical 2014-12-22 375220 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> ICU 2005-08-08 C82046 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> ICU 2011-05-31 035268 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> ICU 2004-02-10 F24801 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> Clinical 2013-03-05 263940 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> Clinical 2008-06-30 E95747 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> Clinical 2014-08-29 414858 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> Clinical 2010-03-04 823896 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> Clinical 2016-05-09 976813 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> Clinical 2012-09-03 107DD1 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> ICU 2005-11-27 89F819 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> Clinical 2004-02-28 89F578 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> Clinical 2016-04-03 329C35 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>
@ -298,9 +300,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 115 15 58 77</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 56 13 32 42</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 9 6 8 8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clinical 124 15 57 81</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 47 12 35 42</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 11 6 10 10</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>
@ -330,19 +332,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 [191]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: patient, mo, ward [192]</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> 904640 B_CRYNB_STRT ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 685398 B_STRPT_ORLS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> B82692 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> D19627 B_ESCHR_COLI Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 414930 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 384360 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 479516 B_STPHY_HMNS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 375220 B_ENTRC_FCLS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> C82046 B_ESCHR_COLI ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 035268 B_STPHY_CONS ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> F24801 B_STRPT_GRPB ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 263940 B_STPHY_HMNS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> E95747 B_KLBSL_PNMN Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 414858 B_ESCHR_COLI Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 823896 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 976813 B_STPHY_AURS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 107DD1 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 89F819 B_CRYNB ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 89F578 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 329C35 B_ESCHR_COLI 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] 3.010073</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 2.951901</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.09263278</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.06827338</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -191,31 +191,31 @@
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">sir</span> <span class="op">&lt;-</span> <span class="fu"><a href="random.html">random_sir</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">sir</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'sir'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] R I S S I R S R R I</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] R I S S S S S I S R</span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">sir</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.1618950 -0.7745967 -0.7745967 -0.7745967 -0.7745967 1.1618950</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.7745967 1.1618950 1.1618950 -0.7745967</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.8973666 -0.4743416 -0.4743416 -0.4743416 -0.4743416 -0.4743416</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.4743416 -0.4743416 -0.4743416 1.8973666</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">mic</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">mic</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] 8 4 &lt;=0.0625 256 32 1 &lt;=0.0625 256 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [9] 64 0.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.005 &lt;=0.002 0.005 0.005 &lt;=0.002 2 64 256 0.025 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [10] 16 </span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">mic</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.15561961 -0.06669412 -1.40057649 1.26718825 0.60024707 -0.51132157</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -1.40057649 1.26718825 0.82256079 -0.73363530</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.7319933 -0.9284550 -0.7319933 -0.7319933 -0.9284550 0.5526353</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 1.2957230 1.5929580 -0.3869141 0.9984879</span>
<span class="r-in"><span><span class="co"># equal to the Z-score of their log2:</span></span></span>
<span class="r-in"><span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log2</a></span><span class="op">(</span><span class="va">mic</span><span class="op">)</span> <span class="op">-</span> <span class="fu"><a href="https://rdrr.io/r/base/mean.html" class="external-link">mean</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log2</a></span><span class="op">(</span><span class="va">mic</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> <span class="op">/</span> <span class="fu"><a href="https://rdrr.io/r/stats/sd.html" class="external-link">sd</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log2</a></span><span class="op">(</span><span class="va">mic</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.15561961 -0.06669412 -1.40057649 1.26718825 0.60024707 -0.51132157</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -1.40057649 1.26718825 0.82256079 -0.73363530</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.7319933 -0.9284550 -0.7319933 -0.7319933 -0.9284550 0.5526353</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 1.2957230 1.5929580 -0.3869141 0.9984879</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">disk</span> <span class="op">&lt;-</span> <span class="fu"><a href="random.html">random_disk</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">disk</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] 47 26 16 48 35 11 26 27 44 49</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 43 18 9 46 21 44 15 7 12 40</span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">disk</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.0232507 -0.5007397 -1.2264494 1.0958217 0.1523990 -1.5893042</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.5007397 -0.4281687 0.8055378 1.1683926</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.1037355 -0.4730295 -1.0406649 1.2929473 -0.2838177 1.1668061</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.6622413 -1.1668061 -0.8514531 0.9145237</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>
@ -225,36 +225,36 @@
<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 R 22 2 &lt;=0.25</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B S 26 1 &gt;=8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C S 17 1 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D I 17 2 0.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E R 19 0.5 0.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F S 23 1 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G S 21 &lt;=0.25 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H I 26 2 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I I 19 2 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J S 18 1 &gt;=8</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 R 19 &lt;=1 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B S 19 &gt;=4 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C S 19 2 0.25</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D I 27 &gt;=4 &gt;=8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E R 24 &lt;=1 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F S 30 2 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G I 31 &lt;=1 0.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H I 18 2 0.25</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I I 27 &lt;=1 0.25</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J S 22 2 &gt;=8</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" 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> [1] 0.42479243 0.60367076 -0.35088351 -0.39086870 -0.15337200 -0.05446405</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.41325021 0.41799269 -0.09780504 0.01418764</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.10395052 0.01413264 -0.56431322 0.81427297 0.35886977 0.25802215</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.13868335 -0.61529708 -0.47337526 0.24242087</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 "gent" and "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> 5 E R 19 0.5 0.5 -0.99015989</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G S 21 &lt;=0.25 4 -0.61880376</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A R 22 2 &lt;=0.25 -0.27594337</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F S 23 1 1 -0.19597299</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D I 17 2 0.5 0.01544239</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C S 17 1 2 0.09541277</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H I 26 2 1 0.30682815</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I I 19 2 1 0.30682815</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B S 26 1 &gt;=8 0.67818428</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J S 18 1 &gt;=8 0.67818428</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> 9 I I 27 &lt;=1 0.25 -1.0562699</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G I 31 &lt;=1 0.5 -0.7947569</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C S 19 2 0.25 -0.4224042</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H I 18 2 0.25 -0.4224042</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A R 19 &lt;=1 2 -0.2717308</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E R 24 &lt;=1 2 -0.2717308</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F S 30 2 1 0.1006218</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B S 19 &gt;=4 1 0.7344875</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J S 22 2 &gt;=8 0.8851609</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D I 27 &gt;=4 &gt;=8 1.5190266</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>
@ -266,17 +266,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 S 17 1 2 -0.35088351 0.00000000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 D I 17 2 0.5 -0.39086870 0.03998519</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 G S 21 &lt;=0.25 4 -0.41325021 0.06236670</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 E R 19 0.5 0.5 -0.15337200 0.19751151</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 I I 19 2 1 -0.09780504 0.25307847</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F S 23 1 1 -0.05446405 0.29641946</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 J S 18 1 &gt;=8 0.01418764 0.36507115</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H I 26 2 1 0.41799269 0.76887620</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 A R 22 2 &lt;=0.25 0.42479243 0.77567594</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 B S 26 1 &gt;=8 0.60367076 0.95455427</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 S 19 2 0.25 -0.56431322 0.00000000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 H I 18 2 0.25 -0.61529708 0.05098385</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 I I 27 &lt;=1 0.25 -0.47337526 0.09093796</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 G I 31 &lt;=1 0.5 -0.13868335 0.42562987</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 B S 19 &gt;=4 1 0.01413264 0.57844586</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 A R 19 &lt;=1 2 0.10395052 0.66826374</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 J S 22 2 &gt;=8 0.24242087 0.80673409</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 F S 30 2 1 0.25802215 0.82233538</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 E R 24 &lt;=1 2 0.35886977 0.92318299</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 D I 27 &gt;=4 &gt;=8 0.81427297 1.37858619</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: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 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] 0.01 0.25 64 4 8 0.125 16 0.125 128 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [10] 4 64 2 2 1 0.005 0.0625 2 0.125 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [19] &lt;=0.001 0.025 256 8 2 128 0.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 128 64 0.25 0.002 128 128 2 1 1 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [11] 32 4 4 2 0.025 64 8 32 0.25 0.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [21] 0.002 16 32 0.0625 1 </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] 39 21 49 46 49 48 32 49 18 43 8 14 50 31 38 18 36 47 42 50 18 47 50 17 13</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 14 40 9 45 33 41 31 50 48 24 13 27 29 26 50 46 48 43 7 34 48 40 45 18 24</span>
<span class="r-in"><span><span class="fu">random_sir</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 'sir'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] I R S R R I R I R I I R I S R S R S S S I I I R I</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] R I S S S S S S I R R I S R S I R R I R R S S S R</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.01 0.001 0.025 32 4 8 0.002 1 0.002 0.002 1 0.005</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] 4 0.025 &gt;=128 4 8 0.002 0.001 0.5 0.01 &gt;=128 0.001 &gt;=128</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.5 0.002 0.25 0.001 0.025 0.125 32 8 1 2 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [11] 0.01 32 0.01 0.005 0.005 32 4 32 8 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [21] 0.0625 4 0.5 0.001 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">"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] &lt;=1 &lt;=1 2 4 4 4 &lt;=1 8 8 8 &lt;=1 &lt;=1 4 4 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [16] 2 &lt;=1 2 4 4 &lt;=1 8 &gt;=16 4 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 16 8 16 &lt;=1 2 2 4 4 4 8 &lt;=1 &lt;=1 &lt;=1 &lt;=1 8 2 16 4 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [20] 32 16 8 2 16 &lt;=1</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.125 1 0.25 0.5 0.125 4 0.025 4 0.025 0.125 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [11] 0.025 0.25 4 &gt;=8 0.5 0.125 0.025 0.025 0.5 0.25 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [21] 0.0625 0.125 2 0.0625 0.025 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 2 0.125 1 1 0.125 0.25 0.25 &gt;=4 2 2 2 0.25 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] 0.25 0.125 1 0.25 &gt;=4 0.125 &gt;=4 0.5 &gt;=4 0.25 0.25 0.125</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] 0.5 </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] 39 45 17 46 43 35 44 42 26 40 9 14 49 40 46 48 8 43 31 47 47 39 40 13 42</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 47 32 35 46 12 40 42 20 46 25 31 40 31 40 40 42 29 49 26 19 42 13 43 23 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] 14 16 17 12 13 12 11 16 11 13 17 15 14 17 14 13 16 16 11 12 13 14 14 14 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 12 15 12 12 11 15 16 17 12 12 16 15 16 15 11 13 12 17 14 14 17 12 15 12 15</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] 22 26 18 15 21 26 23 22 16 22 27 25 15 24 16 23 20 19 18 23 24 15 27 18 17</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 19 25 20 18 15 20 19 21 22 15 15 18 20 25 16 25 24 23 26 21 25 21 25 22 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.09650892</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.03135381</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