mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 20:06:12 +01:00
1311 lines
98 KiB
HTML
1311 lines
98 KiB
HTML
<!DOCTYPE html>
|
||
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||
<title>How to conduct AMR data analysis • AMR (for R)</title>
|
||
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
|
||
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
|
||
<script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||
<link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
|
||
<script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Lato-0.4.9/font.css" rel="stylesheet">
|
||
<link href="../deps/Fira_Code-0.4.9/font.css" rel="stylesheet">
|
||
<link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet">
|
||
<link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet">
|
||
<script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
|
||
<script src="../extra.js"></script><meta property="og:title" content="How to conduct AMR data analysis">
|
||
</head>
|
||
<body>
|
||
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
|
||
|
||
|
||
<nav class="navbar navbar-expand-lg fixed-top bg-primary" data-bs-theme="dark" aria-label="Site navigation"><div class="container">
|
||
|
||
<a class="navbar-brand me-2" href="../index.html">AMR (for R)</a>
|
||
|
||
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9122</small>
|
||
|
||
|
||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
|
||
<span class="navbar-toggler-icon"></span>
|
||
</button>
|
||
|
||
<div id="navbar" class="collapse navbar-collapse ms-3">
|
||
<ul class="navbar-nav me-auto">
|
||
<li class="active nav-item dropdown">
|
||
<button class="nav-link dropdown-toggle" type="button" id="dropdown-how-to" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true"><span class="fa fa-question-circle"></span> How to</button>
|
||
<ul class="dropdown-menu" aria-labelledby="dropdown-how-to">
|
||
<li><a class="dropdown-item" href="../articles/AMR.html"><span class="fa fa-directions"></span> Conduct AMR Analysis</a></li>
|
||
<li><a class="dropdown-item" href="../reference/antibiogram.html"><span class="fa fa-file-prescription"></span> Generate Antibiogram (Trad./Syndromic/WISCA)</a></li>
|
||
<li><a class="dropdown-item" href="../articles/resistance_predict.html"><span class="fa fa-dice"></span> Predict Antimicrobial Resistance</a></li>
|
||
<li><a class="dropdown-item" href="../articles/datasets.html"><span class="fa fa-database"></span> Download Data Sets for Own Use</a></li>
|
||
<li><a class="dropdown-item" href="../articles/AMR_with_tidymodels.html"><span class="fa fa-square-root-variable"></span> Use AMR for Predictive Modelling (tidymodels)</a></li>
|
||
<li><a class="dropdown-item" href="../reference/AMR-options.html"><span class="fa fa-gear"></span> Set User- Or Team-specific Package Settings</a></li>
|
||
<li><a class="dropdown-item" href="../articles/PCA.html"><span class="fa fa-compress"></span> Conduct Principal Component Analysis for AMR</a></li>
|
||
<li><a class="dropdown-item" href="../articles/MDR.html"><span class="fa fa-skull-crossbones"></span> Determine Multi-Drug Resistance (MDR)</a></li>
|
||
<li><a class="dropdown-item" href="../articles/WHONET.html"><span class="fa fa-globe-americas"></span> Work with WHONET Data</a></li>
|
||
<li><a class="dropdown-item" href="../articles/EUCAST.html"><span class="fa fa-exchange-alt"></span> Apply Eucast Rules</a></li>
|
||
<li><a class="dropdown-item" href="../reference/mo_property.html"><span class="fa fa-bug"></span> Get Taxonomy of a Microorganism</a></li>
|
||
<li><a class="dropdown-item" href="../reference/ab_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antibiotic Drug</a></li>
|
||
<li><a class="dropdown-item" href="../reference/av_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antiviral Drug</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-item"><a class="nav-link" href="../articles/AMR_for_Python.html"><span class="fa fab fa-python"></span> AMR for Python</a></li>
|
||
<li class="nav-item"><a class="nav-link" href="../reference/index.html"><span class="fa fa-book-open"></span> Manual</a></li>
|
||
<li class="nav-item"><a class="nav-link" href="../authors.html"><span class="fa fa-users"></span> Authors</a></li>
|
||
</ul>
|
||
<ul class="navbar-nav">
|
||
<li class="nav-item"><a class="nav-link" href="../news/index.html"><span class="fa far fa-newspaper"></span> Changelog</a></li>
|
||
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/msberends/AMR"><span class="fa fab fa-github"></span> Source Code</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
</nav><div class="container template-article">
|
||
|
||
|
||
|
||
|
||
<div class="row">
|
||
<main id="main" class="col-md-9"><div class="page-header">
|
||
<img src="../logo.svg" class="logo" alt=""><h1>How to conduct AMR data analysis</h1>
|
||
|
||
|
||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/vignettes/AMR.Rmd" class="external-link"><code>vignettes/AMR.Rmd</code></a></small>
|
||
<div class="d-none name"><code>AMR.Rmd</code></div>
|
||
</div>
|
||
|
||
|
||
|
||
<p><strong>Note:</strong> values on this page will change with every
|
||
website update since they are based on randomly created values and the
|
||
page was written in <a href="https://rmarkdown.rstudio.com/" class="external-link">R
|
||
Markdown</a>. However, the methodology remains unchanged. This page was
|
||
generated on 20 December 2024.</p>
|
||
<div class="section level2">
|
||
<h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
|
||
</h2>
|
||
<p>Conducting AMR data analysis unfortunately requires in-depth
|
||
knowledge from different scientific fields, which makes it hard to do
|
||
right. At least, it requires:</p>
|
||
<ul>
|
||
<li>Good questions (always start with those!) and reliable data</li>
|
||
<li>A thorough understanding of (clinical) epidemiology, to understand
|
||
the clinical and epidemiological relevance and possible bias of
|
||
results</li>
|
||
<li>A thorough understanding of (clinical) microbiology/infectious
|
||
diseases, to understand which microorganisms are causal to which
|
||
infections and the implications of pharmaceutical treatment, as well as
|
||
understanding intrinsic and acquired microbial resistance</li>
|
||
<li>Experience with data analysis with microbiological tests and their
|
||
results, to understand the determination and limitations of MIC values
|
||
and their interpretations to SIR values</li>
|
||
<li>Availability of the biological taxonomy of microorganisms and
|
||
probably normalisation factors for pharmaceuticals, such as defined
|
||
daily doses (DDD)</li>
|
||
<li>Available (inter-)national guidelines, and profound methods to apply
|
||
them</li>
|
||
</ul>
|
||
<p>Of course, we cannot instantly provide you with knowledge and
|
||
experience. But with this <code>AMR</code> package, we aimed at
|
||
providing (1) tools to simplify antimicrobial resistance data cleaning,
|
||
transformation and analysis, (2) methods to easily incorporate
|
||
international guidelines and (3) scientifically reliable reference data,
|
||
including the requirements mentioned above.</p>
|
||
<p>The <code>AMR</code> package enables standardised and reproducible
|
||
AMR data analysis, with the application of evidence-based rules,
|
||
determination of first isolates, translation of various codes for
|
||
microorganisms and antimicrobial agents, determination of (multi-drug)
|
||
resistant microorganisms, and calculation of antimicrobial resistance,
|
||
prevalence and future trends.</p>
|
||
</div>
|
||
<div class="section level2">
|
||
<h2 id="preparation">Preparation<a class="anchor" aria-label="anchor" href="#preparation"></a>
|
||
</h2>
|
||
<p>For this tutorial, we will create fake demonstration data to work
|
||
with.</p>
|
||
<p>You can skip to <a href="#cleaning-the-data">Cleaning the data</a> if
|
||
you already have your own data ready. If you start your analysis, try to
|
||
make the structure of your data generally look like this:</p>
|
||
<table class="table">
|
||
<thead><tr class="header">
|
||
<th align="center">date</th>
|
||
<th align="center">patient_id</th>
|
||
<th align="center">mo</th>
|
||
<th align="center">AMX</th>
|
||
<th align="center">CIP</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="center">2024-12-20</td>
|
||
<td align="center">abcd</td>
|
||
<td align="center">Escherichia coli</td>
|
||
<td align="center">S</td>
|
||
<td align="center">S</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="center">2024-12-20</td>
|
||
<td align="center">abcd</td>
|
||
<td align="center">Escherichia coli</td>
|
||
<td align="center">S</td>
|
||
<td align="center">R</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="center">2024-12-20</td>
|
||
<td align="center">efgh</td>
|
||
<td align="center">Escherichia coli</td>
|
||
<td align="center">R</td>
|
||
<td align="center">S</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<div class="section level3">
|
||
<h3 id="needed-r-packages">Needed R packages<a class="anchor" aria-label="anchor" href="#needed-r-packages"></a>
|
||
</h3>
|
||
<p>As with many uses in R, we need some additional packages for AMR data
|
||
analysis. Our package works closely together with the <a href="https://www.tidyverse.org" class="external-link">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/" class="external-link"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org" class="external-link"><code>ggplot2</code></a> by
|
||
RStudio. The tidyverse tremendously improves the way we conduct data
|
||
science - it allows for a very natural way of writing syntaxes and
|
||
creating beautiful plots in R.</p>
|
||
<p>We will also use the <code>cleaner</code> package, that can be used
|
||
for cleaning data and creating frequency tables.</p>
|
||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org" class="external-link">dplyr</a></span><span class="op">)</span></span></code></pre></div>
|
||
<p>Error in get(paste0(generic, “.”, class), envir = get_method_env()) :
|
||
object ‘type_sum.accel’ not found</p>
|
||
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://ggplot2.tidyverse.org" class="external-link">ggplot2</a></span><span class="op">)</span></span>
|
||
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://msberends.github.io/AMR/">AMR</a></span><span class="op">)</span></span>
|
||
<span></span>
|
||
<span><span class="co"># (if not yet installed, install with:)</span></span>
|
||
<span><span class="co"># install.packages(c("dplyr", "ggplot2", "AMR"))</span></span></code></pre></div>
|
||
<p>The <code>AMR</code> package contains a data set
|
||
<code>example_isolates_unclean</code>, which might look data that users
|
||
have extracted from their laboratory systems:</p>
|
||
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">example_isolates_unclean</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 3,000 × 8</span></span></span>
|
||
<span><span class="co">#> patient_id hospital date bacteria AMX AMC CIP GEN </span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> J3 A 2012-11-21 E. coli R I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> R7 A 2018-04-03 K. pneumoniae R I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> P3 A 2014-09-19 E. coli R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> P10 A 2015-12-10 E. coli S I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B7 A 2015-03-02 E. coli S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> W3 A 2018-03-31 S. aureus R S R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> J8 A 2016-06-14 E. coli R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> M3 A 2015-10-25 E. coli R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> J3 A 2019-06-19 E. coli S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> G6 A 2015-04-27 S. aureus S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 2,990 more rows</span></span></span>
|
||
<span></span>
|
||
<span><span class="co"># we will use 'our_data' as the data set name for this tutorial</span></span>
|
||
<span><span class="va">our_data</span> <span class="op"><-</span> <span class="va">example_isolates_unclean</span></span></code></pre></div>
|
||
<p>For AMR data analysis, we would like the microorganism column to
|
||
contain valid, up-to-date taxonomy, and the antibiotic columns to be
|
||
cleaned as SIR values as well.</p>
|
||
</div>
|
||
<div class="section level3">
|
||
<h3 id="taxonomy-of-microorganisms">Taxonomy of microorganisms<a class="anchor" aria-label="anchor" href="#taxonomy-of-microorganisms"></a>
|
||
</h3>
|
||
<p>With <code><a href="../reference/as.mo.html">as.mo()</a></code>, users can transform arbitrary
|
||
microorganism names or codes to current taxonomy. The <code>AMR</code>
|
||
package contains up-to-date taxonomic data. To be specific, currently
|
||
included data were retrieved on 24 Jun 2024.</p>
|
||
<p>The codes of the AMR packages that come from <code><a href="../reference/as.mo.html">as.mo()</a></code> are
|
||
short, but still human readable. More importantly, <code><a href="../reference/as.mo.html">as.mo()</a></code>
|
||
supports all kinds of input:</p>
|
||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"Klebsiella pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> Class 'mo'</span></span>
|
||
<span><span class="co">#> [1] B_KLBSL_PNMN</span></span>
|
||
<span><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"K. pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> Class 'mo'</span></span>
|
||
<span><span class="co">#> [1] B_KLBSL_PNMN</span></span>
|
||
<span><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"KLEPNE"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> Class 'mo'</span></span>
|
||
<span><span class="co">#> [1] B_KLBSL_PNMN</span></span>
|
||
<span><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"KLPN"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> Class 'mo'</span></span>
|
||
<span><span class="co">#> [1] B_KLBSL_PNMN</span></span></code></pre></div>
|
||
<p>The first character in above codes denote their taxonomic kingdom,
|
||
such as Bacteria (B), Fungi (F), and Protozoa (P).</p>
|
||
<p>The <code>AMR</code> package also contain functions to directly
|
||
retrieve taxonomic properties, such as the name, genus, species, family,
|
||
order, and even Gram-stain. They all start with <code>mo_</code> and
|
||
they use <code><a href="../reference/as.mo.html">as.mo()</a></code> internally, so that still any arbitrary
|
||
user input can be used:</p>
|
||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="../reference/mo_property.html">mo_family</a></span><span class="op">(</span><span class="st">"K. pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> [1] "Enterobacteriaceae"</span></span>
|
||
<span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="st">"K. pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> [1] "Klebsiella"</span></span>
|
||
<span><span class="fu"><a href="../reference/mo_property.html">mo_species</a></span><span class="op">(</span><span class="st">"K. pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> [1] "pneumoniae"</span></span>
|
||
<span></span>
|
||
<span><span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span><span class="op">(</span><span class="st">"Klebsiella pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> [1] "Gram-negative"</span></span>
|
||
<span></span>
|
||
<span><span class="fu"><a href="../reference/mo_property.html">mo_ref</a></span><span class="op">(</span><span class="st">"K. pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> [1] "Trevisan, 1887"</span></span>
|
||
<span></span>
|
||
<span><span class="fu"><a href="../reference/mo_property.html">mo_snomed</a></span><span class="op">(</span><span class="st">"K. pneumoniae"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> [[1]]</span></span>
|
||
<span><span class="co">#> [1] "1098101000112102" "446870005" "1098201000112108" "409801009" </span></span>
|
||
<span><span class="co">#> [5] "56415008" "714315002" "713926009"</span></span></code></pre></div>
|
||
<p>Now we can thus clean our data:</p>
|
||
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data</span><span class="op">$</span><span class="va">bacteria</span> <span class="op"><-</span> <span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="va">our_data</span><span class="op">$</span><span class="va">bacteria</span>, info <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ Microorganism translation was uncertain for four microorganisms. Run</span></span>
|
||
<span><span class="co">#> mo_uncertainties() to review these uncertainties, or use</span></span>
|
||
<span><span class="co">#> add_custom_microorganisms() to add custom entries.</span></span></code></pre></div>
|
||
<p>Apparently, there was some uncertainty about the translation to
|
||
taxonomic codes. Let’s check this:</p>
|
||
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="../reference/as.mo.html">mo_uncertainties</a></span><span class="op">(</span><span class="op">)</span></span>
|
||
<span><span class="co">#> Matching scores are based on the resemblance between the input and the full</span></span>
|
||
<span><span class="co">#> taxonomic name, and the pathogenicity in humans. See ?mo_matching_score.</span></span>
|
||
<span><span class="co">#> </span></span>
|
||
<span><span class="co">#> --------------------------------------------------------------------------------</span></span>
|
||
<span><span class="co">#> "E. coli" -> Escherichia coli (B_ESCHR_COLI, 0.688)</span></span>
|
||
<span><span class="co">#> Also matched: Enterococcus crotali (0.650), Escherichia coli coli</span></span>
|
||
<span><span class="co">#> (0.643), Escherichia coli expressing (0.611), Enterobacter cowanii</span></span>
|
||
<span><span class="co">#> (0.600), Enterococcus columbae (0.595), Enterococcus camelliae (0.591),</span></span>
|
||
<span><span class="co">#> Enterococcus casseliflavus (0.577), Enterobacter cloacae cloacae</span></span>
|
||
<span><span class="co">#> (0.571), Enterobacter cloacae complex (0.571), and Enterobacter cloacae</span></span>
|
||
<span><span class="co">#> dissolvens (0.565)</span></span>
|
||
<span><span class="co">#> --------------------------------------------------------------------------------</span></span>
|
||
<span><span class="co">#> "K. pneumoniae" -> Klebsiella pneumoniae (B_KLBSL_PNMN, 0.786)</span></span>
|
||
<span><span class="co">#> Also matched: Klebsiella pneumoniae ozaenae (0.707), Klebsiella</span></span>
|
||
<span><span class="co">#> pneumoniae pneumoniae (0.688), Klebsiella pneumoniae rhinoscleromatis</span></span>
|
||
<span><span class="co">#> (0.658), Klebsiella pasteurii (0.500), Klebsiella planticola (0.500),</span></span>
|
||
<span><span class="co">#> Kingella potus (0.400), Kluyveromyces pseudotropicale (0.386),</span></span>
|
||
<span><span class="co">#> Kluyveromyces pseudotropicalis (0.363), Kosakonia pseudosacchari</span></span>
|
||
<span><span class="co">#> (0.361), and Kluyveromyces pseudotropicalis pseudotropicalis (0.361)</span></span>
|
||
<span><span class="co">#> --------------------------------------------------------------------------------</span></span>
|
||
<span><span class="co">#> "S. aureus" -> Staphylococcus aureus (B_STPHY_AURS, 0.690)</span></span>
|
||
<span><span class="co">#> Also matched: Staphylococcus aureus aureus (0.643), Staphylococcus</span></span>
|
||
<span><span class="co">#> argenteus (0.625), Staphylococcus aureus anaerobius (0.625),</span></span>
|
||
<span><span class="co">#> Staphylococcus auricularis (0.615), Salmonella Aurelianis (0.595),</span></span>
|
||
<span><span class="co">#> Salmonella Aarhus (0.588), Salmonella Amounderness (0.587),</span></span>
|
||
<span><span class="co">#> Staphylococcus argensis (0.587), Streptococcus australis (0.587), and</span></span>
|
||
<span><span class="co">#> Salmonella choleraesuis arizonae (0.562)</span></span>
|
||
<span><span class="co">#> --------------------------------------------------------------------------------</span></span>
|
||
<span><span class="co">#> "S. pneumoniae" -> Streptococcus pneumoniae (B_STRPT_PNMN, 0.750)</span></span>
|
||
<span><span class="co">#> Also matched: Streptococcus pseudopneumoniae (0.700), Streptococcus</span></span>
|
||
<span><span class="co">#> phocae salmonis (0.552), Serratia proteamaculans quinovora (0.545),</span></span>
|
||
<span><span class="co">#> Streptococcus pseudoporcinus (0.536), Staphylococcus piscifermentans</span></span>
|
||
<span><span class="co">#> (0.533), Staphylococcus pseudintermedius (0.532), Serratia</span></span>
|
||
<span><span class="co">#> proteamaculans proteamaculans (0.526), Streptococcus gallolyticus</span></span>
|
||
<span><span class="co">#> pasteurianus (0.526), Salmonella Portanigra (0.524), and Streptococcus</span></span>
|
||
<span><span class="co">#> periodonticum (0.519)</span></span>
|
||
<span><span class="co">#> </span></span>
|
||
<span><span class="co">#> Only the first 10 other matches of each record are shown. Run</span></span>
|
||
<span><span class="co">#> print(mo_uncertainties(), n = ...) to view more entries, or save</span></span>
|
||
<span><span class="co">#> mo_uncertainties() to an object.</span></span></code></pre></div>
|
||
<p>That’s all good.</p>
|
||
</div>
|
||
<div class="section level3">
|
||
<h3 id="antibiotic-results">Antibiotic results<a class="anchor" aria-label="anchor" href="#antibiotic-results"></a>
|
||
</h3>
|
||
<p>The column with antibiotic test results must also be cleaned. The
|
||
<code>AMR</code> package comes with three new data types to work with
|
||
such test results: <code>mic</code> for minimal inhibitory
|
||
concentrations (MIC), <code>disk</code> for disk diffusion diameters,
|
||
and <code>sir</code> for SIR data that have been interpreted already.
|
||
This package can also determine SIR values based on MIC or disk
|
||
diffusion values, read more about that on the <code><a href="../reference/as.sir.html">as.sir()</a></code>
|
||
page.</p>
|
||
<p>For now, we will just clean the SIR columns in our data using
|
||
dplyr:</p>
|
||
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="co"># method 1, be explicit about the columns:</span></span>
|
||
<span><span class="va">our_data</span> <span class="op"><-</span> <span class="va">our_data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_at</a></span><span class="op">(</span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/vars.html" class="external-link">vars</a></span><span class="op">(</span><span class="va">AMX</span><span class="op">:</span><span class="va">GEN</span><span class="op">)</span>, <span class="va">as.sir</span><span class="op">)</span></span>
|
||
<span></span>
|
||
<span><span class="co"># method 2, let the AMR package determine the eligible columns</span></span>
|
||
<span><span class="va">our_data</span> <span class="op"><-</span> <span class="va">our_data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is_sir_eligible</span>, <span class="va">as.sir</span><span class="op">)</span></span>
|
||
<span></span>
|
||
<span><span class="co"># result:</span></span>
|
||
<span><span class="va">our_data</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 3,000 × 8</span></span></span>
|
||
<span><span class="co">#> patient_id hospital date bacteria AMX AMC CIP GEN </span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> J3 A 2012-11-21 B_ESCHR_COLI R I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> R7 A 2018-04-03 B_KLBSL_PNMN R I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> P3 A 2014-09-19 B_ESCHR_COLI R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> P10 A 2015-12-10 B_ESCHR_COLI S I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B7 A 2015-03-02 B_ESCHR_COLI S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> W3 A 2018-03-31 B_STPHY_AURS R S R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> J8 A 2016-06-14 B_ESCHR_COLI R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> M3 A 2015-10-25 B_ESCHR_COLI R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> J3 A 2019-06-19 B_ESCHR_COLI S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> G6 A 2015-04-27 B_STPHY_AURS S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 2,990 more rows</span></span></span></code></pre></div>
|
||
<p>This is basically it for the cleaning, time to start the data
|
||
inclusion.</p>
|
||
</div>
|
||
<div class="section level3">
|
||
<h3 id="first-isolates">First isolates<a class="anchor" aria-label="anchor" href="#first-isolates"></a>
|
||
</h3>
|
||
<p>We need to know which isolates we can <em>actually</em> use for
|
||
analysis without repetition bias.</p>
|
||
<p>To conduct an analysis of antimicrobial resistance, you must <a href="https:/pubmed.ncbi.nlm.nih.gov/17304462/">only include the first
|
||
isolate of every patient per episode</a> (Hindler <em>et al.</em>, Clin
|
||
Infect Dis. 2007). If you would not do this, you could easily get an
|
||
overestimate or underestimate of the resistance of an antibiotic.
|
||
Imagine that a patient was admitted with an MRSA and that it was found
|
||
in 5 different blood cultures the following weeks (yes, some countries
|
||
like the Netherlands have these blood drawing policies). The resistance
|
||
percentage of oxacillin of all isolates would be overestimated, because
|
||
you included this MRSA more than once. It would clearly be <a href="https://en.wikipedia.org/wiki/Selection_bias" class="external-link">selection
|
||
bias</a>.</p>
|
||
<p>The Clinical and Laboratory Standards Institute (CLSI) appoints this
|
||
as follows:</p>
|
||
<blockquote>
|
||
<p><em>(…) When preparing a cumulative antibiogram to guide clinical
|
||
decisions about empirical antimicrobial therapy of initial infections,
|
||
<strong>only the first isolate of a given species per patient, per
|
||
analysis period (eg, one year) should be included, irrespective of body
|
||
site, antimicrobial susceptibility profile, or other phenotypical
|
||
characteristics (eg, biotype)</strong>. The first isolate is easily
|
||
identified, and cumulative antimicrobial susceptibility test data
|
||
prepared using the first isolate are generally comparable to cumulative
|
||
antimicrobial susceptibility test data calculated by other methods,
|
||
providing duplicate isolates are excluded.</em> <br><a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="external-link">M39-A4
|
||
Analysis and Presentation of Cumulative Antimicrobial Susceptibility
|
||
Test Data, 4th Edition. CLSI, 2014. Chapter 6.4</a></p>
|
||
</blockquote>
|
||
<p>This <code>AMR</code> package includes this methodology with the
|
||
<code><a href="../reference/first_isolate.html">first_isolate()</a></code> function and is able to apply the four
|
||
different methods as defined by <a href="https://academic.oup.com/cid/article/44/6/867/364325" class="external-link">Hindler
|
||
<em>et al.</em> in 2007</a>: phenotype-based, episode-based,
|
||
patient-based, isolate-based. The right method depends on your goals and
|
||
analysis, but the default phenotype-based method is in any case the
|
||
method to properly correct for most duplicate isolates. Read more about
|
||
the methods on the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> page.</p>
|
||
<p>The outcome of the function can easily be added to our data:</p>
|
||
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data</span> <span class="op"><-</span> <span class="va">our_data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span>first <span class="op">=</span> <span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span><span class="op">(</span>info <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ Determining first isolates using an episode length of 365 days</span></span>
|
||
<span><span class="co">#> ℹ Using column 'bacteria' as input for col_mo.</span></span>
|
||
<span><span class="co">#> ℹ Using column 'date' as input for col_date.</span></span>
|
||
<span><span class="co">#> ℹ Using column 'patient_id' as input for col_patient_id.</span></span>
|
||
<span><span class="co">#> ℹ Basing inclusion on all antimicrobial results, using a points threshold</span></span>
|
||
<span><span class="co">#> of 2</span></span>
|
||
<span><span class="co">#> => Found 2,724 'phenotype-based' first isolates (90.8% of total where a</span></span>
|
||
<span><span class="co">#> microbial ID was available)</span></span></code></pre></div>
|
||
<p>So only 91% 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="cb10"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data_1st</span> <span class="op"><-</span> <span class="va">our_data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="va">first</span> <span class="op">==</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
|
||
<p>For future use, the above two syntaxes can be shortened:</p>
|
||
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data_1st</span> <span class="op"><-</span> <span class="va">our_data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</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></code></pre></div>
|
||
<p>So we end up with 2 724 isolates for analysis. Now our data looks
|
||
like:</p>
|
||
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data_1st</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 2,724 × 9</span></span></span>
|
||
<span><span class="co">#> patient_id hospital date bacteria AMX AMC CIP GEN first</span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><lgl></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> J3 A 2012-11-21 B_ESCHR_COLI R I S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> R7 A 2018-04-03 B_KLBSL_PNMN R I S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> P3 A 2014-09-19 B_ESCHR_COLI R S S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> P10 A 2015-12-10 B_ESCHR_COLI S I S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B7 A 2015-03-02 B_ESCHR_COLI S S S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> W3 A 2018-03-31 B_STPHY_AURS R S R S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> M3 A 2015-10-25 B_ESCHR_COLI R S S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> J3 A 2019-06-19 B_ESCHR_COLI S S S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> G6 A 2015-04-27 B_STPHY_AURS S S S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> P4 A 2011-06-21 B_ESCHR_COLI S S S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 2,714 more rows</span></span></span></code></pre></div>
|
||
<p>Time for the analysis.</p>
|
||
</div>
|
||
</div>
|
||
<div class="section level2">
|
||
<h2 id="analysing-the-data">Analysing the data<a class="anchor" aria-label="anchor" href="#analysing-the-data"></a>
|
||
</h2>
|
||
<p>The base R <code><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary()</a></code> function gives a good first
|
||
impression, as it comes with support for the new <code>mo</code> and
|
||
<code>sir</code> classes that we now have in our data set:</p>
|
||
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">our_data_1st</span><span class="op">)</span></span>
|
||
<span><span class="co">#> patient_id hospital date </span></span>
|
||
<span><span class="co">#> Length:2724 Length:2724 Min. :2011-01-01 </span></span>
|
||
<span><span class="co">#> Class :character Class :character 1st Qu.:2013-04-07 </span></span>
|
||
<span><span class="co">#> Mode :character Mode :character Median :2015-06-03 </span></span>
|
||
<span><span class="co">#> Mean :2015-06-09 </span></span>
|
||
<span><span class="co">#> 3rd Qu.:2017-08-11 </span></span>
|
||
<span><span class="co">#> Max. :2019-12-27 </span></span>
|
||
<span><span class="co">#> bacteria AMX AMC </span></span>
|
||
<span><span class="co">#> Class :mo Class:sir Class:sir </span></span>
|
||
<span><span class="co">#> <NA> :0 %S :41.6% (n=1133) %S :52.6% (n=1432) </span></span>
|
||
<span><span class="co">#> Unique:4 %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span></span>
|
||
<span><span class="co">#> #1 :B_ESCHR_COLI %I :16.4% (n=446) %I :12.2% (n=333) </span></span>
|
||
<span><span class="co">#> #2 :B_STPHY_AURS %R :42.0% (n=1145) %R :35.2% (n=959) </span></span>
|
||
<span><span class="co">#> #3 :B_STRPT_PNMN %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span></span>
|
||
<span><span class="co">#> CIP GEN first </span></span>
|
||
<span><span class="co">#> Class:sir Class:sir Mode:logical </span></span>
|
||
<span><span class="co">#> %S :52.5% (n=1431) %S :61.0% (n=1661) TRUE:2724 </span></span>
|
||
<span><span class="co">#> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span></span>
|
||
<span><span class="co">#> %I : 6.5% (n=176) %I : 3.0% (n=82) </span></span>
|
||
<span><span class="co">#> %R :41.0% (n=1117) %R :36.0% (n=981) </span></span>
|
||
<span><span class="co">#> %NI : 0.0% (n=0) %NI : 0.0% (n=0)</span></span>
|
||
<span></span>
|
||
<span><span class="fu"><a href="https://pillar.r-lib.org/reference/glimpse.html" class="external-link">glimpse</a></span><span class="op">(</span><span class="va">our_data_1st</span><span class="op">)</span></span>
|
||
<span><span class="co">#> Rows: 2,724</span></span>
|
||
<span><span class="co">#> Columns: 9</span></span>
|
||
<span><span class="co">#> $ patient_id <span style="color: #949494; font-style: italic;"><chr></span> "J3", "R7", "P3", "P10", "B7", "W3", "M3", "J3", "G6", "P4"…</span></span>
|
||
<span><span class="co">#> $ hospital <span style="color: #949494; font-style: italic;"><chr></span> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",…</span></span>
|
||
<span><span class="co">#> $ date <span style="color: #949494; font-style: italic;"><date></span> 2012-11-21, 2018-04-03, 2014-09-19, 2015-12-10, 2015-03-02…</span></span>
|
||
<span><span class="co">#> $ bacteria <span style="color: #949494; font-style: italic;"><mo></span> "B_ESCHR_COLI", "B_KLBSL_PNMN", "B_ESCHR_COLI", "B_ESCHR_COL…</span></span>
|
||
<span><span class="co">#> $ AMX <span style="color: #949494; font-style: italic;"><sir></span> R, R, R, S, S, R, R, S, S, S, S, R, S, S, R, R, R, R, S, R,…</span></span>
|
||
<span><span class="co">#> $ AMC <span style="color: #949494; font-style: italic;"><sir></span> I, I, S, I, S, S, S, S, S, S, S, S, S, S, S, S, S, R, S, S,…</span></span>
|
||
<span><span class="co">#> $ CIP <span style="color: #949494; font-style: italic;"><sir></span> S, S, S, S, S, R, S, S, S, S, S, S, S, S, S, S, S, S, S, S,…</span></span>
|
||
<span><span class="co">#> $ GEN <span style="color: #949494; font-style: italic;"><sir></span> S, S, S, S, S, S, S, S, S, S, S, R, S, S, S, S, S, S, S, S,…</span></span>
|
||
<span><span class="co">#> $ first <span style="color: #949494; font-style: italic;"><lgl></span> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…</span></span>
|
||
<span></span>
|
||
<span><span class="co"># number of unique values per column:</span></span>
|
||
<span><span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">sapply</a></span><span class="op">(</span><span class="va">our_data_1st</span>, <span class="va">n_distinct</span><span class="op">)</span></span>
|
||
<span><span class="co">#> patient_id hospital date bacteria AMX AMC CIP </span></span>
|
||
<span><span class="co">#> 260 3 1854 4 3 3 3 </span></span>
|
||
<span><span class="co">#> GEN first </span></span>
|
||
<span><span class="co">#> 3 1</span></span></code></pre></div>
|
||
<div class="section level3">
|
||
<h3 id="availability-of-species">Availability of species<a class="anchor" aria-label="anchor" href="#availability-of-species"></a>
|
||
</h3>
|
||
<p>To just get an idea how the species are distributed, create a
|
||
frequency table with <code><a href="../reference/count.html">count()</a></code> based on the name of the
|
||
microorganisms:</p>
|
||
<div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="../reference/count.html">count</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="va">bacteria</span><span class="op">)</span>, sort <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 4 × 2</span></span></span>
|
||
<span><span class="co">#> `mo_name(bacteria)` n</span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><int></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">1</span> Escherichia coli <span style="text-decoration: underline;">1</span>518</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">2</span> Staphylococcus aureus 730</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">3</span> Streptococcus pneumoniae 426</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">4</span> Klebsiella pneumoniae 326</span></span>
|
||
<span></span>
|
||
<span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="../reference/count.html">count</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_name</a></span><span class="op">(</span><span class="va">bacteria</span><span class="op">)</span>, sort <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 4 × 2</span></span></span>
|
||
<span><span class="co">#> `mo_name(bacteria)` n</span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><int></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">1</span> Escherichia coli <span style="text-decoration: underline;">1</span>321</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">2</span> Staphylococcus aureus 682</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">3</span> Streptococcus pneumoniae 402</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">4</span> Klebsiella pneumoniae 319</span></span></code></pre></div>
|
||
</div>
|
||
<div class="section level3">
|
||
<h3 id="select-and-filter-with-antibiotic-selectors">Select and filter with antibiotic selectors<a class="anchor" aria-label="anchor" href="#select-and-filter-with-antibiotic-selectors"></a>
|
||
</h3>
|
||
<p>Using so-called antibiotic class selectors, you can select or filter
|
||
columns based on the antibiotic class that your antibiotic results are
|
||
in:</p>
|
||
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<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="va">date</span>, <span class="fu"><a href="../reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ For aminoglycosides() using column 'GEN' (gentamicin)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 2,724 × 2</span></span></span>
|
||
<span><span class="co">#> date GEN </span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><sir></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> 2012-11-21 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> 2018-04-03 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> 2014-09-19 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> 2015-12-10 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> 2015-03-02 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> 2018-03-31 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> 2015-10-25 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> 2019-06-19 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> 2015-04-27 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> 2011-06-21 S </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 2,714 more rows</span></span></span>
|
||
<span></span>
|
||
<span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<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="va">bacteria</span>, <span class="fu"><a href="../reference/antibiotic_class_selectors.html">betalactams</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ For betalactams() using columns 'AMX' (amoxicillin) and 'AMC'</span></span>
|
||
<span><span class="co">#> (amoxicillin/clavulanic acid)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 2,724 × 3</span></span></span>
|
||
<span><span class="co">#> bacteria AMX AMC </span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> B_ESCHR_COLI R I </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> B_KLBSL_PNMN R I </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> B_ESCHR_COLI R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> B_ESCHR_COLI S I </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B_ESCHR_COLI S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> B_STPHY_AURS R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> B_ESCHR_COLI R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> B_ESCHR_COLI S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> B_STPHY_AURS S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> B_ESCHR_COLI S S </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 2,714 more rows</span></span></span>
|
||
<span></span>
|
||
<span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<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="va">bacteria</span>, <span class="fu"><a href="https://tidyselect.r-lib.org/reference/where.html" class="external-link">where</a></span><span class="op">(</span><span class="va">is.sir</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 2,724 × 5</span></span></span>
|
||
<span><span class="co">#> bacteria AMX AMC CIP GEN </span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> B_ESCHR_COLI R I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> B_KLBSL_PNMN R I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> B_ESCHR_COLI R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> B_ESCHR_COLI S I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B_ESCHR_COLI S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> B_STPHY_AURS R S R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> B_ESCHR_COLI R S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> B_ESCHR_COLI S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> B_STPHY_AURS S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> B_ESCHR_COLI S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 2,714 more rows</span></span></span>
|
||
<span></span>
|
||
<span><span class="co"># filtering using AB selectors is also possible:</span></span>
|
||
<span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu"><a href="../reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ For aminoglycosides() using column 'GEN' (gentamicin)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 981 × 9</span></span></span>
|
||
<span><span class="co">#> patient_id hospital date bacteria AMX AMC CIP GEN first</span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><lgl></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> J5 A 2017-12-25 B_STRPT_PNMN R S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> X1 A 2017-07-04 B_STPHY_AURS R S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> B3 A 2016-07-24 B_ESCHR_COLI S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> V7 A 2012-04-03 B_ESCHR_COLI S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> C9 A 2017-03-23 B_ESCHR_COLI S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> R1 A 2018-06-10 B_STPHY_AURS S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> S2 A 2013-07-19 B_STRPT_PNMN S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> P5 A 2019-03-09 B_STPHY_AURS S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> Q8 A 2019-08-10 B_STPHY_AURS S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> K5 A 2013-03-15 B_STRPT_PNMN S S S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 971 more rows</span></span></span>
|
||
<span></span>
|
||
<span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/all.html" class="external-link">all</a></span><span class="op">(</span><span class="fu"><a href="../reference/antibiotic_class_selectors.html">betalactams</a></span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ For betalactams() using columns 'AMX' (amoxicillin) and 'AMC'</span></span>
|
||
<span><span class="co">#> (amoxicillin/clavulanic acid)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 462 × 9</span></span></span>
|
||
<span><span class="co">#> patient_id hospital date bacteria AMX AMC CIP GEN first</span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><lgl></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> M7 A 2013-07-22 B_STRPT_PNMN R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> R10 A 2013-12-20 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> R7 A 2015-10-25 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> R8 A 2019-10-25 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B6 A 2016-11-20 B_ESCHR_COLI R R R R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> I7 A 2015-08-19 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> N3 A 2014-12-29 B_STRPT_PNMN R R R S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> Q2 A 2019-09-22 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> X7 A 2011-03-20 B_ESCHR_COLI R R S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> V1 A 2018-08-07 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 452 more rows</span></span></span>
|
||
<span></span>
|
||
<span><span class="co"># even works in base R (since R 3.0):</span></span>
|
||
<span><span class="va">our_data_1st</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/all.html" class="external-link">all</a></span><span class="op">(</span><span class="fu"><a href="../reference/antibiotic_class_selectors.html">betalactams</a></span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span>, <span class="op">]</span></span>
|
||
<span><span class="co">#> ℹ For betalactams() using columns 'AMX' (amoxicillin) and 'AMC'</span></span>
|
||
<span><span class="co">#> (amoxicillin/clavulanic acid)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 462 × 9</span></span></span>
|
||
<span><span class="co">#> patient_id hospital date bacteria AMX AMC CIP GEN first</span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><lgl></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> M7 A 2013-07-22 B_STRPT_PNMN R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> R10 A 2013-12-20 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> R7 A 2015-10-25 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> R8 A 2019-10-25 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B6 A 2016-11-20 B_ESCHR_COLI R R R R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> I7 A 2015-08-19 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> N3 A 2014-12-29 B_STRPT_PNMN R R R S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> Q2 A 2019-09-22 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> X7 A 2011-03-20 B_ESCHR_COLI R R S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> V1 A 2018-08-07 B_STPHY_AURS R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 452 more rows</span></span></span></code></pre></div>
|
||
</div>
|
||
<div class="section level3">
|
||
<h3 id="generate-antibiograms">Generate antibiograms<a class="anchor" aria-label="anchor" href="#generate-antibiograms"></a>
|
||
</h3>
|
||
<p>Since AMR v2.0 (March 2023), it is very easy to create different
|
||
types of antibiograms, with support for 20 different languages.</p>
|
||
<p>There are four antibiogram types, as proposed by Klinker <em>et
|
||
al.</em> (2021, <a href="https://doi.org/10.1177/20499361211011373" class="external-link">DOI
|
||
10.1177/20499361211011373</a>), and they are all supported by the new
|
||
<code><a href="../reference/antibiogram.html">antibiogram()</a></code> function:</p>
|
||
<ol style="list-style-type: decimal">
|
||
<li>
|
||
<strong>Traditional Antibiogram (TA)</strong> e.g, for the
|
||
susceptibility of <em>Pseudomonas aeruginosa</em> to
|
||
piperacillin/tazobactam (TZP)</li>
|
||
<li>
|
||
<strong>Combination Antibiogram (CA)</strong> e.g, for the
|
||
sdditional susceptibility of <em>Pseudomonas aeruginosa</em> to TZP +
|
||
tobramycin versus TZP alone</li>
|
||
<li>
|
||
<strong>Syndromic Antibiogram (SA)</strong> e.g, for the
|
||
susceptibility of <em>Pseudomonas aeruginosa</em> to TZP among
|
||
respiratory specimens (obtained among ICU patients only)</li>
|
||
<li>
|
||
<strong>Weighted-Incidence Syndromic Combination Antibiogram
|
||
(WISCA)</strong> e.g, for the susceptibility of <em>Pseudomonas
|
||
aeruginosa</em> to TZP among respiratory specimens (obtained among ICU
|
||
patients only) for male patients age >=65 years with heart
|
||
failure</li>
|
||
</ol>
|
||
<p>In this section, we show how to use the <code><a href="../reference/antibiogram.html">antibiogram()</a></code>
|
||
function to create any of the above antibiogram types. For starters,
|
||
this is what the included <code>example_isolates</code> data set looks
|
||
like:</p>
|
||
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">example_isolates</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 2,000 × 46</span></span></span>
|
||
<span><span class="co">#> date patient age gender ward mo PEN OXA FLC AMX </span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><date></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><mo></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span> <span style="color: #949494; font-style: italic;"><sir></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 2</span> 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 3</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 1,990 more rows</span></span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,</span></span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,</span></span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,</span></span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,</span></span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,</span></span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …</span></span></span></code></pre></div>
|
||
<div class="section level4">
|
||
<h4 id="traditional-antibiogram">Traditional Antibiogram<a class="anchor" aria-label="anchor" href="#traditional-antibiogram"></a>
|
||
</h4>
|
||
<p>To create a traditional antibiogram, simply state which antibiotics
|
||
should be used. The <code>antibiotics</code> argument in the
|
||
<code><a href="../reference/antibiogram.html">antibiogram()</a></code> function supports any (combination) of the
|
||
previously mentioned antibiotic class selectors:</p>
|
||
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">example_isolates</span>,</span>
|
||
<span> antibiotics <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fu"><a href="../reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="../reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ The function aminoglycosides() should be used inside a dplyr verb or</span></span>
|
||
<span><span class="co">#> data.frame call, e.g.:</span></span>
|
||
<span><span class="co">#> • your_data %>% select(aminoglycosides())</span></span>
|
||
<span><span class="co">#> • your_data %>% select(column_a, column_b, aminoglycosides())</span></span>
|
||
<span><span class="co">#> • your_data %>% filter(any(aminoglycosides() == "R"))</span></span>
|
||
<span><span class="co">#> • your_data[, aminoglycosides()]</span></span>
|
||
<span><span class="co">#> • your_data[, c("column_a", "column_b", aminoglycosides())]</span></span>
|
||
<span><span class="co">#> </span></span>
|
||
<span><span class="co">#> Now returning a vector of all possible antimicrobials that</span></span>
|
||
<span><span class="co">#> aminoglycosides() can select.</span></span>
|
||
<span><span class="co">#> ℹ The function carbapenems() should be used inside a dplyr verb or</span></span>
|
||
<span><span class="co">#> data.frame call, e.g.:</span></span>
|
||
<span><span class="co">#> • your_data %>% select(carbapenems())</span></span>
|
||
<span><span class="co">#> • your_data %>% select(column_a, column_b, carbapenems())</span></span>
|
||
<span><span class="co">#> • your_data %>% filter(any(carbapenems() == "R"))</span></span>
|
||
<span><span class="co">#> • your_data[, carbapenems()]</span></span>
|
||
<span><span class="co">#> • your_data[, c("column_a", "column_b", carbapenems())]</span></span>
|
||
<span><span class="co">#> </span></span>
|
||
<span><span class="co">#> Now returning a vector of all possible antimicrobials that carbapenems()</span></span>
|
||
<span><span class="co">#> can select.</span></span></code></pre></div>
|
||
<table class="table">
|
||
<colgroup>
|
||
<col width="16%">
|
||
<col width="14%">
|
||
<col width="13%">
|
||
<col width="14%">
|
||
<col width="10%">
|
||
<col width="14%">
|
||
<col width="13%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Pathogen</th>
|
||
<th align="left">Amikacin</th>
|
||
<th align="left">Gentamicin</th>
|
||
<th align="left">Imipenem</th>
|
||
<th align="left">Kanamycin</th>
|
||
<th align="left">Meropenem</th>
|
||
<th align="left">Tobramycin</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">CoNS</td>
|
||
<td align="left">0% (0/43)</td>
|
||
<td align="left">86% (267/309)</td>
|
||
<td align="left">52% (25/48)</td>
|
||
<td align="left">0% (0/43)</td>
|
||
<td align="left">52% (25/48)</td>
|
||
<td align="left">22% (12/55)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>E. coli</em></td>
|
||
<td align="left">100% (171/171)</td>
|
||
<td align="left">98% (451/460)</td>
|
||
<td align="left">100% (422/422)</td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (418/418)</td>
|
||
<td align="left">97% (450/462)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>E. faecalis</em></td>
|
||
<td align="left">0% (0/39)</td>
|
||
<td align="left">0% (0/39)</td>
|
||
<td align="left">100% (38/38)</td>
|
||
<td align="left">0% (0/39)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/39)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>K. pneumoniae</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">90% (52/58)</td>
|
||
<td align="left">100% (51/51)</td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (53/53)</td>
|
||
<td align="left">90% (52/58)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>P. aeruginosa</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (30/30)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/30)</td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (30/30)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>P. mirabilis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">94% (32/34)</td>
|
||
<td align="left">94% (30/32)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">94% (32/34)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>S. aureus</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">99% (231/233)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">98% (84/86)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>S. epidermidis</em></td>
|
||
<td align="left">0% (0/44)</td>
|
||
<td align="left">79% (128/163)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/44)</td>
|
||
<td align="left"></td>
|
||
<td align="left">51% (45/89)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>S. hominis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">92% (74/80)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">85% (53/62)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>S. pneumoniae</em></td>
|
||
<td align="left">0% (0/117)</td>
|
||
<td align="left">0% (0/117)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/117)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/117)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Notice that the <code><a href="../reference/antibiogram.html">antibiogram()</a></code> function automatically
|
||
prints in the right format when using Quarto or R Markdown (such as this
|
||
page), and even applies italics for taxonomic names (by using
|
||
<code><a href="../reference/italicise_taxonomy.html">italicise_taxonomy()</a></code> internally).</p>
|
||
<p>It also uses the language of your OS if this is either English,
|
||
Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek, Italian,
|
||
Japanese, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish,
|
||
Swedish, Turkish, or Ukrainian. In this next example, we force the
|
||
language to be Spanish using the <code>language</code> argument:</p>
|
||
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">example_isolates</span>,</span>
|
||
<span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span>,</span>
|
||
<span> antibiotics <span class="op">=</span> <span class="fu"><a href="../reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>,</span>
|
||
<span> ab_transform <span class="op">=</span> <span class="st">"name"</span>,</span>
|
||
<span> language <span class="op">=</span> <span class="st">"es"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ The function aminoglycosides() should be used inside a dplyr verb or</span></span>
|
||
<span><span class="co">#> data.frame call, e.g.:</span></span>
|
||
<span><span class="co">#> • your_data %>% select(aminoglycosides())</span></span>
|
||
<span><span class="co">#> • your_data %>% select(column_a, column_b, aminoglycosides())</span></span>
|
||
<span><span class="co">#> • your_data %>% filter(any(aminoglycosides() == "R"))</span></span>
|
||
<span><span class="co">#> • your_data[, aminoglycosides()]</span></span>
|
||
<span><span class="co">#> • your_data[, c("column_a", "column_b", aminoglycosides())]</span></span>
|
||
<span><span class="co">#> </span></span>
|
||
<span><span class="co">#> Now returning a vector of all possible antimicrobials that</span></span>
|
||
<span><span class="co">#> aminoglycosides() can select.</span></span></code></pre></div>
|
||
<table class="table">
|
||
<colgroup>
|
||
<col width="20%">
|
||
<col width="20%">
|
||
<col width="22%">
|
||
<col width="16%">
|
||
<col width="20%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Patógeno</th>
|
||
<th align="left">Amikacina</th>
|
||
<th align="left">Gentamicina</th>
|
||
<th align="left">Kanamicina</th>
|
||
<th align="left">Tobramicina</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">Gram negativo</td>
|
||
<td align="left">98% (251/256)</td>
|
||
<td align="left">96% (659/684)</td>
|
||
<td align="left">0% (0/35)</td>
|
||
<td align="left">96% (658/686)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Gram positivo</td>
|
||
<td align="left">0% (0/436)</td>
|
||
<td align="left">63% (740/1170)</td>
|
||
<td align="left">0% (0/436)</td>
|
||
<td align="left">34% (228/665)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="section level4">
|
||
<h4 id="combined-antibiogram">Combined Antibiogram<a class="anchor" aria-label="anchor" href="#combined-antibiogram"></a>
|
||
</h4>
|
||
<p>To create a combined antibiogram, use antibiotic codes or names with
|
||
a plus <code>+</code> character like this:</p>
|
||
<div class="sourceCode" id="cb19"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">example_isolates</span>,</span>
|
||
<span> antibiotics <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"TZP"</span>, <span class="st">"TZP+TOB"</span>, <span class="st">"TZP+GEN"</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
|
||
<table class="table">
|
||
<colgroup>
|
||
<col width="14%">
|
||
<col width="20%">
|
||
<col width="32%">
|
||
<col width="32%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Pathogen</th>
|
||
<th align="left">Piperacillin/tazobactam</th>
|
||
<th align="left">Piperacillin/tazobactam + Gentamicin</th>
|
||
<th align="left">Piperacillin/tazobactam + Tobramycin</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">CoNS</td>
|
||
<td align="left">30% (10/33)</td>
|
||
<td align="left">97% (267/274)</td>
|
||
<td align="left"></td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>E. coli</em></td>
|
||
<td align="left">94% (393/416)</td>
|
||
<td align="left">100% (457/459)</td>
|
||
<td align="left">99% (455/461)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>K. pneumoniae</em></td>
|
||
<td align="left">89% (47/53)</td>
|
||
<td align="left">93% (54/58)</td>
|
||
<td align="left">93% (54/58)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>P. aeruginosa</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (30/30)</td>
|
||
<td align="left">100% (30/30)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>P. mirabilis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (34/34)</td>
|
||
<td align="left">100% (34/34)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>S. aureus</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (231/231)</td>
|
||
<td align="left">100% (91/91)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>S. epidermidis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (128/128)</td>
|
||
<td align="left">100% (46/46)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left"><em>S. hominis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (74/74)</td>
|
||
<td align="left">100% (53/53)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left"><em>S. pneumoniae</em></td>
|
||
<td align="left">100% (112/112)</td>
|
||
<td align="left">100% (112/112)</td>
|
||
<td align="left">100% (112/112)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="section level4">
|
||
<h4 id="syndromic-antibiogram">Syndromic Antibiogram<a class="anchor" aria-label="anchor" href="#syndromic-antibiogram"></a>
|
||
</h4>
|
||
<p>To create a syndromic antibiogram, the <code>syndromic_group</code>
|
||
argument must be used. This can be any column in the data, or e.g. an
|
||
<code><a href="https://rdrr.io/r/base/ifelse.html" class="external-link">ifelse()</a></code> with calculations based on certain columns:</p>
|
||
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">example_isolates</span>,</span>
|
||
<span> antibiotics <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fu"><a href="../reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="../reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>,</span>
|
||
<span> syndromic_group <span class="op">=</span> <span class="st">"ward"</span><span class="op">)</span></span>
|
||
<span><span class="co">#> ℹ The function aminoglycosides() should be used inside a dplyr verb or</span></span>
|
||
<span><span class="co">#> data.frame call, e.g.:</span></span>
|
||
<span><span class="co">#> • your_data %>% select(aminoglycosides())</span></span>
|
||
<span><span class="co">#> • your_data %>% select(column_a, column_b, aminoglycosides())</span></span>
|
||
<span><span class="co">#> • your_data %>% filter(any(aminoglycosides() == "R"))</span></span>
|
||
<span><span class="co">#> • your_data[, aminoglycosides()]</span></span>
|
||
<span><span class="co">#> • your_data[, c("column_a", "column_b", aminoglycosides())]</span></span>
|
||
<span><span class="co">#> </span></span>
|
||
<span><span class="co">#> Now returning a vector of all possible antimicrobials that</span></span>
|
||
<span><span class="co">#> aminoglycosides() can select.</span></span>
|
||
<span><span class="co">#> ℹ The function carbapenems() should be used inside a dplyr verb or</span></span>
|
||
<span><span class="co">#> data.frame call, e.g.:</span></span>
|
||
<span><span class="co">#> • your_data %>% select(carbapenems())</span></span>
|
||
<span><span class="co">#> • your_data %>% select(column_a, column_b, carbapenems())</span></span>
|
||
<span><span class="co">#> • your_data %>% filter(any(carbapenems() == "R"))</span></span>
|
||
<span><span class="co">#> • your_data[, carbapenems()]</span></span>
|
||
<span><span class="co">#> • your_data[, c("column_a", "column_b", carbapenems())]</span></span>
|
||
<span><span class="co">#> </span></span>
|
||
<span><span class="co">#> Now returning a vector of all possible antimicrobials that carbapenems()</span></span>
|
||
<span><span class="co">#> can select.</span></span></code></pre></div>
|
||
<table class="table">
|
||
<colgroup>
|
||
<col width="13%">
|
||
<col width="14%">
|
||
<col width="12%">
|
||
<col width="12%">
|
||
<col width="12%">
|
||
<col width="8%">
|
||
<col width="12%">
|
||
<col width="12%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Syndromic Group</th>
|
||
<th align="left">Pathogen</th>
|
||
<th align="left">Amikacin</th>
|
||
<th align="left">Gentamicin</th>
|
||
<th align="left">Imipenem</th>
|
||
<th align="left">Kanamycin</th>
|
||
<th align="left">Meropenem</th>
|
||
<th align="left">Tobramycin</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">CoNS</td>
|
||
<td align="left"></td>
|
||
<td align="left">89% (183/205)</td>
|
||
<td align="left">57% (20/35)</td>
|
||
<td align="left"></td>
|
||
<td align="left">57% (20/35)</td>
|
||
<td align="left">26% (8/31)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">ICU</td>
|
||
<td align="left">CoNS</td>
|
||
<td align="left"></td>
|
||
<td align="left">79% (58/73)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">Outpatient</td>
|
||
<td align="left">CoNS</td>
|
||
<td align="left"></td>
|
||
<td align="left">84% (26/31)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left"><em>E. coli</em></td>
|
||
<td align="left">100% (104/104)</td>
|
||
<td align="left">98% (291/297)</td>
|
||
<td align="left">100% (266/266)</td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (276/276)</td>
|
||
<td align="left">98% (293/299)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">ICU</td>
|
||
<td align="left"><em>E. coli</em></td>
|
||
<td align="left">100% (52/52)</td>
|
||
<td align="left">99% (135/137)</td>
|
||
<td align="left">100% (133/133)</td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (118/118)</td>
|
||
<td align="left">96% (132/137)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left"><em>K. pneumoniae</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">92% (47/51)</td>
|
||
<td align="left">100% (44/44)</td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (46/46)</td>
|
||
<td align="left">92% (47/51)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">Clinical</td>
|
||
<td align="left"><em>P. mirabilis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (30/30)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (30/30)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left"><em>S. aureus</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">99% (148/150)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">97% (61/63)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">ICU</td>
|
||
<td align="left"><em>S. aureus</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">100% (66/66)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left"><em>S. epidermidis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">82% (65/79)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">55% (24/44)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">ICU</td>
|
||
<td align="left"><em>S. epidermidis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">72% (54/75)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">41% (17/41)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left"><em>S. hominis</em></td>
|
||
<td align="left"></td>
|
||
<td align="left">96% (43/45)</td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left"></td>
|
||
<td align="left">94% (29/31)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">Clinical</td>
|
||
<td align="left"><em>S. pneumoniae</em></td>
|
||
<td align="left">0% (0/78)</td>
|
||
<td align="left">0% (0/78)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/78)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/78)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">ICU</td>
|
||
<td align="left"><em>S. pneumoniae</em></td>
|
||
<td align="left">0% (0/30)</td>
|
||
<td align="left">0% (0/30)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/30)</td>
|
||
<td align="left"></td>
|
||
<td align="left">0% (0/30)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="section level4">
|
||
<h4 id="weighted-incidence-syndromic-combination-antibiogram-wisca">Weighted-Incidence Syndromic Combination Antibiogram (WISCA)<a class="anchor" aria-label="anchor" href="#weighted-incidence-syndromic-combination-antibiogram-wisca"></a>
|
||
</h4>
|
||
<p>To create a WISCA, you must state combination therapy in the
|
||
<code>antibiotics</code> argument (similar to the Combination
|
||
Antibiogram), define a syndromic group with the
|
||
<code>syndromic_group</code> argument (similar to the Syndromic
|
||
Antibiogram) in which cases are predefined based on clinical or
|
||
demographic characteristics (e.g., endocarditis in 75+ females). This
|
||
next example is a simplification without clinical characteristics, but
|
||
just gives an idea of how a WISCA can be created:</p>
|
||
<div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">wisca</span> <span class="op"><-</span> <span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">example_isolates</span>,</span>
|
||
<span> antibiotics <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"AMC"</span>, <span class="st">"AMC+CIP"</span>, <span class="st">"TZP"</span>, <span class="st">"TZP+TOB"</span><span class="op">)</span>,</span>
|
||
<span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span>,</span>
|
||
<span> minimum <span class="op">=</span> <span class="fl">10</span>, <span class="co"># this should be >= 30, but now just as example</span></span>
|
||
<span> syndromic_group <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/ifelse.html" class="external-link">ifelse</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">$</span><span class="va">age</span> <span class="op">>=</span> <span class="fl">65</span> <span class="op">&</span></span>
|
||
<span> <span class="va">example_isolates</span><span class="op">$</span><span class="va">gender</span> <span class="op">==</span> <span class="st">"M"</span>,</span>
|
||
<span> <span class="st">"WISCA Group 1"</span>, <span class="st">"WISCA Group 2"</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="va">wisca</span></span></code></pre></div>
|
||
<table class="table">
|
||
<colgroup>
|
||
<col width="9%">
|
||
<col width="8%">
|
||
<col width="17%">
|
||
<col width="26%">
|
||
<col width="14%">
|
||
<col width="22%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Syndromic Group</th>
|
||
<th align="left">Pathogen</th>
|
||
<th align="left">Amoxicillin/clavulanic acid</th>
|
||
<th align="left">Amoxicillin/clavulanic acid + Ciprofloxacin</th>
|
||
<th align="left">Piperacillin/tazobactam</th>
|
||
<th align="left">Piperacillin/tazobactam + Tobramycin</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">WISCA Group 1</td>
|
||
<td align="left">Gram-negative</td>
|
||
<td align="left">76% (216/285)</td>
|
||
<td align="left">95% (270/284)</td>
|
||
<td align="left">89% (231/261)</td>
|
||
<td align="left">99% (270/274)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">WISCA Group 2</td>
|
||
<td align="left">Gram-negative</td>
|
||
<td align="left">76% (336/441)</td>
|
||
<td align="left">98% (432/442)</td>
|
||
<td align="left">88% (334/380)</td>
|
||
<td align="left">98% (409/419)</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">WISCA Group 1</td>
|
||
<td align="left">Gram-positive</td>
|
||
<td align="left">76% (310/406)</td>
|
||
<td align="left">89% (347/392)</td>
|
||
<td align="left">81% (100/123)</td>
|
||
<td align="left">95% (184/193)</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">WISCA Group 2</td>
|
||
<td align="left">Gram-positive</td>
|
||
<td align="left">76% (556/732)</td>
|
||
<td align="left">89% (617/695)</td>
|
||
<td align="left">88% (196/222)</td>
|
||
<td align="left">95% (340/357)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="section level4">
|
||
<h4 id="plotting-antibiograms">Plotting antibiograms<a class="anchor" aria-label="anchor" href="#plotting-antibiograms"></a>
|
||
</h4>
|
||
<p>Antibiograms can be plotted using <code><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">autoplot()</a></code> from the
|
||
<code>ggplot2</code> packages, since this <code>AMR</code> package
|
||
provides an extension to that function:</p>
|
||
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">autoplot</a></span><span class="op">(</span><span class="va">wisca</span><span class="op">)</span></span></code></pre></div>
|
||
<p><img src="AMR_files/figure-html/unnamed-chunk-10-1.png" width="720"></p>
|
||
<p>To calculate antimicrobial resistance in a more sensible way, also by
|
||
correcting for too few results, we use the <code><a href="../reference/proportion.html">resistance()</a></code> and
|
||
<code><a href="../reference/proportion.html">susceptibility()</a></code> functions.</p>
|
||
</div>
|
||
</div>
|
||
<div class="section level3">
|
||
<h3 id="resistance-percentages">Resistance percentages<a class="anchor" aria-label="anchor" href="#resistance-percentages"></a>
|
||
</h3>
|
||
<p>The functions <code><a href="../reference/proportion.html">resistance()</a></code> and
|
||
<code><a href="../reference/proportion.html">susceptibility()</a></code> can be used to calculate antimicrobial
|
||
resistance or susceptibility. For more specific analyses, the functions
|
||
<code><a href="../reference/proportion.html">proportion_S()</a></code>, <code><a href="../reference/proportion.html">proportion_SI()</a></code>,
|
||
<code><a href="../reference/proportion.html">proportion_I()</a></code>, <code><a href="../reference/proportion.html">proportion_IR()</a></code> and
|
||
<code><a href="../reference/proportion.html">proportion_R()</a></code> can be used to determine the proportion of a
|
||
specific antimicrobial outcome.</p>
|
||
<p>All these functions contain a <code>minimum</code> argument, denoting
|
||
the minimum required number of test results for returning a value. These
|
||
functions will otherwise return <code>NA</code>. The default is
|
||
<code>minimum = 30</code>, following the <a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="external-link">CLSI
|
||
M39-A4 guideline</a> for applying microbial epidemiology.</p>
|
||
<p>As per the EUCAST guideline of 2019, we calculate resistance as the
|
||
proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to
|
||
<code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and
|
||
I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to
|
||
<code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their
|
||
own:</p>
|
||
<div class="sourceCode" id="cb23"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</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.4203377</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="cb24"><pre class="downlit sourceCode r">
|
||
<code class="sourceCode R"><span><span class="va">our_data_1st</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by</a></span><span class="op">(</span><span class="va">hospital</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%>%</a></span></span>
|
||
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">summarise</a></span><span class="op">(</span>amoxicillin <span class="op">=</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span><span class="op">(</span><span class="va">AMX</span><span class="op">)</span><span class="op">)</span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># A tibble: 3 × 2</span></span></span>
|
||
<span><span class="co">#> hospital amoxicillin</span></span>
|
||
<span><span class="co">#> <span style="color: #949494; font-style: italic;"><chr></span> <span style="color: #949494; font-style: italic;"><dbl></span></span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">1</span> A 0.340</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">2</span> B 0.551</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">3</span> C 0.370</span></span></code></pre></div>
|
||
<hr>
|
||
<p><em>Author: Dr. Matthijs Berends, 26th Feb 2023</em></p>
|
||
</div>
|
||
</div>
|
||
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
|
||
</nav></aside>
|
||
</div>
|
||
|
||
|
||
|
||
<footer><div class="pkgdown-footer-left">
|
||
<p><code>AMR</code> (for R). Free and open-source, licenced under the <a target="_blank" href="https://github.com/msberends/AMR/blob/main/LICENSE" class="external-link">GNU General Public License version 2.0 (GPL-2)</a>.<br>Developed at the <a target="_blank" href="https://www.rug.nl" class="external-link">University of Groningen</a> and <a target="_blank" href="https://www.umcg.nl" class="external-link">University Medical Center Groningen</a> in The Netherlands.</p>
|
||
</div>
|
||
|
||
<div class="pkgdown-footer-right">
|
||
<p><a target="_blank" href="https://www.rug.nl" class="external-link"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/logo_rug.svg" style="max-width: 150px;"></a><a target="_blank" href="https://www.umcg.nl" class="external-link"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/logo_umcg.svg" style="max-width: 150px;"></a></p>
|
||
</div>
|
||
|
||
</footer>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html>
|