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

website update

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-05-17 20:22:04 +02:00
parent a925a5d2f8
commit b0033dae1b
10 changed files with 254 additions and 261 deletions

4
R/ab.R
View File

@ -28,9 +28,9 @@
#' @inheritSection WHOCC WHOCC #' @inheritSection WHOCC WHOCC
#' @export #' @export
#' @importFrom dplyr %>% filter slice pull #' @importFrom dplyr %>% filter slice pull
#' @details All entries in the \code{\{link{antibiotics}} data set have three different identifiers: a human readable EARS-Net code (column \code{ab}, used by ECDC and WHONET), an ATC code (column \code{atc}, used by WHO), and a CID code (column \code{cid}, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem. #' @details All entries in the \code{\link{antibiotics}} data set have three different identifiers: a human readable EARS-Net code (column \code{ab}, used by ECDC and WHONET), an ATC code (column \code{atc}, used by WHO), and a CID code (column \code{cid}, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem.
#' #'
#' Use the \code{\link{ab_property}} functions to get properties based on the returned ATC code, see Examples. #' Use the \code{\link{ab_property}} functions to get properties based on the returned antibiotic ID, see Examples.
#' #'
#' In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups. #' In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups.
#' Source: \url{https://www.whocc.no/atc/structure_and_principles/} #' Source: \url{https://www.whocc.no/atc/structure_and_principles/}

View File

