mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 21:26:12 +01:00
1397 lines
97 KiB
HTML
1397 lines
97 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">
|
||
<meta name="description" content="AMR">
|
||
<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.2.2/bootstrap.min.css" rel="stylesheet">
|
||
<script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script><link href="../deps/Fira_Code-0.4.6/font.css" rel="stylesheet">
|
||
<!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
|
||
<!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></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">
|
||
<meta property="og:description" content="AMR">
|
||
<meta property="og:image" content="https://msberends.github.io/AMR/logo.svg">
|
||
<meta name="twitter:card" content="summary_large_image">
|
||
<meta name="twitter:creator" content="@msberends">
|
||
<meta name="twitter:site" content="@msberends">
|
||
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
|
||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||
<![endif]-->
|
||
</head>
|
||
<body>
|
||
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
|
||
|
||
|
||
<nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-primary"><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.0.0.9041</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">
|
||
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown--how-to">
|
||
<span class="fa fa-question-circle"></span>
|
||
|
||
How to
|
||
</a>
|
||
<div class="dropdown-menu" aria-labelledby="dropdown--how-to">
|
||
<a class="dropdown-item" href="../articles/AMR.html">
|
||
<span class="fa fa-directions"></span>
|
||
|
||
Conduct AMR Analysis
|
||
</a>
|
||
<a class="dropdown-item" href="../reference/antibiogram.html">
|
||
<span class="fa fa-file-prescription"></span>
|
||
|
||
Generate Antibiogram (Trad./Syndromic/WISCA)
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/resistance_predict.html">
|
||
<span class="fa fa-dice"></span>
|
||
|
||
Predict Antimicrobial Resistance
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/datasets.html">
|
||
<span class="fa fa-database"></span>
|
||
|
||
Download Data Sets for Own Use
|
||
</a>
|
||
<a class="dropdown-item" href="../reference/AMR-options.html">
|
||
<span class="fa fa-gear"></span>
|
||
|
||
Set User- Or Team-specific Package Settings
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/PCA.html">
|
||
<span class="fa fa-compress"></span>
|
||
|
||
Conduct Principal Component Analysis for AMR
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/MDR.html">
|
||
<span class="fa fa-skull-crossbones"></span>
|
||
|
||
Determine Multi-Drug Resistance (MDR)
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/WHONET.html">
|
||
<span class="fa fa-globe-americas"></span>
|
||
|
||
Work with WHONET Data
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/EUCAST.html">
|
||
<span class="fa fa-exchange-alt"></span>
|
||
|
||
Apply Eucast Rules
|
||
</a>
|
||
<a class="dropdown-item" href="../reference/mo_property.html">
|
||
<span class="fa fa-bug"></span>
|
||
|
||
Get Taxonomy of a Microorganism
|
||
</a>
|
||
<a class="dropdown-item" href="../reference/ab_property.html">
|
||
<span class="fa fa-capsules"></span>
|
||
|
||
Get Properties of an Antibiotic Drug
|
||
</a>
|
||
<a class="dropdown-item" href="../reference/av_property.html">
|
||
<span class="fa fa-capsules"></span>
|
||
|
||
Get Properties of an Antiviral Drug
|
||
</a>
|
||
</div>
|
||
</li>
|
||
<li class="nav-item dropdown">
|
||
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown--with-other-pkgs">
|
||
<span class="fa fa-layer-group"></span>
|
||
|
||
With other pkgs
|
||
</a>
|
||
<div class="dropdown-menu" aria-labelledby="dropdown--with-other-pkgs">
|
||
<a class="dropdown-item" href="../articles/other_pkg.html">
|
||
<span class="fa fa-layer-group"></span>
|
||
|
||
AMR & dplyr/tidyverse
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/other_pkg.html">
|
||
<span class="fa fa-layer-group"></span>
|
||
|
||
AMR & data.table
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/other_pkg.html">
|
||
<span class="fa fa-layer-group"></span>
|
||
|
||
AMR & tidymodels
|
||
</a>
|
||
<a class="dropdown-item" href="../articles/other_pkg.html">
|
||
<span class="fa fa-layer-group"></span>
|
||
|
||
AMR & base R
|
||
</a>
|
||
</div>
|
||
</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>
|
||
<form class="form-inline my-2 my-lg-0" role="search">
|
||
<input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off">
|
||
</form>
|
||
|
||
<ul class="navbar-nav">
|
||
<li class="nav-item">
|
||
<a class="nav-link" href="../news/index.html">
|
||
<span class="far 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="fab 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/HEAD/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 13 July 2023.</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">2023-07-13</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">2023-07-13</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">2023-07-13</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>
|
||
<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="cb2"><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 11 Dec 2022.</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="cb3"><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="cb4"><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="cb5"><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="cb6"><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: Enterobacter cowanii (0.600), Eubacterium combesii</span></span>
|
||
<span><span class="co">#> (0.600), Eggerthia catenaformis (0.591), Eubacterium callanderi</span></span>
|
||
<span><span class="co">#> (0.591), Enterocloster citroniae (0.587), Eubacterium cylindroides</span></span>
|
||
<span><span class="co">#> (0.583), Enterococcus casseliflavus (0.577), Enterobacter cloacae</span></span>
|
||
<span><span class="co">#> cloacae (0.571), Enterobacter cloacae complex (0.571), and Ehrlichia</span></span>
|
||
<span><span class="co">#> canis (0.567)</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), Kosakonia pseudosacchari (0.361), Kaistella</span></span>
|
||
<span><span class="co">#> palustris (0.333), Kocuria palustris (0.333), and Kocuria pelophila</span></span>
|
||
<span><span class="co">#> (0.333)</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), Salmonella</span></span>
|
||
<span><span class="co">#> Aurelianis (0.595), Salmonella Aarhus (0.588), Salmonella Amounderness</span></span>
|
||
<span><span class="co">#> (0.587), Selenomonas artemidis (0.571), Salmonella choleraesuis</span></span>
|
||
<span><span class="co">#> arizonae (0.562), Streptococcus anginosus anginosus (0.561), and</span></span>
|
||
<span><span class="co">#> Salmonella Abaetetuba (0.548)</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), Serratia</span></span>
|
||
<span><span class="co">#> proteamaculans quinovora (0.545), Streptococcus pseudoporcinus (0.536),</span></span>
|
||
<span><span class="co">#> Staphylococcus pseudintermedius (0.532), Serratia proteamaculans</span></span>
|
||
<span><span class="co">#> proteamaculans (0.526), Salmonella Portanigra (0.524), Sphingomonas</span></span>
|
||
<span><span class="co">#> paucimobilis (0.520), Streptococcus pluranimalium (0.519),</span></span>
|
||
<span><span class="co">#> Streptococcus constellatus pharyngis (0.514), and Salmonella Pakistan</span></span>
|
||
<span><span class="co">#> (0.500)</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="cb7"><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://dplyr.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="cb8"><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,626 'phenotype-based' first isolates (87.6% within scope and</span></span>
|
||
<span><span class="co">#> 87.5% of total where a microbial ID was available)</span></span></code></pre></div>
|
||
<p>So only 88% 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="cb9"><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="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="../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 626 isolates for analysis. Now our data looks
|
||
like:</p>
|
||
<div class="sourceCode" id="cb11"><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,626 × 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> P10 A 2015-12-10 B_ESCHR_COLI S I S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> B7 A 2015-03-02 B_ESCHR_COLI S S S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> W3 A 2018-03-31 B_STPHY_AURS R S R S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> J8 A 2016-06-14 B_ESCHR_COLI R S S 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,616 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="cb12"><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:2626 Length:2626 Min. :2011-01-01 </span></span>
|
||
<span><span class="co">#> Class :character Class :character 1st Qu.:2013-04-14 </span></span>
|
||
<span><span class="co">#> Mode :character Mode :character Median :2015-06-05 </span></span>
|
||
<span><span class="co">#> Mean :2015-06-15 </span></span>
|
||
<span><span class="co">#> 3rd Qu.:2017-08-23 </span></span>
|
||
<span><span class="co">#> Max. :2020-01-01 </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 %R :43.2% (n=1134) %R :36.1% (n=947) </span></span>
|
||
<span><span class="co">#> Unique:4 %SI :56.8% (n=1492) %SI :63.9% (n=1679) </span></span>
|
||
<span><span class="co">#> #1 :B_ESCHR_COLI - %S :41.1% (n=1080) - %S :52.7% (n=1383) </span></span>
|
||
<span><span class="co">#> #2 :B_STPHY_AURS - %I :15.7% (n=412) - %I :11.3% (n=296) </span></span>
|
||
<span><span class="co">#> #3 :B_STRPT_PNMN </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">#> %R :42.0% (n=1102) %R :37.0% (n=971) TRUE:2626 </span></span>
|
||
<span><span class="co">#> %SI :58.0% (n=1524) %SI :63.0% (n=1655) </span></span>
|
||
<span><span class="co">#> - %S :51.9% (n=1362) - %S :59.9% (n=1574) </span></span>
|
||
<span><span class="co">#> - %I : 6.2% (n=162) - %I : 3.1% (n=81) </span></span>
|
||
<span><span class="co">#> </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,626</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", "P10", "B7", "W3", "J8", "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, 2015-12-10, 2015-03-02, 2018-03-31…</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, S, S, R, R, R, S, S, S, S, R, S, S, R, R, R, R, I, S,…</span></span>
|
||
<span><span class="co">#> $ AMC <span style="color: #949494; font-style: italic;"><sir></span> I, I, I, S, S, S, S, S, S, S, S, S, S, S, S, S, S, R, S, R,…</span></span>
|
||
<span><span class="co">#> $ CIP <span style="color: #949494; font-style: italic;"><sir></span> S, S, S, S, R, S, 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 1808 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="cb13"><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>250</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">2</span> Staphylococcus aureus 661</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">3</span> Streptococcus pneumoniae 399</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">4</span> Klebsiella pneumoniae 316</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="cb14"><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,626 × 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> 2015-12-10 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> 2015-03-02 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> 2018-03-31 S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> 2016-06-14 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,616 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,626 × 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 S I </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> B_ESCHR_COLI S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B_STPHY_AURS R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> B_ESCHR_COLI 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,616 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,626 × 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 S I S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 4</span> B_ESCHR_COLI S S S S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 5</span> B_STPHY_AURS R S R S </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> B_ESCHR_COLI R S S 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,616 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: 971 × 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;"># ℹ 961 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: 471 × 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> I7 A 2015-08-19 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> N3 A 2014-12-29 B_STRPT_PNMN R R R S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> Q2 A 2019-09-22 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> X7 A 2011-03-20 B_ESCHR_COLI R R S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> C5 A 2015-08-30 B_KLBSL_PNMN R R S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> W9 A 2013-10-02 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 461 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: 471 × 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> I7 A 2015-08-19 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 6</span> N3 A 2014-12-29 B_STRPT_PNMN R R R S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 7</span> Q2 A 2019-09-22 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 8</span> X7 A 2011-03-20 B_ESCHR_COLI R R S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;"> 9</span> C5 A 2015-08-30 B_KLBSL_PNMN R R S R TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">10</span> W9 A 2013-10-02 B_ESCHR_COLI R R S S TRUE </span></span>
|
||
<span><span class="co">#> <span style="color: #949494;"># ℹ 461 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="cb15"><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="cb16"><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">#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span></span>
|
||
<span><span class="co">#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span></span>
|
||
<span><span class="co">#> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span></span></code></pre></div>
|
||
<table class="table">
|
||
<thead><tr class="header">
|
||
<th align="left">Pathogen (N min-max)</th>
|
||
<th align="right">AMK</th>
|
||
<th align="right">GEN</th>
|
||
<th align="right">IPM</th>
|
||
<th align="right">KAN</th>
|
||
<th align="right">MEM</th>
|
||
<th align="right">TOB</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">CoNS (43-309)</td>
|
||
<td align="right">0</td>
|
||
<td align="right">86</td>
|
||
<td align="right">52</td>
|
||
<td align="right">0</td>
|
||
<td align="right">52</td>
|
||
<td align="right">22</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>E. coli</em> (0-462)</td>
|
||
<td align="right">100</td>
|
||
<td align="right">98</td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">97</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>E. faecalis</em> (0-39)</td>
|
||
<td align="right">0</td>
|
||
<td align="right">0</td>
|
||
<td align="right">100</td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>K. pneumoniae</em> (0-58)</td>
|
||
<td align="right"></td>
|
||
<td align="right">90</td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">90</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>P. aeruginosa</em> (17-30)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>P. mirabilis</em> (0-34)</td>
|
||
<td align="right"></td>
|
||
<td align="right">94</td>
|
||
<td align="right">94</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">94</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>S. aureus</em> (2-233)</td>
|
||
<td align="right"></td>
|
||
<td align="right">99</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">98</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>S. epidermidis</em> (8-163)</td>
|
||
<td align="right">0</td>
|
||
<td align="right">79</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">51</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>S. hominis</em> (3-80)</td>
|
||
<td align="right"></td>
|
||
<td align="right">92</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">85</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>S. pneumoniae</em> (11-117)</td>
|
||
<td align="right">0</td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</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="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> 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">#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span></span>
|
||
<span><span class="co">#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span></span></code></pre></div>
|
||
<table class="table">
|
||
<colgroup>
|
||
<col width="35%">
|
||
<col width="14%">
|
||
<col width="17%">
|
||
<col width="15%">
|
||
<col width="17%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Patógeno (N min-max)</th>
|
||
<th align="right">Amikacina</th>
|
||
<th align="right">Gentamicina</th>
|
||
<th align="right">Kanamicina</th>
|
||
<th align="right">Tobramicina</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">Gram negativo (35-686)</td>
|
||
<td align="right">98</td>
|
||
<td align="right">96</td>
|
||
<td align="right">0</td>
|
||
<td align="right">96</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Gram positivo (436-1170)</td>
|
||
<td align="right">0</td>
|
||
<td align="right">63</td>
|
||
<td align="right">0</td>
|
||
<td align="right">34</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="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> 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">
|
||
<thead><tr class="header">
|
||
<th align="left">Pathogen (N min-max)</th>
|
||
<th align="right">TZP</th>
|
||
<th align="right">TZP + GEN</th>
|
||
<th align="right">TZP + TOB</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">CoNS (29-274)</td>
|
||
<td align="right">30</td>
|
||
<td align="right">97</td>
|
||
<td align="right"></td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>E. coli</em> (416-461)</td>
|
||
<td align="right">94</td>
|
||
<td align="right">100</td>
|
||
<td align="right">99</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>K. pneumoniae</em> (53-58)</td>
|
||
<td align="right">89</td>
|
||
<td align="right">93</td>
|
||
<td align="right">93</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>P. aeruginosa</em> (27-30)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">100</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>P. mirabilis</em> (27-34)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">100</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>S. aureus</em> (7-231)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">100</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>S. epidermidis</em> (5-128)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">100</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">
|
||
<em>S. hominis</em> (0-74)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">100</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">
|
||
<em>S. pneumoniae</em> (112-112)</td>
|
||
<td align="right">100</td>
|
||
<td align="right">100</td>
|
||
<td align="right">100</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="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="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">#> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span></span>
|
||
<span><span class="co">#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span></span>
|
||
<span><span class="co">#> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span></span></code></pre></div>
|
||
<table class="table">
|
||
<colgroup>
|
||
<col width="25%">
|
||
<col width="37%">
|
||
<col width="6%">
|
||
<col width="6%">
|
||
<col width="6%">
|
||
<col width="6%">
|
||
<col width="6%">
|
||
<col width="6%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Syndromic Group</th>
|
||
<th align="left">Pathogen (N min-max)</th>
|
||
<th align="right">AMK</th>
|
||
<th align="right">GEN</th>
|
||
<th align="right">IPM</th>
|
||
<th align="right">KAN</th>
|
||
<th align="right">MEM</th>
|
||
<th align="right">TOB</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">CoNS (23-205)</td>
|
||
<td align="right"></td>
|
||
<td align="right">89</td>
|
||
<td align="right">57</td>
|
||
<td align="right"></td>
|
||
<td align="right">57</td>
|
||
<td align="right">26</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">ICU</td>
|
||
<td align="left">CoNS (10-73)</td>
|
||
<td align="right"></td>
|
||
<td align="right">79</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">Outpatient</td>
|
||
<td align="left">CoNS (3-31)</td>
|
||
<td align="right"></td>
|
||
<td align="right">84</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">
|
||
<em>E. coli</em> (0-299)</td>
|
||
<td align="right">100</td>
|
||
<td align="right">98</td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">98</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">ICU</td>
|
||
<td align="left">
|
||
<em>E. coli</em> (0-137)</td>
|
||
<td align="right">100</td>
|
||
<td align="right">99</td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">96</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">
|
||
<em>K. pneumoniae</em> (0-51)</td>
|
||
<td align="right"></td>
|
||
<td align="right">92</td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right">92</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">
|
||
<em>P. mirabilis</em> (0-30)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">
|
||
<em>S. aureus</em> (2-150)</td>
|
||
<td align="right"></td>
|
||
<td align="right">99</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">97</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">ICU</td>
|
||
<td align="left">
|
||
<em>S. aureus</em> (0-66)</td>
|
||
<td align="right"></td>
|
||
<td align="right">100</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">
|
||
<em>S. epidermidis</em> (4-79)</td>
|
||
<td align="right"></td>
|
||
<td align="right">82</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">55</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">ICU</td>
|
||
<td align="left">
|
||
<em>S. epidermidis</em> (4-75)</td>
|
||
<td align="right"></td>
|
||
<td align="right">72</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">41</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">
|
||
<em>S. hominis</em> (1-45)</td>
|
||
<td align="right"></td>
|
||
<td align="right">96</td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right"></td>
|
||
<td align="right">94</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">Clinical</td>
|
||
<td align="left">
|
||
<em>S. pneumoniae</em> (5-78)</td>
|
||
<td align="right">0</td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">ICU</td>
|
||
<td align="left">
|
||
<em>S. pneumoniae</em> (5-30)</td>
|
||
<td align="right">0</td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</td>
|
||
<td align="right"></td>
|
||
<td align="right">0</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="cb20"><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="23%">
|
||
<col width="35%">
|
||
<col width="5%">
|
||
<col width="14%">
|
||
<col width="5%">
|
||
<col width="14%">
|
||
</colgroup>
|
||
<thead><tr class="header">
|
||
<th align="left">Syndromic Group</th>
|
||
<th align="left">Pathogen (N min-max)</th>
|
||
<th align="right">AMC</th>
|
||
<th align="right">AMC + CIP</th>
|
||
<th align="right">TZP</th>
|
||
<th align="right">TZP + TOB</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
<tr class="odd">
|
||
<td align="left">WISCA Group 1</td>
|
||
<td align="left">Gram-negative (261-285)</td>
|
||
<td align="right">76</td>
|
||
<td align="right">95</td>
|
||
<td align="right">89</td>
|
||
<td align="right">99</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">WISCA Group 2</td>
|
||
<td align="left">Gram-negative (380-442)</td>
|
||
<td align="right">76</td>
|
||
<td align="right">98</td>
|
||
<td align="right">88</td>
|
||
<td align="right">98</td>
|
||
</tr>
|
||
<tr class="odd">
|
||
<td align="left">WISCA Group 1</td>
|
||
<td align="left">Gram-positive (123-406)</td>
|
||
<td align="right">76</td>
|
||
<td align="right">89</td>
|
||
<td align="right">81</td>
|
||
<td align="right">95</td>
|
||
</tr>
|
||
<tr class="even">
|
||
<td align="left">WISCA Group 2</td>
|
||
<td align="left">Gram-positive (222-732)</td>
|
||
<td align="right">76</td>
|
||
<td align="right">89</td>
|
||
<td align="right">88</td>
|
||
<td align="right">95</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="cb21"><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="cb22"><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.4318355</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="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>
|
||
<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.343</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">2</span> B 0.569</span></span>
|
||
<span><span class="co">#> <span style="color: #BCBCBC;">3</span> C 0.375</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"><h2>On this page</h2>
|
||
</nav></aside>
|
||
</div>
|
||
|
||
|
||
|
||
<footer><div class="pkgdown-footer-left">
|
||
<p></p>
|
||
<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></p>
|
||
<p><a target="_blank" href="https://www.rug.nl" class="external-link"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/logos/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/logos/logo_umcg.svg" style="max-width: 150px;"></a></p>
|
||
</div>
|
||
|
||
</footer>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html>
|