mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 20:06:11 +01:00
529 lines
65 KiB
HTML
529 lines
65 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="Generate an antibiogram, and communicate the results in plots or tables. These functions follow the logic of Klinker et al. (2021, doi:10.1177/20499361211011373
|
||
) and Barbieri et al. (2021, doi:10.1186/s13756-021-00939-2
|
||
), and allow reporting in e.g. R Markdown and Quarto as well."><title>Generate Antibiogram: Traditional, Combined, Syndromic, or Weighted-Incidence Syndromic Combination (WISCA) — antibiogram • 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.5/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="Generate Antibiogram: Traditional, Combined, Syndromic, or Weighted-Incidence Syndromic Combination (WISCA) — antibiogram"><meta property="og:description" content="Generate an antibiogram, and communicate the results in plots or tables. These functions follow the logic of Klinker et al. (2021, doi:10.1177/20499361211011373
|
||
) and Barbieri et al. (2021, doi:10.1186/s13756-021-00939-2
|
||
), and allow reporting in e.g. R Markdown and Quarto as well."><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="">1.8.2.9115</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="nav-item">
|
||
<a class="nav-link" href="../index.html">
|
||
<span class="fa fa-home"></span>
|
||
|
||
Home
|
||
</a>
|
||
</li>
|
||
<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="../reference/AMR-options.html">
|
||
<span class="fa fa-gear"></span>
|
||
|
||
User- Or Team-specific Package Settings
|
||
</a>
|
||
<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>
|
||
|
||
Data Sets for Download / Own Use
|
||
</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/SPSS.html">
|
||
<span class="fa fa-file-upload"></span>
|
||
|
||
Import Data From SPSS/SAS/Stata
|
||
</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">
|
||
<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>
|
||
<li class="nav-item">
|
||
<a class="nav-link" href="../news/index.html">
|
||
<span class="far fa far fa-newspaper"></span>
|
||
|
||
Changelog
|
||
</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="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-reference-topic">
|
||
<div class="row">
|
||
<main id="main" class="col-md-9"><div class="page-header">
|
||
<img src="../logo.svg" class="logo" alt=""><h1>Generate Antibiogram: Traditional, Combined, Syndromic, or Weighted-Incidence Syndromic Combination (WISCA)</h1>
|
||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/R/antibiogram.R" class="external-link"><code>R/antibiogram.R</code></a></small>
|
||
<div class="d-none name"><code>antibiogram.Rd</code></div>
|
||
</div>
|
||
|
||
<div class="ref-description section level2">
|
||
<p>Generate an antibiogram, and communicate the results in plots or tables. These functions follow the logic of Klinker <em>et al.</em> (2021, <a href="https://doi.org/10.1177/20499361211011373" class="external-link">doi:10.1177/20499361211011373</a>
|
||
) and Barbieri <em>et al.</em> (2021, <a href="https://doi.org/10.1186/s13756-021-00939-2" class="external-link">doi:10.1186/s13756-021-00939-2</a>
|
||
), and allow reporting in e.g. R Markdown and Quarto as well.</p>
|
||
</div>
|
||
|
||
<div class="section level2">
|
||
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
|
||
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">antibiogram</span><span class="op">(</span></span>
|
||
<span> <span class="va">x</span>,</span>
|
||
<span> antibiotics <span class="op">=</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>
|
||
<span> mo_transform <span class="op">=</span> <span class="st">"shortname"</span>,</span>
|
||
<span> ab_transform <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> syndromic_group <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> add_total_n <span class="op">=</span> <span class="cn">TRUE</span>,</span>
|
||
<span> only_all_tested <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
||
<span> digits <span class="op">=</span> <span class="fl">0</span>,</span>
|
||
<span> col_mo <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
||
<span> language <span class="op">=</span> <span class="fu"><a href="translate.html">get_AMR_locale</a></span><span class="op">(</span><span class="op">)</span>,</span>
|
||
<span> minimum <span class="op">=</span> <span class="fl">30</span>,</span>
|
||
<span> combine_SI <span class="op">=</span> <span class="cn">TRUE</span>,</span>
|
||
<span> sep <span class="op">=</span> <span class="st">" + "</span></span>
|
||
<span><span class="op">)</span></span>
|
||
<span></span>
|
||
<span><span class="co"># S3 method for antibiogram</span></span>
|
||
<span><span class="fu"><a href="plot.html">plot</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
|
||
<span></span>
|
||
<span><span class="co"># S3 method for antibiogram</span></span>
|
||
<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">object</span>, <span class="va">...</span><span class="op">)</span></span>
|
||
<span></span>
|
||
<span><span class="co"># S3 method for antibiogram</span></span>
|
||
<span><span class="fu"><a href="https://rdrr.io/r/base/print.html" class="external-link">print</a></span><span class="op">(</span><span class="va">x</span>, as_kable <span class="op">=</span> <span class="op">!</span><span class="fu"><a href="https://rdrr.io/r/base/interactive.html" class="external-link">interactive</a></span><span class="op">(</span><span class="op">)</span>, <span class="va">...</span><span class="op">)</span></span></code></pre></div>
|
||
</div>
|
||
|
||
<div class="section level2">
|
||
<h2 id="source">Source<a class="anchor" aria-label="anchor" href="#source"></a></h2>
|
||
|
||
<ul><li><p>Klinker KP <em>et al.</em> (2021). <strong>Antimicrobial stewardship and antibiograms: importance of moving beyond traditional antibiograms</strong>. <em>Therapeutic Advances in Infectious Disease</em>, May 5;8:20499361211011373; <a href="https://doi.org/10.1177/20499361211011373" class="external-link">doi:10.1177/20499361211011373</a></p></li>
|
||
<li><p>Barbieri E <em>et al.</em> (2021). <strong>Development of a Weighted-Incidence Syndromic Combination Antibiogram (WISCA) to guide the choice of the empiric antibiotic treatment for urinary tract infection in paediatric patients: a Bayesian approach</strong> <em>Antimicrobial Resistance & Infection Control</em> May 1;10(1):74; <a href="https://doi.org/10.1186/s13756-021-00939-2" class="external-link">doi:10.1186/s13756-021-00939-2</a></p></li>
|
||
<li><p><strong>M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition</strong>, 2022, <em>Clinical and Laboratory Standards Institute (CLSI)</em>. <a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="external-link">https://clsi.org/standards/products/microbiology/documents/m39/</a>.</p></li>
|
||
</ul></div>
|
||
<div class="section level2">
|
||
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
|
||
<dl><dt>x</dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a> containing at least a column with microorganisms and columns with antibiotic results (class 'sir', see <code><a href="as.sir.html">as.sir()</a></code>)</p></dd>
|
||
|
||
|
||
<dt>antibiotics</dt>
|
||
<dd><p>vector of column names, or (any combinations of) <a href="antibiotic_class_selectors.html">antibiotic selectors</a> such as <code><a href="antibiotic_class_selectors.html">aminoglycosides()</a></code> or <code><a href="antibiotic_class_selectors.html">carbapenems()</a></code>. For combination antibiograms, this can also be column names separated with <code>"+"</code>, such as "TZP+TOB" given that the data set contains columns "TZP" and "TOB". See <em>Examples</em>.</p></dd>
|
||
|
||
|
||
<dt>mo_transform</dt>
|
||
<dd><p>a character to transform microorganism input - must be "name", "shortname", "gramstain", or one of the column names of the <a href="microorganisms.html">microorganisms</a> data set: "mo", "fullname", "status", "kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies", "rank", "ref", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to", "prevalence" or "snomed". Can also be <code>NULL</code> to not transform the input.</p></dd>
|
||
|
||
|
||
<dt>ab_transform</dt>
|
||
<dd><p>a character to transform antibiotic input - must be one of the column names of the <a href="antibiotics.html">antibiotics</a> data set: "ab", "cid", "name", "group", "atc", "atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd", "oral_units", "iv_ddd", "iv_units" or "loinc". Can also be <code>NULL</code> to not transform the input.</p></dd>
|
||
|
||
|
||
<dt>syndromic_group</dt>
|
||
<dd><p>a column name of <code>x</code>, or values calculated to split rows of <code>x</code>, e.g. by using <code><a href="https://rdrr.io/r/base/ifelse.html" class="external-link">ifelse()</a></code> or <code><a href="https://dplyr.tidyverse.org/reference/case_when.html" class="external-link">case_when()</a></code>. See <em>Examples</em>.</p></dd>
|
||
|
||
|
||
<dt>add_total_n</dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether total available numbers per pathogen should be added to the table (defaults to <code>TRUE</code>). This will add the lowest and highest number of available isolate per antibiotic (e.g, if for <em>E. coli</em> 200 isolates are available for ciprofloxacin and 150 for amoxicillin, the returned number will be "150-200").</p></dd>
|
||
|
||
|
||
<dt>only_all_tested</dt>
|
||
<dd><p>(for combination antibiograms): a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate that isolates must be tested for all antibiotics, see <em>Details</em></p></dd>
|
||
|
||
|
||
<dt>digits</dt>
|
||
<dd><p>number of digits to use for rounding</p></dd>
|
||
|
||
|
||
<dt>col_mo</dt>
|
||
<dd><p>column name of the names or codes of the microorganisms (see <code><a href="as.mo.html">as.mo()</a></code>), defaults to the first column of class <code><a href="as.mo.html">mo</a></code>. Values will be coerced using <code><a href="as.mo.html">as.mo()</a></code>.</p></dd>
|
||
|
||
|
||
<dt>language</dt>
|
||
<dd><p>language to translate text, which defaults to the system language (see <code><a href="translate.html">get_AMR_locale()</a></code>)</p></dd>
|
||
|
||
|
||
<dt>minimum</dt>
|
||
<dd><p>the minimum allowed number of available (tested) isolates. Any isolate count lower than <code>minimum</code> will return <code>NA</code> with a warning. The default number of <code>30</code> isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see <em>Source</em>.</p></dd>
|
||
|
||
|
||
<dt>combine_SI</dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether all susceptibility should be determined by results of either S or I, instead of only S (defaults to <code>TRUE</code>)</p></dd>
|
||
|
||
|
||
<dt>sep</dt>
|
||
<dd><p>a separating character for antibiotic columns in combination antibiograms</p></dd>
|
||
|
||
|
||
<dt>...</dt>
|
||
<dd><p>method extensions</p></dd>
|
||
|
||
|
||
<dt>object</dt>
|
||
<dd><p>an <code>antibiogram()</code> object</p></dd>
|
||
|
||
|
||
<dt>as_kable</dt>
|
||
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether the printing should be done using <code><a href="https://rdrr.io/pkg/knitr/man/kable.html" class="external-link">knitr::kable()</a></code> (which is the default in non-interactive sessions)</p></dd>
|
||
|
||
</dl></div>
|
||
<div class="section level2">
|
||
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
|
||
<p>This function returns a table with values between 0 and 100 for <em>susceptibility</em>, not resistance.</p>
|
||
<p><strong>Remember that you should filter your data to let it contain only first isolates!</strong> This is needed to exclude duplicates and to reduce selection bias. Use <code><a href="first_isolate.html">first_isolate()</a></code> to determine them in your data set with one of the four available algorithms.</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 <code>antibiogram()</code>:</p><ol><li><p><strong>Traditional Antibiogram</strong></p>
|
||
<p>Case example: Susceptibility of <em>Pseudomonas aeruginosa</em> to piperacillin/tazobactam (TZP)</p>
|
||
<p>Code example:</p>
|
||
<p></p><div class="sourceCode r"><pre><code><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">your_data</span>,</span>
|
||
<span> antibiotics <span class="op">=</span> <span class="st">"TZP"</span><span class="op">)</span></span></code></pre><p></p></div></li>
|
||
<li><p><strong>Combination Antibiogram</strong></p>
|
||
<p>Case example: Additional susceptibility of <em>Pseudomonas aeruginosa</em> to TZP + tobramycin versus TZP alone</p>
|
||
<p>Code example:</p>
|
||
<p></p><div class="sourceCode r"><pre><code><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">your_data</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><p></p></div></li>
|
||
<li><p><strong>Syndromic Antibiogram</strong></p>
|
||
<p>Case example: Susceptibility of <em>Pseudomonas aeruginosa</em> to TZP among respiratory specimens (obtained among ICU patients only)</p>
|
||
<p>Code example:</p>
|
||
<p></p><div class="sourceCode r"><pre><code><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">your_data</span>,</span>
|
||
<span> antibiotics <span class="op">=</span> <span class="fu"><a href="../reference/antibiotic_class_selectors.html">penicillins</a></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></code></pre><p></p></div></li>
|
||
<li><p><strong>Weighted-Incidence Syndromic Combination Antibiogram (WISCA)</strong></p>
|
||
<p>Case example: 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</p>
|
||
<p>Code example:</p>
|
||
<p></p><div class="sourceCode r"><pre><code><span><span class="fu"><a href="../reference/antibiogram.html">antibiogram</a></span><span class="op">(</span><span class="va">your_data</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>
|
||
<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">your_data</span><span class="op">$</span><span class="va">age</span> <span class="op">>=</span> <span class="fl">65</span> <span class="op">&</span> <span class="va">your_data</span><span class="op">$</span><span class="va">gender</span> <span class="op">==</span> <span class="st">"Male"</span>,</span>
|
||
<span> <span class="st">"Group 1"</span>, <span class="st">"Group 2"</span><span class="op">)</span><span class="op">)</span></span></code></pre><p></p></div></li>
|
||
</ol><p>All types of antibiograms can be generated with the functions as described on this page, and can be plotted (using <code><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">ggplot2::autoplot()</a></code> or base <span style="R">R</span> <code><a href="plot.html">plot()</a></code>/<code><a href="https://rdrr.io/r/graphics/barplot.html" class="external-link">barplot()</a></code>) or printed into R Markdown / Quarto formats for reports. Use functions from specific 'table reporting' packages to transform the output of <code>antibiogram()</code> to your needs, e.g. <code>flextable::as_flextable()</code> or <code>gt::gt()</code>.</p>
|
||
<p>Note that for combination antibiograms, it is important to realise that susceptibility can be calculated in two ways, which can be set with the <code>only_all_tested</code> argument (defaults to <code>FALSE</code>). See this example for two antibiotics, Drug A and Drug B, about how <code>antibiogram()</code> works to calculate the %SI:</p>
|
||
<p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="sc">--------------------------------------------------------------------</span></span>
|
||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> only_all_tested <span class="ot">=</span> <span class="cn">FALSE</span> only_all_tested <span class="ot">=</span> <span class="cn">TRUE</span></span>
|
||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="sc">-----------------------</span> <span class="sc">-----------------------</span></span>
|
||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> Drug A Drug B include as include as include as include as</span>
|
||
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> numerator denominator numerator denominator</span>
|
||
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="sc">--------</span> <span class="sc">--------</span> <span class="sc">----------</span> <span class="sc">-----------</span> <span class="sc">----------</span> <span class="sc">-----------</span></span>
|
||
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> S or I S or I X X X X</span>
|
||
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> R S or I X X X X</span>
|
||
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> <span class="sc"><</span><span class="cn">NA</span><span class="sc">></span> S or I X X <span class="sc">-</span> <span class="sc">-</span></span>
|
||
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> S or I R X X X X</span>
|
||
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> R R <span class="sc">-</span> X <span class="sc">-</span> X</span>
|
||
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a> <span class="sc"><</span><span class="cn">NA</span><span class="sc">></span> R <span class="sc">-</span> <span class="sc">-</span> <span class="sc">-</span> <span class="sc">-</span></span>
|
||
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> S or I <span class="sc"><</span><span class="cn">NA</span><span class="sc">></span> X X <span class="sc">-</span> <span class="sc">-</span></span>
|
||
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a> R <span class="sc"><</span><span class="cn">NA</span><span class="sc">></span> <span class="sc">-</span> <span class="sc">-</span> <span class="sc">-</span> <span class="sc">-</span></span>
|
||
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a> <span class="er"><</span><span class="cn">NA</span><span class="sc">></span> <span class="er"><</span><span class="cn">NA</span><span class="sc">></span> <span class="sc">-</span> <span class="sc">-</span> <span class="sc">-</span> <span class="sc">-</span></span>
|
||
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="sc">--------------------------------------------------------------------</span></span></code></pre><p></p></div>
|
||
<p>Printing the antibiogram in non-interactive sessions will be done by <code><a href="https://rdrr.io/pkg/knitr/man/kable.html" class="external-link">knitr::kable()</a></code>, with support for <a href="https://rdrr.io/pkg/knitr/man/kable.html" class="external-link">all their implemented formats</a>, such as "markdown". The knitr format will be automatically determined if printed inside a knitr document (LaTeX, HTML, etc.).</p>
|
||
</div>
|
||
|
||
<div class="section level2">
|
||
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
|
||
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="co"># example_isolates is a data set available in the AMR package.</span></span></span>
|
||
<span class="r-in"><span><span class="co"># run ?example_isolates for more info.</span></span></span>
|
||
<span class="r-in"><span><span class="va">example_isolates</span></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 2,000 × 46</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> date patient age gender ward mo PEN OXA FLC AMX </span>
|
||
<span class="r-out co"><span class="r-pr">#></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;"><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 class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA </span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># … with 1,990 more rows, and 36 more variables: AMC <sir>, AMP <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TZP <sir>, CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># CAZ <sir>, CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># TMP <sir>, SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># MFX <sir>, VAN <sir>, TEC <sir>, TCY <sir>, TGC <sir>, DOX <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># ERY <sir>, CLI <sir>, AZM <sir>, IPM <sir>, MEM <sir>, MTR <sir>,</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># CHL <sir>, COL <sir>, MUP <sir>, RIF <sir></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># Traditional antibiogram ----------------------------------------------</span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><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="antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="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="r-msg co"><span class="r-pr">#></span> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 502 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 10 × 7</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Pathogen (N min-max)` AMK GEN IPM KAN MEM TOB</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> CoNS (43-309) 0 86 52 0 52 22</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> E. coli (0-462) 100 98 100 <span style="color: #BB0000;">NA</span> 100 97</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> E. faecalis (0-39) 0 0 100 0 <span style="color: #BB0000;">NA</span> 0</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> K. pneumoniae (0-58) <span style="color: #BB0000;">NA</span> 90 100 <span style="color: #BB0000;">NA</span> 100 90</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> P. aeruginosa (17-30) <span style="color: #BB0000;">NA</span> 100 <span style="color: #BB0000;">NA</span> 0 <span style="color: #BB0000;">NA</span> 100</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> P. mirabilis (0-34) <span style="color: #BB0000;">NA</span> 94 94 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 94</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> S. aureus (2-233) <span style="color: #BB0000;">NA</span> 99 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 98</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> S. epidermidis (8-163) 0 79 <span style="color: #BB0000;">NA</span> 0 <span style="color: #BB0000;">NA</span> 51</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> S. hominis (3-80) <span style="color: #BB0000;">NA</span> 92 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 85</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> S. pneumoniae (11-117) 0 0 <span style="color: #BB0000;">NA</span> 0 <span style="color: #BB0000;">NA</span> 0</span>
|
||
<span class="r-in"><span> </span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><span> antibiotics <span class="op">=</span> <span class="fu"><a href="antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>,</span></span>
|
||
<span class="r-in"><span> ab_transform <span class="op">=</span> <span class="st">"atc"</span>,</span></span>
|
||
<span class="r-in"><span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 4 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 2 × 5</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Pathogen (N min-max)` J01GB01 J01GB03 J01GB04 J01GB06</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">1</span> Gram-negative (35-686) 96 96 0 98</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">2</span> Gram-positive (436-1170) 34 63 0 0</span>
|
||
<span class="r-in"><span> </span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><span> antibiotics <span class="op">=</span> <span class="fu"><a href="antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span>,</span></span>
|
||
<span class="r-in"><span> ab_transform <span class="op">=</span> <span class="st">"name"</span>,</span></span>
|
||
<span class="r-in"><span> mo_transform <span class="op">=</span> <span class="st">"name"</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 172 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 5 × 3</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Pathogen (N min-max)` Imipenem Meropenem</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">1</span> Coagulase-negative Staphylococcus (CoNS) (48-48) 52 52</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">2</span> Enterococcus faecalis (0-38) 100 <span style="color: #BB0000;">NA</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">3</span> Escherichia coli (418-422) 100 100</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">4</span> Klebsiella pneumoniae (51-53) 100 100</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">5</span> Proteus mirabilis (27-32) 94 <span style="color: #BB0000;">NA</span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># Combined antibiogram -------------------------------------------------</span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># combined antibiotics yield higher empiric coverage</span></span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><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></span>
|
||
<span class="r-in"><span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 3 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 2 × 4</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Pathogen (N min-max)` TZP `TZP + GEN` `TZP + TOB`</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">1</span> Gram-negative (641-693) 88 99 98</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">2</span> Gram-positive (345-1044) 86 98 95</span>
|
||
<span class="r-in"><span> </span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><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="op">)</span>,</span></span>
|
||
<span class="r-in"><span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span>,</span></span>
|
||
<span class="r-in"><span> ab_transform <span class="op">=</span> <span class="st">"name"</span>,</span></span>
|
||
<span class="r-in"><span> sep <span class="op">=</span> <span class="st">" & "</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 2 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 2 × 3</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Pathogen (N min-max)` `Piperacillin/tazobactam` Piperacillin/tazobactam & …¹</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">1</span> Gram-negative (641-693) 88 98</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">2</span> Gram-positive (345-550) 86 95</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># … with abbreviated variable name ¹`Piperacillin/tazobactam & Tobramycin`</span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># Syndromic antibiogram ------------------------------------------------</span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># the data set could contain a filter for e.g. respiratory specimens</span></span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><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="antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>,</span></span>
|
||
<span class="r-in"><span> syndromic_group <span class="op">=</span> <span class="st">"ward"</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 1581 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 14 × 8</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Syndromic Group` `Pathogen (N min-max)` AMK GEN IPM KAN MEM TOB</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 1</span> Clinical CoNS (23-205) <span style="color: #BB0000;">NA</span> 89 57 <span style="color: #BB0000;">NA</span> 57 26</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 2</span> ICU CoNS (10-73) <span style="color: #BB0000;">NA</span> 79 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 3</span> Outpatient CoNS (3-31) <span style="color: #BB0000;">NA</span> 84 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 4</span> Clinical E. coli (0-299) 100 98 100 <span style="color: #BB0000;">NA</span> 100 98</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 5</span> ICU E. coli (0-137) 100 99 100 <span style="color: #BB0000;">NA</span> 100 96</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 6</span> Clinical K. pneumoniae (0-51) <span style="color: #BB0000;">NA</span> 92 100 <span style="color: #BB0000;">NA</span> 100 92</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 7</span> Clinical P. mirabilis (0-30) <span style="color: #BB0000;">NA</span> 100 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 100</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 8</span> Clinical S. aureus (2-150) <span style="color: #BB0000;">NA</span> 99 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 97</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;"> 9</span> ICU S. aureus (0-66) <span style="color: #BB0000;">NA</span> 100 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">10</span> Clinical S. epidermidis (4-79) <span style="color: #BB0000;">NA</span> 82 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 55</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">11</span> ICU S. epidermidis (4-75) <span style="color: #BB0000;">NA</span> 72 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 41</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">12</span> Clinical S. hominis (1-45) <span style="color: #BB0000;">NA</span> 96 <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 94</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">13</span> Clinical S. pneumoniae (5-78) 0 0 <span style="color: #BB0000;">NA</span> 0 <span style="color: #BB0000;">NA</span> 0</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">14</span> ICU S. pneumoniae (5-30) 0 0 <span style="color: #BB0000;">NA</span> 0 <span style="color: #BB0000;">NA</span> 0</span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># now define a data set with only E. coli</span></span></span>
|
||
<span class="r-in"><span><span class="va">ex1</span> <span class="op"><-</span> <span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/which.html" class="external-link">which</a></span><span class="op">(</span><span class="fu"><a href="mo_property.html">mo_genus</a></span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"Escherichia"</span><span class="op">)</span>, <span class="op">]</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ Using column 'mo' as input for mo_genus()</span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># with a custom language, though this will be determined automatically</span></span></span>
|
||
<span class="r-in"><span><span class="co"># (i.e., this table will be in Spanish on Spanish systems)</span></span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">ex1</span>,</span></span>
|
||
<span class="r-in"><span> antibiotics <span class="op">=</span> <span class="fu"><a href="antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>,</span></span>
|
||
<span class="r-in"><span> ab_transform <span class="op">=</span> <span class="st">"name"</span>,</span></span>
|
||
<span class="r-in"><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">ex1</span><span class="op">$</span><span class="va">ward</span> <span class="op">==</span> <span class="st">"ICU"</span>,</span></span>
|
||
<span class="r-in"><span> <span class="st">"UCI"</span>, <span class="st">"No UCI"</span><span class="op">)</span>,</span></span>
|
||
<span class="r-in"><span> language <span class="op">=</span> <span class="st">"es"</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> (tobramycin), 'AMK' (amikacin) and 'KAN' (kanamycin)</span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 2 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 2 × 5</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Grupo sindrómico` `Patógeno (N min-max)` Amikacina Gentamicina Tobramicina</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">1</span> No UCI E. coli (0-325) 100 98 98</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">2</span> UCI E. coli (0-137) 100 99 96</span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># Weighted-incidence syndromic combination antibiogram (WISCA) ---------</span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># the data set could contain a filter for e.g. respiratory specimens</span></span></span>
|
||
<span class="r-in"><span><span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><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>
|
||
<span class="r-in"><span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span>,</span></span>
|
||
<span class="r-in"><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>
|
||
<span class="r-in"><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="r-in"><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="r-in"><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="r-msg co"><span class="r-pr">#></span> ℹ 8 combinations had less than minimum = 10 results and were ignored</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #949494;"># A tibble: 4 × 6</span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> `Syndromic Group` `Pathogen (N min-max)` AMC `AMC + CIP` TZP `TZP + TOB`</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">*</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;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span> <span style="color: #949494; font-style: italic;"><dbl></span></span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">1</span> WISCA Group 1 Gram-negative (261-285) 76 95 89 99</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">2</span> WISCA Group 2 Gram-negative (380-442) 76 98 88 98</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">3</span> WISCA Group 1 Gram-positive (123-406) 76 89 81 95</span>
|
||
<span class="r-out co"><span class="r-pr">#></span> <span style="color: #BCBCBC;">4</span> WISCA Group 2 Gram-positive (222-732) 76 89 88 95</span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="co"># Generate plots with ggplot2 or base R --------------------------------</span></span></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="va">ab1</span> <span class="op"><-</span> <span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><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">"CIP"</span>, <span class="st">"TZP"</span>, <span class="st">"TZP+TOB"</span><span class="op">)</span>,</span></span>
|
||
<span class="r-in"><span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 4 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-in"><span><span class="va">ab2</span> <span class="op"><-</span> <span class="fu">antibiogram</span><span class="op">(</span><span class="va">example_isolates</span>,</span></span>
|
||
<span class="r-in"><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">"CIP"</span>, <span class="st">"TZP"</span>, <span class="st">"TZP+TOB"</span><span class="op">)</span>,</span></span>
|
||
<span class="r-in"><span> mo_transform <span class="op">=</span> <span class="st">"gramstain"</span>,</span></span>
|
||
<span class="r-in"><span> syndromic_group <span class="op">=</span> <span class="st">"ward"</span><span class="op">)</span></span></span>
|
||
<span class="r-msg co"><span class="r-pr">#></span> ℹ 16 combinations had less than minimum = 30 results and were ignored</span>
|
||
<span class="r-in"><span> </span></span>
|
||
<span class="r-in"><span><span class="fu"><a href="plot.html">plot</a></span><span class="op">(</span><span class="va">ab1</span><span class="op">)</span></span></span>
|
||
<span class="r-plt img"><img src="antibiogram-1.png" alt="" width="700" height="433"></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/ns-load.html" class="external-link">requireNamespace</a></span><span class="op">(</span><span class="st">"ggplot2"</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
|
||
<span class="r-in"><span> <span class="fu">ggplot2</span><span class="fu">::</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">ab1</span><span class="op">)</span></span></span>
|
||
<span class="r-in"><span><span class="op">}</span></span></span>
|
||
<span class="r-plt img"><img src="antibiogram-2.png" alt="" width="700" height="433"></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="fu"><a href="plot.html">plot</a></span><span class="op">(</span><span class="va">ab2</span><span class="op">)</span></span></span>
|
||
<span class="r-plt img"><img src="antibiogram-3.png" alt="" width="700" height="433"></span>
|
||
<span class="r-in"><span></span></span>
|
||
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/ns-load.html" class="external-link">requireNamespace</a></span><span class="op">(</span><span class="st">"ggplot2"</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
|
||
<span class="r-in"><span> <span class="fu">ggplot2</span><span class="fu">::</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">ab2</span><span class="op">)</span></span></span>
|
||
<span class="r-in"><span><span class="op">}</span></span></span>
|
||
<span class="r-plt img"><img src="antibiogram-4.png" alt="" width="700" height="433"></span>
|
||
</code></pre></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>
|
||
|