@ -327,9 +327,31 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">2014-11-13</td> <td align="center">2017-11-01</td>
<td align="center">S2</td> <td align="center">W7</td>
<td align="center">Hospital B</td> <td align="center">Hospital D</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2012-09-25</td>
<td align="center">R9</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2013-05-22</td>
<td align="center">V2</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -338,10 +360,10 @@
<td align="center">F</td> <td align="center">F</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2013-01-01</td> <td align="center">2017-03-29</td>
<td align="center">V1</td> <td align="center">W6</td>
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</td> <td align="center">Escherichia coli</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -349,46 +371,24 @@
<td align="center">F</td> <td align="center">F</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">2016-11-12</td> <td align="center">2017-09-07</td>
<td align="center">G5</td> <td align="center">N7</td>
<td align="center">Hospital A</td> <td align="center">Hospital C</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2011-09-23</td>
<td align="center">U6</td>
<td align="center">Hospital A</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2010-04-06</td>
<td align="center">C9</td>
<td align="center">Hospital D</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2012-04-11</td>
<td align="center">D2</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td> <td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2012-09-27</td>
<td align="center">B7</td>
<td align="center">Hospital B</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">M</td> <td align="center">M</td>
</tr> </tr>
@ -411,8 +411,8 @@
#&gt; #&gt;
#&gt; Item Count Percent Cum. Count Cum. Percent #&gt; Item Count Percent Cum. Count Cum. Percent
#&gt; --- ----- ------- -------- ----------- ------------- #&gt; --- ----- ------- -------- ----------- -------------
#&gt; 1 M 10,325 51.6% 10,325 51.6% #&gt; 1 M 10,580 52.9% 10,580 52.9%
#&gt; 2 F 9,675 48.4% 20,000 100.0%</code></pre> #&gt; 2 F 9,420 47.1% 20,000 100.0%</code></pre>
<p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didnt already know.</p> <p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didnt already know.</p>
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p> <p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a> <div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a>
@ -442,14 +442,14 @@
<a class="sourceLine" id="cb14-18" title="18"><span class="co">#&gt; Pasteurella multocida (no new changes)</span></a> <a class="sourceLine" id="cb14-18" title="18"><span class="co">#&gt; Pasteurella multocida (no new changes)</span></a>
<a class="sourceLine" id="cb14-19" title="19"><span class="co">#&gt; Staphylococcus (no new changes)</span></a> <a class="sourceLine" id="cb14-19" title="19"><span class="co">#&gt; Staphylococcus (no new changes)</span></a>
<a class="sourceLine" id="cb14-20" title="20"><span class="co">#&gt; Streptococcus groups A, B, C, G (no new changes)</span></a> <a class="sourceLine" id="cb14-20" title="20"><span class="co">#&gt; Streptococcus groups A, B, C, G (no new changes)</span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; Streptococcus pneumoniae (1508 new changes)</span></a> <a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; Streptococcus pneumoniae (1481 new changes)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Viridans group streptococci (no new changes)</span></a> <a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Viridans group streptococci (no new changes)</span></a>
<a class="sourceLine" id="cb14-23" title="23"><span class="co">#&gt; </span></a> <a class="sourceLine" id="cb14-23" title="23"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-24" title="24"><span class="co">#&gt; EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a> <a class="sourceLine" id="cb14-24" title="24"><span class="co">#&gt; EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 01: Intrinsic resistance in Enterobacteriaceae (1335 new changes)</span></a> <a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 01: Intrinsic resistance in Enterobacteriaceae (1304 new changes)</span></a>
<a class="sourceLine" id="cb14-26" title="26"><span class="co">#&gt; Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)</span></a> <a class="sourceLine" id="cb14-26" title="26"><span class="co">#&gt; Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)</span></a>
<a class="sourceLine" id="cb14-27" title="27"><span class="co">#&gt; Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)</span></a> <a class="sourceLine" id="cb14-27" title="27"><span class="co">#&gt; Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 04: Intrinsic resistance in Gram-positive bacteria (2792 new changes)</span></a> <a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 04: Intrinsic resistance in Gram-positive bacteria (2729 new changes)</span></a>
<a class="sourceLine" id="cb14-29" title="29"><span class="co">#&gt; Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)</span></a> <a class="sourceLine" id="cb14-29" title="29"><span class="co">#&gt; Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)</span></a>
<a class="sourceLine" id="cb14-30" title="30"><span class="co">#&gt; Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)</span></a> <a class="sourceLine" id="cb14-30" title="30"><span class="co">#&gt; Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)</span></a>
<a class="sourceLine" id="cb14-31" title="31"><span class="co">#&gt; Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a> <a class="sourceLine" id="cb14-31" title="31"><span class="co">#&gt; Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a>
@ -457,24 +457,24 @@
<a class="sourceLine" id="cb14-33" title="33"><span class="co">#&gt; Table 13: Interpretive rules for quinolones (no new changes)</span></a> <a class="sourceLine" id="cb14-33" title="33"><span class="co">#&gt; Table 13: Interpretive rules for quinolones (no new changes)</span></a>
<a class="sourceLine" id="cb14-34" title="34"><span class="co">#&gt; </span></a> <a class="sourceLine" id="cb14-34" title="34"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-35" title="35"><span class="co">#&gt; Other rules</span></a> <a class="sourceLine" id="cb14-35" title="35"><span class="co">#&gt; Other rules</span></a>
<a class="sourceLine" id="cb14-36" title="36"><span class="co">#&gt; Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2206 new changes)</span></a> <a class="sourceLine" id="cb14-36" title="36"><span class="co">#&gt; Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2235 new changes)</span></a>
<a class="sourceLine" id="cb14-37" title="37"><span class="co">#&gt; Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (141 new changes)</span></a> <a class="sourceLine" id="cb14-37" title="37"><span class="co">#&gt; Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (125 new changes)</span></a>
<a class="sourceLine" id="cb14-38" title="38"><span class="co">#&gt; Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a> <a class="sourceLine" id="cb14-38" title="38"><span class="co">#&gt; Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-39" title="39"><span class="co">#&gt; Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a> <a class="sourceLine" id="cb14-39" title="39"><span class="co">#&gt; Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-40" title="40"><span class="co">#&gt; Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a> <a class="sourceLine" id="cb14-40" title="40"><span class="co">#&gt; Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a> <a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-42" title="42"><span class="co">#&gt; </span></a> <a class="sourceLine" id="cb14-42" title="42"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; --------------------------------------------------------------------------</span></a> <a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-44" title="44"><span class="co">#&gt; EUCAST rules affected 6,587 out of 20,000 rows, making a total of 7,982 edits</span></a> <a class="sourceLine" id="cb14-44" title="44"><span class="co">#&gt; EUCAST rules affected 6,510 out of 20,000 rows, making a total of 7,874 edits</span></a>
<a class="sourceLine" id="cb14-45" title="45"><span class="co">#&gt; =&gt; added 0 test results</span></a> <a class="sourceLine" id="cb14-45" title="45"><span class="co">#&gt; =&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-46" title="46"><span class="co">#&gt; </span></a> <a class="sourceLine" id="cb14-46" title="46"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-47" title="47"><span class="co">#&gt; =&gt; changed 7,982 test results</span></a> <a class="sourceLine" id="cb14-47" title="47"><span class="co">#&gt; =&gt; changed 7,874 test results</span></a>
<a class="sourceLine" id="cb14-48" title="48"><span class="co">#&gt; - 102 test results changed from S to I</span></a> <a class="sourceLine" id="cb14-48" title="48"><span class="co">#&gt; - 98 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-49" title="49"><span class="co">#&gt; - 4,844 test results changed from S to R</span></a> <a class="sourceLine" id="cb14-49" title="49"><span class="co">#&gt; - 4,755 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-50" title="50"><span class="co">#&gt; - 1,047 test results changed from I to S</span></a> <a class="sourceLine" id="cb14-50" title="50"><span class="co">#&gt; - 1,023 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-51" title="51"><span class="co">#&gt; - 345 test results changed from I to R</span></a> <a class="sourceLine" id="cb14-51" title="51"><span class="co">#&gt; - 326 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-52" title="52"><span class="co">#&gt; - 1,615 test results changed from R to S</span></a> <a class="sourceLine" id="cb14-52" title="52"><span class="co">#&gt; - 1,654 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-53" title="53"><span class="co">#&gt; - 29 test results changed from R to I</span></a> <a class="sourceLine" id="cb14-53" title="53"><span class="co">#&gt; - 18 test results changed from R to I</span></a>
<a class="sourceLine" id="cb14-54" title="54"><span class="co">#&gt; --------------------------------------------------------------------------</span></a> <a class="sourceLine" id="cb14-54" title="54"><span class="co">#&gt; --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-55" title="55"><span class="co">#&gt; </span></a> <a class="sourceLine" id="cb14-55" title="55"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-56" title="56"><span class="co">#&gt; Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div> <a class="sourceLine" id="cb14-56" title="56"><span class="co">#&gt; Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div>
@ -502,8 +502,8 @@
<a class="sourceLine" id="cb16-3" title="3"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a> <a class="sourceLine" id="cb16-3" title="3"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb16-4" title="4"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a> <a class="sourceLine" id="cb16-4" title="4"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
<a class="sourceLine" id="cb16-5" title="5"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a> <a class="sourceLine" id="cb16-5" title="5"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,711 first isolates (28.6% of total)</span></a></code></pre></div> <a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,686 first isolates (28.4% of total)</span></a></code></pre></div>
<p>So only 28.6% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p> <p>So only 28.4% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div> <a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p> <p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
@ -529,8 +529,8 @@
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">1</td> <td align="center">1</td>
<td align="center">2010-02-03</td> <td align="center">2010-01-10</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -540,8 +540,8 @@
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2</td> <td align="center">2</td>
<td align="center">2010-03-18</td> <td align="center">2010-02-24</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -552,29 +552,29 @@
<tr class="odd"> <tr class="odd">
<td align="center">3</td> <td align="center">3</td>
<td align="center">2010-04-04</td> <td align="center">2010-04-04</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">4</td> <td align="center">4</td>
<td align="center">2010-04-12</td> <td align="center">2010-04-14</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">5</td> <td align="center">5</td>
<td align="center">2010-05-08</td> <td align="center">2010-05-20</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -584,10 +584,10 @@
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">6</td> <td align="center">6</td>
<td align="center">2010-08-03</td> <td align="center">2010-09-24</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -595,8 +595,8 @@
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">7</td> <td align="center">7</td>
<td align="center">2010-08-04</td> <td align="center">2010-10-10</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -606,21 +606,21 @@
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">8</td> <td align="center">8</td>
<td align="center">2010-11-02</td> <td align="center">2010-11-17</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</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">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">9</td> <td align="center">9</td>
<td align="center">2010-11-09</td> <td align="center">2010-12-16</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -628,18 +628,18 @@
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">10</td> <td align="center">10</td>
<td align="center">2010-12-18</td> <td align="center">2011-04-02</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td> <td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">S</td>
<td align="center">TRUE</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>Only 1 isolates are marked as first according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p> <p>Only 2 isolates are marked as first according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>If a column exists with a name like key(…)ab the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p> <p>If a column exists with a name like key(…)ab the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb19-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%&gt;%</span><span class="st"> </span></a> <a class="sourceLine" id="cb19-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -650,7 +650,7 @@
<a class="sourceLine" id="cb19-7" title="7"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a> <a class="sourceLine" id="cb19-7" title="7"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb19-8" title="8"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a> <a class="sourceLine" id="cb19-8" title="8"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<a class="sourceLine" id="cb19-9" title="9"><span class="co">#&gt; [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a> <a class="sourceLine" id="cb19-9" title="9"><span class="co">#&gt; [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,123 first weighted isolates (75.6% of total)</span></a></code></pre></div> <a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,158 first weighted isolates (75.8% of total)</span></a></code></pre></div>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th align="center">isolate</th> <th align="center">isolate</th>
@ -667,8 +667,8 @@
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">1</td> <td align="center">1</td>
<td align="center">2010-02-03</td> <td align="center">2010-01-10</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -679,8 +679,8 @@
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2</td> <td align="center">2</td>
<td align="center">2010-03-18</td> <td align="center">2010-02-24</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -692,106 +692,106 @@
<tr class="odd"> <tr class="odd">
<td align="center">3</td> <td align="center">3</td>
<td align="center">2010-04-04</td> <td align="center">2010-04-04</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">4</td> <td align="center">4</td>
<td align="center">2010-04-12</td> <td align="center">2010-04-14</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">FALSE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">5</td> <td align="center">5</td>
<td align="center">2010-05-08</td> <td align="center">2010-05-20</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">FALSE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">6</td> <td align="center">6</td>
<td align="center">2010-08-03</td> <td align="center">2010-09-24</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">7</td> <td align="center">7</td>
<td align="center">2010-08-04</td> <td align="center">2010-10-10</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">8</td> <td align="center">8</td>
<td align="center">2010-11-02</td> <td align="center">2010-11-17</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</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">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">9</td> <td align="center">9</td>
<td align="center">2010-11-09</td> <td align="center">2010-12-16</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">10</td> <td align="center">10</td>
<td align="center">2010-12-18</td> <td align="center">2011-04-02</td>
<td align="center">Q6</td> <td align="center">T7</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td> <td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>Instead of 1, now 6 isolates are flagged. In total, 75.6% of all isolates are marked first weighted - 47.1% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p> <p>Instead of 2, now 5 isolates are flagged. In total, 75.8% of all isolates are marked first weighted - 47.4% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, theres a shortcut for this new algorithm too:</p> <p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, theres a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb20-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div> <a class="sourceLine" id="cb20-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
<p>So we end up with 15,123 isolates for analysis.</p> <p>So we end up with 15,158 isolates for analysis.</p>
<p>We can remove unneeded columns:</p> <p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1">data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1">data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb21-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div> <a class="sourceLine" id="cb21-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div>
@ -799,7 +799,6 @@
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data_1st)</a></code></pre></div> <div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data_1st)</a></code></pre></div>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th></th>
<th align="center">date</th> <th align="center">date</th>
<th align="center">patient_id</th> <th align="center">patient_id</th>
<th align="center">hospital</th> <th align="center">hospital</th>
@ -816,10 +815,39 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td>1</td> <td align="center">2017-11-01</td>
<td align="center">2014-11-13</td> <td align="center">W7</td>
<td align="center">S2</td> <td align="center">Hospital D</td>
<td align="center">Hospital B</td> <td align="center">B_STRPT_PNE</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2012-09-25</td>
<td align="center">R9</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNE</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2013-05-22</td>
<td align="center">V2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -832,80 +860,45 @@
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td>3</td> <td align="center">2017-03-29</td>
<td align="center">2016-11-12</td> <td align="center">W6</td>
<td align="center">G5</td> <td align="center">Hospital C</td>
<td align="center">Hospital A</td> <td align="center">B_ESCHR_COL</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>4</td>
<td align="center">2011-09-23</td>
<td align="center">U6</td>
<td align="center">Hospital A</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">F</td> <td align="center">F</td>
<td align="center">Gram negative</td> <td align="center">Gram negative</td>
<td align="center">Klebsiella</td> <td align="center">Escherichia</td>
<td align="center">pneumoniae</td> <td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>5</td>
<td align="center">2010-04-06</td>
<td align="center">C9</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPT_PNE</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td>6</td> <td align="center">2017-09-07</td>
<td align="center">2012-04-11</td> <td align="center">N7</td>
<td align="center">D2</td> <td align="center">Hospital C</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AUR</td> <td align="center">B_STPHY_AUR</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">M</td> <td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram positive</td> <td align="center">Gram positive</td>
<td align="center">Staphylococcus</td> <td align="center">Staphylococcus</td>
<td align="center">aureus</td> <td align="center">aureus</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td>8</td> <td align="center">2012-09-27</td>
<td align="center">2012-08-17</td> <td align="center">B7</td>
<td align="center">Z4</td> <td align="center">Hospital B</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_COL</td> <td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">F</td> <td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td> <td align="center">Gram negative</td>
<td align="center">Escherichia</td> <td align="center">Escherichia</td>
<td align="center">coli</td> <td align="center">coli</td>
@ -928,9 +921,9 @@
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1"><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/paste">paste</a></span>(data_1st<span class="op">$</span>genus, data_1st<span class="op">$</span>species))</a></code></pre></div> <div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1"><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/paste">paste</a></span>(data_1st<span class="op">$</span>genus, data_1st<span class="op">$</span>species))</a></code></pre></div>
<p>Or can be used like the <code>dplyr</code> way, which is easier readable:</p> <p>Or can be used like the <code>dplyr</code> way, which is easier readable:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus, species)</a></code></pre></div> <div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus, species)</a></code></pre></div>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,123 x 13)</strong></p> <p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,158 x 13)</strong></p>
<p>Columns: 2<br> <p>Columns: 2<br>
Length: 15,123 (of which NA: 0 = 0.00%)<br> Length: 15,158 (of which NA: 0 = 0.00%)<br>
Unique: 4</p> Unique: 4</p>
<p>Shortest: 16<br> <p>Shortest: 16<br>
Longest: 24</p> Longest: 24</p>
@ -947,33 +940,33 @@ Longest: 24</p>
<tr class="odd"> <tr class="odd">
<td align="left">1</td> <td align="left">1</td>
<td align="left">Escherichia coli</td> <td align="left">Escherichia coli</td>
<td align="right">7,466</td> <td align="right">7,500</td>
<td align="right">49.4%</td> <td align="right">49.5%</td>
<td align="right">7,466</td> <td align="right">7,500</td>
<td align="right">49.4%</td> <td align="right">49.5%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">Staphylococcus aureus</td> <td align="left">Staphylococcus aureus</td>
<td align="right">3,649</td> <td align="right">3,761</td>
<td align="right">24.1%</td> <td align="right">24.8%</td>
<td align="right">11,115</td> <td align="right">11,261</td>
<td align="right">73.5%</td> <td align="right">74.3%</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="left">3</td> <td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td> <td align="left">Streptococcus pneumoniae</td>
<td align="right">2,381</td> <td align="right">2,297</td>
<td align="right">15.7%</td> <td align="right">15.2%</td>
<td align="right">13,496</td> <td align="right">13,558</td>
<td align="right">89.2%</td> <td align="right">89.4%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">4</td> <td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td> <td align="left">Klebsiella pneumoniae</td>
<td align="right">1,627</td> <td align="right">1,600</td>
<td align="right">10.8%</td> <td align="right">10.6%</td>
<td align="right">15,123</td> <td align="right">15,158</td>
<td align="right">100.0%</td> <td align="right">100.0%</td>
</tr> </tr>
</tbody> </tbody>
@ -982,13 +975,13 @@ Longest: 24</p>
<div id="resistance-percentages" class="section level2"> <div id="resistance-percentages" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2> <a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2>
<p>The functions <code><a href="../reference/portion.html">portion_S()</a></code>, <code><a href="../reference/portion.html">portion_SI()</a></code>, <code><a href="../reference/portion.html">portion_I()</a></code>, <code><a href="../reference/portion.html">portion_IR()</a></code> and <code><a href="../reference/portion.html">portion_R()</a></code> can be used to determine the portion of a specific antimicrobial outcome. They can be used on their own:</p> <p>The functions <code><a href="../reference/portion.html">portion_S()</a></code>, <code><a href="../reference/portion.html">portion_SI()</a></code>, <code><a href="../reference/portion.html">portion_I()</a></code>, <code><a href="../reference/portion.html">portion_IR()</a></code> and <code><a href="../reference/portion.html">portion_R()</a></code> can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (<code><a href="../reference/portion.html">portion_R()</a></code>) and susceptibility as the portion of S and I (<code><a href="../reference/portion.html">portion_SI()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(AMX)</a> <div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_R</a></span>(AMX)</a>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.5012233</span></a></code></pre></div> <a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.4712363</span></a></code></pre></div>
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p> <p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb26-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a> <a class="sourceLine" id="cb26-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb26-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(AMX))</a></code></pre></div> <a class="sourceLine" id="cb26-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_R</a></span>(AMX))</a></code></pre></div>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th align="center">hospital</th> <th align="center">hospital</th>
@ -997,26 +990,26 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital A</td> <td align="center">Hospital A</td>
<td align="center">0.5100641</td> <td align="center">0.4757516</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">0.4945632</td> <td align="center">0.4728817</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">0.4960457</td> <td align="center">0.4581554</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital D</td> <td align="center">Hospital D</td>
<td align="center">0.5036765</td> <td align="center">0.4717349</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>Of course it would be very convenient to know the number of isolates responsible for the percentages. For that purpose the <code><a href="../reference/count.html">n_rsi()</a></code> can be used, which works exactly like <code><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct()</a></code> from the <code>dplyr</code> package. It counts all isolates available for every group (i.e. values S, I or R):</p> <p>Of course it would be very convenient to know the number of isolates responsible for the percentages. For that purpose the <code><a href="../reference/count.html">n_rsi()</a></code> can be used, which works exactly like <code><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct()</a></code> from the <code>dplyr</code> package. It counts all isolates available for every group (i.e. values S, I or R):</p>
<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb27-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a> <a class="sourceLine" id="cb27-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb27-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(AMX),</a> <a class="sourceLine" id="cb27-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_R</a></span>(AMX),</a>
<a class="sourceLine" id="cb27-4" title="4"> <span class="dt">available =</span> <span class="kw"><a href="../reference/count.html">n_rsi</a></span>(AMX))</a></code></pre></div> <a class="sourceLine" id="cb27-4" title="4"> <span class="dt">available =</span> <span class="kw"><a href="../reference/count.html">n_rsi</a></span>(AMX))</a></code></pre></div>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
@ -1027,32 +1020,32 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital A</td> <td align="center">Hospital A</td>
<td align="center">0.5100641</td> <td align="center">0.4757516</td>
<td align="center">4521</td> <td align="center">4557</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">0.4945632</td> <td align="center">0.4728817</td>
<td align="center">5334</td> <td align="center">5181</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">0.4960457</td> <td align="center">0.4581554</td>
<td align="center">2276</td> <td align="center">2342</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital D</td> <td align="center">Hospital D</td>
<td align="center">0.5036765</td> <td align="center">0.4717349</td>
<td align="center">2992</td> <td align="center">3078</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>These functions can also be used to get the portion of multiple antibiotics, to calculate empiric susceptibility of combination therapies very easily:</p> <p>These functions can also be used to get the portion of multiple antibiotics, to calculate empiric susceptibility of combination therapies very easily:</p>
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb28-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb28-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb28-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus) <span class="op">%&gt;%</span><span class="st"> </span></a> <a class="sourceLine" id="cb28-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb28-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxiclav =</span> <span class="kw"><a href="../reference/portion.html">portion_S</a></span>(AMC),</a> <a class="sourceLine" id="cb28-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxiclav =</span> <span class="kw"><a href="../reference/portion.html">portion_SI</a></span>(AMC),</a>
<a class="sourceLine" id="cb28-4" title="4"> <span class="dt">gentamicin =</span> <span class="kw"><a href="../reference/portion.html">portion_S</a></span>(GEN),</a> <a class="sourceLine" id="cb28-4" title="4"> <span class="dt">gentamicin =</span> <span class="kw"><a href="../reference/portion.html">portion_SI</a></span>(GEN),</a>
<a class="sourceLine" id="cb28-5" title="5"> <span class="dt">amoxiclav_genta =</span> <span class="kw"><a href="../reference/portion.html">portion_S</a></span>(AMC, GEN))</a></code></pre></div> <a class="sourceLine" id="cb28-5" title="5"> <span class="dt">amoxiclav_genta =</span> <span class="kw"><a href="../reference/portion.html">portion_SI</a></span>(AMC, GEN))</a></code></pre></div>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th align="center">genus</th> <th align="center">genus</th>
@ -1063,36 +1056,36 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Escherichia</td> <td align="center">Escherichia</td>
<td align="center">0.8775784</td> <td align="center">0.9216000</td>
<td align="center">0.8984731</td> <td align="center">0.8910667</td>
<td align="center">0.9910260</td> <td align="center">0.9924000</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Klebsiella</td> <td align="center">Klebsiella</td>
<td align="center">0.7221881</td> <td align="center">0.8250000</td>
<td align="center">0.9053473</td> <td align="center">0.9018750</td>
<td align="center">0.9778734</td> <td align="center">0.9893750</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Staphylococcus</td> <td align="center">Staphylococcus</td>
<td align="center">0.8766785</td> <td align="center">0.9215634</td>
<td align="center">0.9188819</td> <td align="center">0.9175751</td>
<td align="center">0.9887640</td> <td align="center">0.9936187</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Streptococcus</td> <td align="center">Streptococcus</td>
<td align="center">0.5732885</td> <td align="center">0.6081846</td>
<td align="center">0.0000000</td> <td align="center">0.0000000</td>
<td align="center">0.5732885</td> <td align="center">0.6081846</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>To make a transition to the next part, lets see how this difference could be plotted:</p> <p>To make a transition to the next part, lets see how this difference could be plotted:</p>
<div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb29-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb29-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb29-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus) <span class="op">%&gt;%</span><span class="st"> </span></a> <a class="sourceLine" id="cb29-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb29-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="st">"1. Amoxi/clav"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(AMC),</a> <a class="sourceLine" id="cb29-3" title="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="st">"1. Amoxi/clav"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_SI</a></span>(AMC),</a>
<a class="sourceLine" id="cb29-4" title="4"> <span class="st">"2. Gentamicin"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(GEN),</a> <a class="sourceLine" id="cb29-4" title="4"> <span class="st">"2. Gentamicin"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_SI</a></span>(GEN),</a>
<a class="sourceLine" id="cb29-5" title="5"> <span class="st">"3. Amoxi/clav + GEN"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(AMC, GEN)) <span class="op">%&gt;%</span><span class="st"> </span></a> <a class="sourceLine" id="cb29-5" title="5"> <span class="st">"3. Amoxi/clav + genta"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_SI</a></span>(AMC, GEN)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb29-6" title="6"><span class="st"> </span>tidyr<span class="op">::</span><span class="kw"><a href="https://tidyr.tidyverse.org/reference/gather.html">gather</a></span>(<span class="st">"Antibiotic"</span>, <span class="st">"S"</span>, <span class="op">-</span>genus) <span class="op">%&gt;%</span></a> <a class="sourceLine" id="cb29-6" title="6"><span class="st"> </span>tidyr<span class="op">::</span><span class="kw"><a href="https://tidyr.tidyverse.org/reference/gather.html">gather</a></span>(<span class="st">"Antibiotic"</span>, <span class="st">"S"</span>, <span class="op">-</span>genus) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb29-7" title="7"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/ggplot">ggplot</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/aes">aes</a></span>(<span class="dt">x =</span> genus,</a> <a class="sourceLine" id="cb29-7" title="7"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/ggplot">ggplot</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/aes">aes</a></span>(<span class="dt">x =</span> genus,</a>
<a class="sourceLine" id="cb29-8" title="8"> <span class="dt">y =</span> S,</a> <a class="sourceLine" id="cb29-8" title="8"> <span class="dt">y =</span> S,</a>
@ -1134,7 +1127,7 @@ Longest: 24</p>
<a class="sourceLine" id="cb32-10" title="10"><span class="st"> </span><span class="kw"><a href="../reference/ggplot_rsi.html">scale_rsi_colours</a></span>() <span class="op">+</span></a> <a class="sourceLine" id="cb32-10" title="10"><span class="st"> </span><span class="kw"><a href="../reference/ggplot_rsi.html">scale_rsi_colours</a></span>() <span class="op">+</span></a>
<a class="sourceLine" id="cb32-11" title="11"><span class="st"> </span><span class="co"># show percentages on y axis</span></a> <a class="sourceLine" id="cb32-11" title="11"><span class="st"> </span><span class="co"># show percentages on y axis</span></a>
<a class="sourceLine" id="cb32-12" title="12"><span class="st"> </span><span class="kw"><a href="../reference/ggplot_rsi.html">scale_y_percent</a></span>(<span class="dt">breaks =</span> <span class="dv">0</span><span class="op">:</span><span class="dv">4</span> <span class="op">*</span><span class="st"> </span><span class="dv">25</span>) <span class="op">+</span></a> <a class="sourceLine" id="cb32-12" title="12"><span class="st"> </span><span class="kw"><a href="../reference/ggplot_rsi.html">scale_y_percent</a></span>(<span class="dt">breaks =</span> <span class="dv">0</span><span class="op">:</span><span class="dv">4</span> <span class="op">*</span><span class="st"> </span><span class="dv">25</span>) <span class="op">+</span></a>
<a class="sourceLine" id="cb32-13" title="13"><span class="st"> </span><span class="co"># turn 90 degrees, make it bars instead of columns</span></a> <a class="sourceLine" id="cb32-13" title="13"><span class="st"> </span><span class="co"># turn 90 degrees, to make it bars instead of columns</span></a>
<a class="sourceLine" id="cb32-14" title="14"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/coord_flip">coord_flip</a></span>() <span class="op">+</span></a> <a class="sourceLine" id="cb32-14" title="14"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/coord_flip">coord_flip</a></span>() <span class="op">+</span></a>
<a class="sourceLine" id="cb32-15" title="15"><span class="st"> </span><span class="co"># add labels</span></a> <a class="sourceLine" id="cb32-15" title="15"><span class="st"> </span><span class="co"># add labels</span></a>
<a class="sourceLine" id="cb32-16" title="16"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/labs">labs</a></span>(<span class="dt">title =</span> <span class="st">"Resistance per genus and antibiotic"</span>, </a> <a class="sourceLine" id="cb32-16" title="16"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/ggplot2/topics/labs">labs</a></span>(<span class="dt">title =</span> <span class="st">"Resistance per genus and antibiotic"</span>, </a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -260,8 +260,8 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2> <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>All entries in the <code>{link{antibiotics}</code> data set have three different identifiers: a human readable EARS-Net code (column <code>ab</code>, used by ECDC and WHONET), an ATC code (column <code>atc</code>, used by WHO), and a CID code (column <code>cid</code>, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem.</p> <p>All entries in the <code><a href='antibiotics.html'>antibiotics</a></code> data set have three different identifiers: a human readable EARS-Net code (column <code>ab</code>, used by ECDC and WHONET), an ATC code (column <code>atc</code>, used by WHO), and a CID code (column <code>cid</code>, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem.</p>
<p>Use the <code><a href='ab_property.html'>ab_property</a></code> functions to get properties based on the returned ATC code, see Examples.</p> <p>Use the <code><a href='ab_property.html'>ab_property</a></code> functions to get properties based on the returned antibiotic ID, see Examples.</p>
<p>In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups. <p>In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups.
Source: <a href='https://www.whocc.no/atc/structure_and_principles/'>https://www.whocc.no/atc/structure_and_principles/</a></p> Source: <a href='https://www.whocc.no/atc/structure_and_principles/'>https://www.whocc.no/atc/structure_and_principles/</a></p>

View File

@ -19,9 +19,9 @@ Character (vector) with class \code{"ab"}. Unknown values will return \code{NA}.
Use this function to determine the antibiotic code of one or more antibiotics. The data set \code{\link{antibiotics}} will be searched for abbreviations, official names and synonyms (brand names). Use this function to determine the antibiotic code of one or more antibiotics. The data set \code{\link{antibiotics}} will be searched for abbreviations, official names and synonyms (brand names).
} }
\details{ \details{
All entries in the \code{\{link{antibiotics}} data set have three different identifiers: a human readable EARS-Net code (column \code{ab}, used by ECDC and WHONET), an ATC code (column \code{atc}, used by WHO), and a CID code (column \code{cid}, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem. All entries in the \code{\link{antibiotics}} data set have three different identifiers: a human readable EARS-Net code (column \code{ab}, used by ECDC and WHONET), an ATC code (column \code{atc}, used by WHO), and a CID code (column \code{cid}, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem.
Use the \code{\link{ab_property}} functions to get properties based on the returned ATC code, see Examples. Use the \code{\link{ab_property}} functions to get properties based on the returned antibiotic ID, see Examples.
In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups. In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups.
Source: \url{https://www.whocc.no/atc/structure_and_principles/} Source: \url{https://www.whocc.no/atc/structure_and_principles/}

View File

@ -315,10 +315,10 @@ data_1st %>%
## Resistance percentages ## Resistance percentages
The functions `portion_S()`, `portion_SI()`, `portion_I()`, `portion_IR()` and `portion_R()` can be used to determine the portion of a specific antimicrobial outcome. They can be used on their own: The functions `portion_S()`, `portion_SI()`, `portion_I()`, `portion_IR()` and `portion_R()` can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (`portion_R()`) and susceptibility as the portion of S and I (`portion_SI()`). These functions can be used on their own:
```{r} ```{r}
data_1st %>% portion_IR(AMX) data_1st %>% portion_R(AMX)
``` ```
Or can be used in conjuction with `group_by()` and `summarise()`, both from the `dplyr` package: Or can be used in conjuction with `group_by()` and `summarise()`, both from the `dplyr` package:
@ -326,12 +326,12 @@ Or can be used in conjuction with `group_by()` and `summarise()`, both from the
```{r, eval = FALSE} ```{r, eval = FALSE}
data_1st %>% data_1st %>%
group_by(hospital) %>% group_by(hospital) %>%
summarise(amoxicillin = portion_IR(AMX)) summarise(amoxicillin = portion_R(AMX))
``` ```
```{r, echo = FALSE} ```{r, echo = FALSE}
data_1st %>% data_1st %>%
group_by(hospital) %>% group_by(hospital) %>%
summarise(amoxicillin = portion_IR(AMX)) %>% summarise(amoxicillin = portion_R(AMX)) %>%
knitr::kable(align = "c", big.mark = ",") knitr::kable(align = "c", big.mark = ",")
``` ```
@ -340,13 +340,13 @@ Of course it would be very convenient to know the number of isolates responsible
```{r, eval = FALSE} ```{r, eval = FALSE}
data_1st %>% data_1st %>%
group_by(hospital) %>% group_by(hospital) %>%
summarise(amoxicillin = portion_IR(AMX), summarise(amoxicillin = portion_R(AMX),
available = n_rsi(AMX)) available = n_rsi(AMX))
``` ```
```{r, echo = FALSE} ```{r, echo = FALSE}
data_1st %>% data_1st %>%
group_by(hospital) %>% group_by(hospital) %>%
summarise(amoxicillin = portion_IR(AMX), summarise(amoxicillin = portion_R(AMX),
available = n_rsi(AMX)) %>% available = n_rsi(AMX)) %>%
knitr::kable(align = "c", big.mark = ",") knitr::kable(align = "c", big.mark = ",")
``` ```
@ -356,16 +356,16 @@ These functions can also be used to get the portion of multiple antibiotics, to
```{r, eval = FALSE} ```{r, eval = FALSE}
data_1st %>% data_1st %>%
group_by(genus) %>% group_by(genus) %>%
summarise(amoxiclav = portion_S(AMC), summarise(amoxiclav = portion_SI(AMC),
gentamicin = portion_S(GEN), gentamicin = portion_SI(GEN),
amoxiclav_genta = portion_S(AMC, GEN)) amoxiclav_genta = portion_SI(AMC, GEN))
``` ```
```{r, echo = FALSE} ```{r, echo = FALSE}
data_1st %>% data_1st %>%
group_by(genus) %>% group_by(genus) %>%
summarise(amoxiclav = portion_S(AMC), summarise(amoxiclav = portion_SI(AMC),
gentamicin = portion_S(GEN), gentamicin = portion_SI(GEN),
amoxiclav_genta = portion_S(AMC, GEN)) %>% amoxiclav_genta = portion_SI(AMC, GEN)) %>%
knitr::kable(align = "c", big.mark = ",") knitr::kable(align = "c", big.mark = ",")
``` ```
@ -374,9 +374,9 @@ To make a transition to the next part, let's see how this difference could be pl
```{r plot 1} ```{r plot 1}
data_1st %>% data_1st %>%
group_by(genus) %>% group_by(genus) %>%
summarise("1. Amoxi/clav" = portion_S(AMC), summarise("1. Amoxi/clav" = portion_SI(AMC),
"2. Gentamicin" = portion_S(GEN), "2. Gentamicin" = portion_SI(GEN),
"3. Amoxi/clav + GEN" = portion_S(AMC, GEN)) %>% "3. Amoxi/clav + genta" = portion_SI(AMC, GEN)) %>%
tidyr::gather("Antibiotic", "S", -genus) %>% tidyr::gather("Antibiotic", "S", -genus) %>%
ggplot(aes(x = genus, ggplot(aes(x = genus,
y = S, y = S,
@ -426,7 +426,7 @@ ggplot(data_1st %>% group_by(genus)) +
scale_rsi_colours() + scale_rsi_colours() +
# show percentages on y axis # show percentages on y axis
scale_y_percent(breaks = 0:4 * 25) + scale_y_percent(breaks = 0:4 * 25) +
# turn 90 degrees, make it bars instead of columns # turn 90 degrees, to make it bars instead of columns
coord_flip() + coord_flip() +
# add labels # add labels
labs(title = "Resistance per genus and antibiotic", labs(title = "Resistance per genus and antibiotic",