1
0
mirror of https://github.com/msberends/AMR.git synced 2025-01-31 03:04:37 +01:00
AMR/reference/antibiogram.html
2025-01-27 21:50:54 +00:00

606 lines
83 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Generate Traditional, Combination, Syndromic, or WISCA Antibiograms — 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.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Lato-0.4.9/font.css" rel="stylesheet"><link href="../deps/Fira_Code-0.4.9/font.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet"><script src="../extra.js"></script><meta property="og:title" content="Generate Traditional, Combination, Syndromic, or WISCA Antibiograms — antibiogram"><meta name="description" content="Create detailed antibiograms with options for traditional, combination, syndromic, and Bayesian WISCA methods.
Adhering to previously described approaches (see Source) and especially the Bayesian WISCA model (Weighted-Incidence Syndromic Combination Antibiogram) by Bielicki et al., these functions provides flexible output formats including plots and tables, ideal for integration with R Markdown and Quarto reports."><meta property="og:description" content="Create detailed antibiograms with options for traditional, combination, syndromic, and Bayesian WISCA methods.
Adhering to previously described approaches (see Source) and especially the Bayesian WISCA model (Weighted-Incidence Syndromic Combination Antibiogram) by Bielicki et al., these functions provides flexible output formats including plots and tables, ideal for integration with R Markdown and Quarto reports."><meta property="og:image" content="https://msberends.github.io/AMR/logo.svg"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous"><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-primary" data-bs-theme="dark" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">AMR (for R)</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9133</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto"><li class="active nav-item dropdown">
<button class="nav-link dropdown-toggle" type="button" id="dropdown-how-to" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true"><span class="fa fa-question-circle"></span> How to</button>
<ul class="dropdown-menu" aria-labelledby="dropdown-how-to"><li><a class="dropdown-item" href="../articles/AMR.html"><span class="fa fa-directions"></span> Conduct AMR Analysis</a></li>
<li><a class="dropdown-item" href="../reference/antibiogram.html"><span class="fa fa-file-prescription"></span> Generate Antibiogram (Trad./Syndromic/WISCA)</a></li>
<li><a class="dropdown-item" href="../articles/resistance_predict.html"><span class="fa fa-dice"></span> Predict Antimicrobial Resistance</a></li>
<li><a class="dropdown-item" href="../articles/datasets.html"><span class="fa fa-database"></span> Download Data Sets for Own Use</a></li>
<li><a class="dropdown-item" href="../articles/AMR_with_tidymodels.html"><span class="fa fa-square-root-variable"></span> Use AMR for Predictive Modelling (tidymodels)</a></li>
<li><a class="dropdown-item" href="../reference/AMR-options.html"><span class="fa fa-gear"></span> Set User- Or Team-specific Package Settings</a></li>
<li><a class="dropdown-item" href="../articles/PCA.html"><span class="fa fa-compress"></span> Conduct Principal Component Analysis for AMR</a></li>
<li><a class="dropdown-item" href="../articles/MDR.html"><span class="fa fa-skull-crossbones"></span> Determine Multi-Drug Resistance (MDR)</a></li>
<li><a class="dropdown-item" href="../articles/WHONET.html"><span class="fa fa-globe-americas"></span> Work with WHONET Data</a></li>
<li><a class="dropdown-item" href="../articles/EUCAST.html"><span class="fa fa-exchange-alt"></span> Apply Eucast Rules</a></li>
<li><a class="dropdown-item" href="../reference/mo_property.html"><span class="fa fa-bug"></span> Get Taxonomy of a Microorganism</a></li>
<li><a class="dropdown-item" href="../reference/ab_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antibiotic Drug</a></li>
<li><a class="dropdown-item" href="../reference/av_property.html"><span class="fa fa-capsules"></span> Get Properties of an Antiviral Drug</a></li>
</ul></li>
<li class="nav-item"><a class="nav-link" href="../articles/AMR_for_Python.html"><span class="fa fab fa-python"></span> AMR for Python</a></li>
<li class="nav-item"><a class="nav-link" href="../reference/index.html"><span class="fa fa-book-open"></span> Manual</a></li>
<li class="nav-item"><a class="nav-link" href="../authors.html"><span class="fa fa-users"></span> Authors</a></li>
</ul><ul class="navbar-nav"><li class="nav-item"><a class="nav-link" href="../news/index.html"><span class="fa far fa-newspaper"></span> Changelog</a></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/msberends/AMR"><span class="fa fab fa-github"></span> Source Code</a></li>
</ul></div>
</div>
</nav><div class="container template-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 Traditional, Combination, Syndromic, or WISCA Antibiograms</h1>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/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>Create detailed antibiograms with options for traditional, combination, syndromic, and Bayesian WISCA methods.</p>
<p>Adhering to previously described approaches (see <em>Source</em>) and especially the Bayesian WISCA model (Weighted-Incidence Syndromic Combination Antibiogram) by Bielicki <em>et al.</em>, these functions provides flexible output formats including plots and tables, ideal for integration with R Markdown and Quarto reports.</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 class="va">x</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>, mo_transform <span class="op">=</span> <span class="st">"shortname"</span>,</span>
<span> ab_transform <span class="op">=</span> <span class="st">"name"</span>, syndromic_group <span class="op">=</span> <span class="cn">NULL</span>, add_total_n <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> only_all_tested <span class="op">=</span> <span class="cn">FALSE</span>, digits <span class="op">=</span> <span class="fl">0</span>,</span>
<span> formatting_type <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_antibiogram_formatting_type"</span>,</span>
<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">wisca</span>, <span class="fl">18</span>, <span class="fl">10</span><span class="op">)</span><span class="op">)</span>, col_mo <span class="op">=</span> <span class="cn">NULL</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>, combine_SI <span class="op">=</span> <span class="cn">TRUE</span>, sep <span class="op">=</span> <span class="st">" + "</span>, wisca <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> simulations <span class="op">=</span> <span class="fl">1000</span>, conf_interval <span class="op">=</span> <span class="fl">0.95</span>, interval_side <span class="op">=</span> <span class="st">"two-tailed"</span>,</span>
<span> info <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="op">)</span></span>
<span></span>
<span><span class="fu">wisca</span><span class="op">(</span><span class="va">x</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>, mo_transform <span class="op">=</span> <span class="st">"shortname"</span>,</span>
<span> ab_transform <span class="op">=</span> <span class="st">"name"</span>, syndromic_group <span class="op">=</span> <span class="cn">NULL</span>, add_total_n <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> only_all_tested <span class="op">=</span> <span class="cn">FALSE</span>, digits <span class="op">=</span> <span class="fl">0</span>,</span>
<span> formatting_type <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_antibiogram_formatting_type"</span>, <span class="fl">18</span><span class="op">)</span>,</span>
<span> col_mo <span class="op">=</span> <span class="cn">NULL</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>, minimum <span class="op">=</span> <span class="fl">30</span>,</span>
<span> combine_SI <span class="op">=</span> <span class="cn">TRUE</span>, sep <span class="op">=</span> <span class="st">" + "</span>, simulations <span class="op">=</span> <span class="fl">1000</span>,</span>
<span> info <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="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class '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 class '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 class 'antibiogram'</span></span>
<span><span class="fu">knit_print</span><span class="op">(</span><span class="va">x</span>, italicise <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span> na <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"knitr.kable.NA"</span>, default <span class="op">=</span> <span class="st">""</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>Bielicki JA <em>et al.</em> (2016). <strong>Selecting appropriate empirical antibiotic regimens for paediatric bloodstream infections: application of a Bayesian decision model to local and pooled antimicrobial resistance surveillance data</strong> <em>Journal of Antimicrobial Chemotherapy</em> 71(3); <a href="https://doi.org/10.1093/jac/dkv397" class="external-link">doi:10.1093/jac/dkv397</a></p></li>
<li><p>Bielicki JA <em>et al.</em> (2020). <strong>Evaluation of the coverage of 3 antibiotic regimens for neonatal sepsis in the hospital setting across Asian countries</strong> <em>JAMA Netw Open.</em> 3(2):e1921124; <a href="https://doi.org/10.1001.jamanetworkopen.2019.21124" class="external-link">doi:10.1001.jamanetworkopen.2019.21124</a></p></li>
<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 &amp; 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 id="arg-x">x<a class="anchor" aria-label="anchor" href="#arg-x"></a></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 antimicrobial results (class 'sir', see <code><a href="as.sir.html">as.sir()</a></code>)</p></dd>
<dt id="arg-antibiotics">antibiotics<a class="anchor" aria-label="anchor" href="#arg-antibiotics"></a></dt>
<dd><p>vector of any antimicrobial name or code (will be evaluated with <code><a href="as.ab.html">as.ab()</a></code>, column name of <code>x</code>, or (any combinations of) <a href="antimicrobial_class_selectors.html">antimicrobial selectors</a> such as <code><a href="antimicrobial_class_selectors.html">aminoglycosides()</a></code> or <code><a href="antimicrobial_class_selectors.html">carbapenems()</a></code>. For combination antibiograms, this can also be set to values separated with <code>"+"</code>, such as "TZP+TOB" or "cipro + genta", given that columns resembling such antimicrobials exist in <code>x</code>. See <em>Examples</em>.</p></dd>
<dt id="arg-mo-transform">mo_transform<a class="anchor" aria-label="anchor" href="#arg-mo-transform"></a></dt>
<dd><p>a character to transform microorganism input - must be <code>"name"</code>, <code>"shortname"</code> (default), <code>"gramstain"</code>, 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", "oxygen_tolerance", "source", "lpsn", "lpsn_parent", "lpsn_renamed_to", "mycobank", "mycobank_parent", "mycobank_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 id="arg-ab-transform">ab_transform<a class="anchor" aria-label="anchor" href="#arg-ab-transform"></a></dt>
<dd><p>a character to transform antimicrobial input - must be one of the column names of the <a href="antibiotics.html">antibiotics</a> data set (defaults to <code>"name"</code>): "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 id="arg-syndromic-group">syndromic_group<a class="anchor" aria-label="anchor" href="#arg-syndromic-group"></a></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 id="arg-add-total-n">add_total_n<a class="anchor" aria-label="anchor" href="#arg-add-total-n"></a></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 (default is <code>TRUE</code>). This will add the lowest and highest number of available isolates per antimicrobial (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 id="arg-only-all-tested">only_all_tested<a class="anchor" aria-label="anchor" href="#arg-only-all-tested"></a></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 antimicrobials, see <em>Details</em></p></dd>
<dt id="arg-digits">digits<a class="anchor" aria-label="anchor" href="#arg-digits"></a></dt>
<dd><p>number of digits to use for rounding the susceptibility percentage</p></dd>
<dt id="arg-formatting-type">formatting_type<a class="anchor" aria-label="anchor" href="#arg-formatting-type"></a></dt>
<dd><p>numeric value (122 for WISCA, 1-12 for non-WISCA) indicating how the 'cells' of the antibiogram table should be formatted. See <em>Details</em> &gt; <em>Formatting Type</em> for a list of options.</p></dd>
<dt id="arg-col-mo">col_mo<a class="anchor" aria-label="anchor" href="#arg-col-mo"></a></dt>
<dd><p>column name of the names or codes of the microorganisms (see <code><a href="as.mo.html">as.mo()</a></code>) - the default is 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 id="arg-language">language<a class="anchor" aria-label="anchor" href="#arg-language"></a></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 id="arg-minimum">minimum<a class="anchor" aria-label="anchor" href="#arg-minimum"></a></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 id="arg-combine-si">combine_SI<a class="anchor" aria-label="anchor" href="#arg-combine-si"></a></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, SDD, or I, instead of only S (default is <code>TRUE</code>)</p></dd>
<dt id="arg-sep">sep<a class="anchor" aria-label="anchor" href="#arg-sep"></a></dt>
<dd><p>a separating character for antimicrobial columns in combination antibiograms</p></dd>
<dt id="arg-wisca">wisca<a class="anchor" aria-label="anchor" href="#arg-wisca"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether a Weighted-Incidence Syndromic Combination Antibiogram (WISCA) must be generated (default is <code>FALSE</code>). This will use a Bayesian hierarchical model to estimate regimen coverage probabilities using Montecarlo simulations. Set <code>simulations</code> to adjust.</p></dd>
<dt id="arg-simulations">simulations<a class="anchor" aria-label="anchor" href="#arg-simulations"></a></dt>
<dd><p>(for WISCA) a numerical value to set the number of Montecarlo simulations</p></dd>
<dt id="arg-conf-interval">conf_interval<a class="anchor" aria-label="anchor" href="#arg-conf-interval"></a></dt>
<dd><p>(for WISCA) a numerical value to set confidence interval (default is <code>0.95</code>)</p></dd>
<dt id="arg-interval-side">interval_side<a class="anchor" aria-label="anchor" href="#arg-interval-side"></a></dt>
<dd><p>(for WISCA) the side of the confidence interval, either <code>"two-tailed"</code> (default), <code>"left"</code> or <code>"right"</code></p></dd>
<dt id="arg-info">info<a class="anchor" aria-label="anchor" href="#arg-info"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate info should be printed - the default is <code>TRUE</code> only in interactive mode</p></dd>
<dt id="arg--">...<a class="anchor" aria-label="anchor" href="#arg--"></a></dt>
<dd><p>when used in <a href="https://rdrr.io/pkg/knitr/man/kable.html" class="external-link">R Markdown or Quarto</a>: arguments passed on to <code><a href="https://rdrr.io/pkg/knitr/man/kable.html" class="external-link">knitr::kable()</a></code> (otherwise, has no use)</p></dd>
<dt id="arg-object">object<a class="anchor" aria-label="anchor" href="#arg-object"></a></dt>
<dd><p>an <code>antibiogram()</code> object</p></dd>
<dt id="arg-italicise">italicise<a class="anchor" aria-label="anchor" href="#arg-italicise"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether the microorganism names in the <a href="https://rdrr.io/pkg/knitr/man/kable.html" class="external-link">knitr</a> table should be made italic, using <code><a href="italicise_taxonomy.html">italicise_taxonomy()</a></code>.</p></dd>
<dt id="arg-na">na<a class="anchor" aria-label="anchor" href="#arg-na"></a></dt>
<dd><p>character to use for showing <code>NA</code> values</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>For estimating antimicrobial coverage, especially when creating a WISCA, the outcome might become more reliable by only including the top <em>n</em> species encountered in the data. You can filter on this top <em>n</em> using <code><a href="top_n_microorganisms.html">top_n_microorganisms()</a></code>. For example, use <code>top_n_microorganisms(your_data, n = 10)</code> as a pre-processing step to only include the top 10 species in the data.</p>
<p>The numeric values of an antibiogram are stored in a long format as the <a href="https://rdrr.io/r/base/attributes.html" class="external-link">attribute</a> <code>long_numeric</code>. You can retrieve them using <code>attributes(x)$long_numeric</code>, where <code>x</code> is the outcome of <code>antibiogram()</code> or <code>wisca()</code>. This is ideal for e.g. advanced plotting.</p><div class="section">
<h3 id="formatting-type">Formatting Type<a class="anchor" aria-label="anchor" href="#formatting-type"></a></h3>
<p>The formatting of the 'cells' of the table can be set with the argument <code>formatting_type</code>. In these examples, <code>5</code> is the susceptibility percentage (for WISCA: <code>4-6</code> indicates the confidence level), <code>15</code> the numerator, and <code>300</code> the denominator:</p><ol><li><p>5</p></li>
<li><p>15</p></li>
<li><p>300</p></li>
<li><p>15/300</p></li>
<li><p>5 (300)</p></li>
<li><p>5% (300)</p></li>
<li><p>5 (N=300)</p></li>
<li><p>5% (N=300)</p></li>
<li><p>5 (15/300)</p></li>
<li><p>5% (15/300) - <strong>default for non-WISCA</strong></p></li>
<li><p>5 (N=15/300)</p></li>
<li><p>5% (N=15/300)</p>
<p>Additional options for WISCA (using <code>antibiogram(..., wisca = TRUE)</code> or <code>wisca()</code>):</p></li>
<li><p>5 (4-6)</p></li>
<li><p>5% (4-6%)</p></li>
<li><p>5 (4-6,300)</p></li>
<li><p>5% (4-6%,300)</p></li>
<li><p>5 (4-6,N=300)</p></li>
<li><p>5% (4-6%,N=300) - <strong>default for WISCA</strong></p></li>
<li><p>5 (4-6,15/300)</p></li>
<li><p>5% (4-6%,15/300)</p></li>
<li><p>5 (4-6,N=15/300)</p></li>
<li><p>5% (4-6%,N=15/300)</p></li>
</ol><p>The default is <code>18</code> for WISCA and <code>10</code> for non-WISCA, which can be set globally with the package option <code><a href="AMR-options.html">AMR_antibiogram_formatting_type</a></code>, e.g. <code>options(AMR_antibiogram_formatting_type = 5)</code>.</p>
<p>Set <code>digits</code> (defaults to <code>0</code>) to alter the rounding of the susceptibility percentages.</p>
</div>
<div class="section">
<h3 id="antibiogram-types">Antibiogram Types<a class="anchor" aria-label="anchor" href="#antibiogram-types"></a></h3>
<p>There are various antibiogram types, as summarised 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>
<p><strong>Use WISCA whenever possible</strong>, since it provides more precise coverage estimates by accounting for pathogen incidence and antimicrobial susceptibility, as has been shown by Bielicki <em>et al.</em> (2020, <a href="https://doi.org/10.1001.jamanetworkopen.2019.21124" class="external-link">doi:10.1001.jamanetworkopen.2019.21124</a>
). See the section <em>Why Use WISCA?</em> on this page.</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/antimicrobial_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>WISCA can be applied to any antibiogram, see the section <em>Why Use WISCA?</em> on this page for more information.</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> wisca <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># this is equal to:</span></span>
<span><span class="fu"><a href="../reference/antibiogram.html">wisca</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>
<p>WISCA uses a sophisticated Bayesian decision model to combine both local and pooled antimicrobial resistance data. This approach not only evaluates local patterns but can also draw on multi-centre datasets to improve regimen accuracy, even in low-incidence infections like paediatric bloodstream infections (BSIs).</p></li>
</ol><p>Grouped <a href="https://tibble.tidyverse.org/reference/tibble.html" class="external-link">tibbles</a> can also be used to calculate susceptibilities over various groups.</p>
<p>Code example:</p>
<p></p><div class="sourceCode r"><pre><code><span><span class="va">your_data</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span>
<span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by</a></span><span class="op">(</span><span class="va">has_sepsis</span>, <span class="va">is_neonate</span>, <span class="va">sex</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span>
<span> <span class="fu"><a href="../reference/antibiogram.html">wisca</a></span><span class="op">(</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>
</div>
<div class="section">
<h3 id="inclusion-in-combination-antibiogram-and-syndromic-antibiogram">Inclusion in Combination Antibiogram and Syndromic Antibiogram<a class="anchor" aria-label="anchor" href="#inclusion-in-combination-antibiogram-and-syndromic-antibiogram"></a></h3>
<p>Note that for types 2 and 3 (Combination Antibiogram and Syndromic Antibiogram), 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 (default is <code>FALSE</code>). See this example for two antimicrobials, 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" tabindex="-1"></a><span class="sc">--------------------------------------------------------------------</span></span>
<span id="cb1-2"><a href="#cb1-2" 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" tabindex="-1"></a> <span class="sc">-----------------------</span> <span class="sc">-----------------------</span></span>
<span id="cb1-4"><a href="#cb1-4" tabindex="-1"></a> Drug A Drug B include as include as include as include as</span>
<span id="cb1-5"><a href="#cb1-5" tabindex="-1"></a> numerator denominator numerator denominator</span>
<span id="cb1-6"><a href="#cb1-6" 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" tabindex="-1"></a> S or I S or I X X X X</span>
<span id="cb1-8"><a href="#cb1-8" tabindex="-1"></a> R S or I X X X X</span>
<span id="cb1-9"><a href="#cb1-9" tabindex="-1"></a> <span class="sc">&lt;</span><span class="cn">NA</span><span class="sc">&gt;</span> S or I X X <span class="sc">-</span> <span class="sc">-</span></span>
<span id="cb1-10"><a href="#cb1-10" tabindex="-1"></a> S or I R X X X X</span>
<span id="cb1-11"><a href="#cb1-11" tabindex="-1"></a> R R <span class="sc">-</span> X <span class="sc">-</span> X</span>
<span id="cb1-12"><a href="#cb1-12" tabindex="-1"></a> <span class="sc">&lt;</span><span class="cn">NA</span><span class="sc">&gt;</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" tabindex="-1"></a> S or I <span class="sc">&lt;</span><span class="cn">NA</span><span class="sc">&gt;</span> X X <span class="sc">-</span> <span class="sc">-</span></span>
<span id="cb1-14"><a href="#cb1-14" tabindex="-1"></a> R <span class="sc">&lt;</span><span class="cn">NA</span><span class="sc">&gt;</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" tabindex="-1"></a> <span class="er">&lt;</span><span class="cn">NA</span><span class="sc">&gt;</span> <span class="er">&lt;</span><span class="cn">NA</span><span class="sc">&gt;</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" tabindex="-1"></a><span class="sc">--------------------------------------------------------------------</span></span></code></pre><p></p></div>
</div>
<div class="section">
<h3 id="plotting">Plotting<a class="anchor" aria-label="anchor" href="#plotting"></a></h3>
<p>All types of antibiograms as listed above 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>'s <code><a href="plot.html">plot()</a></code> and <code><a href="https://rdrr.io/r/graphics/barplot.html" class="external-link">barplot()</a></code>).</p>
<p>THe outcome of <code>antibiogram()</code> can also be used directly in R Markdown / Quarto (i.e., <code>knitr</code>) for reports. In this case, <code><a href="https://rdrr.io/pkg/knitr/man/kable.html" class="external-link">knitr::kable()</a></code> will be applied automatically and microorganism names will even be printed in italics at default (see argument <code>italicise</code>).</p>
<p>You can also use functions from specific 'table reporting' packages to transform the output of <code>antibiogram()</code> to your needs, e.g. with <code>flextable::as_flextable()</code> or <code>gt::gt()</code>.</p>
</div>
</div>
<div class="section level2">
<h2 id="why-use-wisca-">Why Use WISCA?<a class="anchor" aria-label="anchor" href="#why-use-wisca-"></a></h2>
<p>WISCA, as outlined by Barbieri <em>et al.</em> (<a href="https://doi.org/10.1186/s13756-021-00939-2" class="external-link">doi:10.1186/s13756-021-00939-2</a>
), stands for Weighted-Incidence Syndromic Combination Antibiogram, which estimates the probability of adequate empirical antimicrobial regimen coverage for specific infection syndromes. This method leverages a Bayesian hierarchical logistic regression framework with random effects for pathogens and regimens, enabling robust estimates in the presence of sparse data.</p>
<p>The Bayesian model assumes conjugate priors for parameter estimation. For example, the coverage probability \(\theta\) for a given antimicrobial regimen is modelled using a Beta distribution as a prior:</p>
<p>$$\theta \sim \text{Beta}(\alpha_0, \beta_0)$$</p>
<p>where \(\alpha_0\) and \(\beta_0\) represent prior successes and failures, respectively, informed by expert knowledge or weakly informative priors (e.g., \(\alpha_0 = 1, \beta_0 = 1\)). The likelihood function is constructed based on observed data, where the number of covered cases for a regimen follows a binomial distribution:</p>
<p>$$y \sim \text{Binomial}(n, \theta)$$</p>
<p>Posterior parameter estimates are obtained by combining the prior and likelihood using Bayes' theorem. The posterior distribution of \(\theta\) is also a Beta distribution:</p>
<p>$$\theta | y \sim \text{Beta}(\alpha_0 + y, \beta_0 + n - y)$$</p>
<p>For hierarchical modelling, pathogen-level effects (e.g., differences in resistance patterns) and regimen-level effects are modelled using Gaussian priors on log-odds. This hierarchical structure ensures partial pooling of estimates across groups, improving stability in strata with small sample sizes. The model is implemented using Hamiltonian Monte Carlo (HMC) sampling.</p>
<p>Stratified results can be provided based on covariates such as age, sex, and clinical complexity (e.g., prior antimicrobial treatments or renal/urological comorbidities) using <code>dplyr</code>'s <code><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by()</a></code> as a pre-processing step before running <code>wisca()</code>. In this case, posterior odds ratios (ORs) are derived to quantify the effect of these covariates on coverage probabilities:</p>
<p>$$\text{OR}_{\text{covariate}} = \frac{\exp(\beta_{\text{covariate}})}{\exp(\beta_0)}$$</p>
<p>By combining empirical data with prior knowledge, WISCA overcomes the limitations
of traditional combination antibiograms, offering disease-specific, patient-stratified
estimates with robust uncertainty quantification. This tool is invaluable for antimicrobial
stewardship programs and empirical treatment guideline refinement.</p>
</div>
<div class="section level2">
<h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
<p>Implementation: Dr. Larisse Bolton and Dr. Matthijs Berends</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">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 46</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> date patient age gender ward mo PEN OXA FLC AMX </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;date&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;sir&gt;</span> <span style="color: #949494; font-style: italic;">&lt;sir&gt;</span> <span style="color: #949494; font-style: italic;">&lt;sir&gt;</span> <span style="color: #949494; font-style: italic;">&lt;sir&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</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">#&gt;</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">#&gt;</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">#&gt;</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">#&gt;</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">#&gt;</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">#&gt;</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">#&gt;</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">#&gt;</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">#&gt;</span> <span style="color: #949494;"># 1,990 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 36 more variables: AMC &lt;sir&gt;, AMP &lt;sir&gt;, TZP &lt;sir&gt;, CZO &lt;sir&gt;, FEP &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># CXM &lt;sir&gt;, FOX &lt;sir&gt;, CTX &lt;sir&gt;, CAZ &lt;sir&gt;, CRO &lt;sir&gt;, GEN &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># TOB &lt;sir&gt;, AMK &lt;sir&gt;, KAN &lt;sir&gt;, TMP &lt;sir&gt;, SXT &lt;sir&gt;, NIT &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># FOS &lt;sir&gt;, LNZ &lt;sir&gt;, CIP &lt;sir&gt;, MFX &lt;sir&gt;, VAN &lt;sir&gt;, TEC &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># TCY &lt;sir&gt;, TGC &lt;sir&gt;, DOX &lt;sir&gt;, ERY &lt;sir&gt;, CLI &lt;sir&gt;, AZM &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># IPM &lt;sir&gt;, MEM &lt;sir&gt;, MTR &lt;sir&gt;, CHL &lt;sir&gt;, COL &lt;sir&gt;, MUP &lt;sir&gt;, …</span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># \donttest{</span></span></span>
<span class="r-in"><span><span class="co"># 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="antimicrobial_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="antimicrobial_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><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (non-WISCA): 10 × 7</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Pathogen Amikacin Gentamicin Imipenem Kanamycin Meropenem Tobramycin</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> CoNS 0% (0/43) 86% (267/… 52% (25… 0% (0/43) 52% (25/… 22% (12/5…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> E. coli 100% (171/… 98% (451/… 100% (4… <span style="color: #BB0000;">NA</span> 100% (41… 97% (450/…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> E. faecalis 0% (0/39) 0% (0/39) 100% (3… 0% (0/39) <span style="color: #BB0000;">NA</span> 0% (0/39) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> K. pneumoniae <span style="color: #BB0000;">NA</span> 90% (52/5… 100% (5… <span style="color: #BB0000;">NA</span> 100% (53… 90% (52/5…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> P. aeruginosa <span style="color: #BB0000;">NA</span> 100% (30/… <span style="color: #BB0000;">NA</span> 0% (0/30) <span style="color: #BB0000;">NA</span> 100% (30/…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> P. mirabilis <span style="color: #BB0000;">NA</span> 94% (32/3… 94% (30… <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 94% (32/3…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> S. aureus <span style="color: #BB0000;">NA</span> 99% (231/… <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 98% (84/8…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> S. epidermidis 0% (0/44) 79% (128/… <span style="color: #BB0000;">NA</span> 0% (0/44) <span style="color: #BB0000;">NA</span> 51% (45/8…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> S. hominis <span style="color: #BB0000;">NA</span> 92% (74/8… <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 85% (53/6…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> S. pneumoniae 0% (0/117) 0% (0/117) <span style="color: #BB0000;">NA</span> 0% (0/11… <span style="color: #BB0000;">NA</span> 0% (0/117)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</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="antimicrobial_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></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (non-WISCA): 2 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Pathogen J01GB01 J01GB03 J01GB04 J01GB06 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Gram-negative 96% (658/686) 96% (659/684) 0% (0/35) 98% (251/256)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> Gram-positive 34% (228/665) 63% (740/1170) 0% (0/436) 0% (0/436) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</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="antimicrobial_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></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (non-WISCA): 5 × 3</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Pathogen Imipenem Meropenem </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Coagulase-negative Staphylococcus (CoNS) 52% (25/48) 52% (25/48) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> Enterococcus faecalis 100% (38/38) <span style="color: #BB0000;">NA</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Escherichia coli 100% (422/422) 100% (418/418)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> Klebsiella pneumoniae 100% (51/51) 100% (53/53) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> Proteus mirabilis 94% (30/32) <span style="color: #BB0000;">NA</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</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></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (non-WISCA): 2 × 4</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Pathogen Piperacillin/tazobac…¹ Piperacillin/tazobac…² Piperacillin/tazobac…³</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Gram-neg… 88% (565/641) 99% (681/691) 98% (679/693) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> Gram-pos… 86% (296/345) 98% (1018/1044) 95% (524/550) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># abbreviated names: ¹​`Piperacillin/tazobactam`,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># ²​`Piperacillin/tazobactam + Gentamicin`,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># ³​`Piperacillin/tazobactam + Tobramycin`</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># names of antibiotics do not need to resemble columns exactly:</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">"Cipro"</span>, <span class="st">"cipro + genta"</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">" &amp; "</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (non-WISCA): 2 × 3</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Pathogen Ciprofloxacin `Ciprofloxacin &amp; Gentamicin`</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Gram-negative 91% (621/684) 99% (684/694) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> Gram-positive 77% (560/724) 93% (784/847) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</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="antimicrobial_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="antimicrobial_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></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (non-WISCA): 14 × 8</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> `Syndromic Group` Pathogen Amikacin Gentamicin Imipenem Kanamycin Meropenem</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> Clinical CoNS <span style="color: #BB0000;">NA</span> 89% (183/… 57% (20… <span style="color: #BB0000;">NA</span> 57% (20/…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> ICU CoNS <span style="color: #BB0000;">NA</span> 79% (58/7… <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">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> Outpatient CoNS <span style="color: #BB0000;">NA</span> 84% (26/3… <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">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> Clinical E. coli 100% (1… 98% (291/… 100% (2… <span style="color: #BB0000;">NA</span> 100% (27…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> ICU E. coli 100% (5… 99% (135/… 100% (1… <span style="color: #BB0000;">NA</span> 100% (11…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> Clinical K. pneumo… <span style="color: #BB0000;">NA</span> 92% (47/5… 100% (4… <span style="color: #BB0000;">NA</span> 100% (46…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> Clinical P. mirabi… <span style="color: #BB0000;">NA</span> 100% (30/… <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">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> Clinical S. aureus <span style="color: #BB0000;">NA</span> 99% (148/… <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">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> ICU S. aureus <span style="color: #BB0000;">NA</span> 100% (66/… <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">#&gt;</span> <span style="color: #BCBCBC;">10</span> Clinical S. epider… <span style="color: #BB0000;">NA</span> 82% (65/7… <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">#&gt;</span> <span style="color: #BCBCBC;">11</span> ICU S. epider… <span style="color: #BB0000;">NA</span> 72% (54/7… <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">#&gt;</span> <span style="color: #BCBCBC;">12</span> Clinical S. hominis <span style="color: #BB0000;">NA</span> 96% (43/4… <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">#&gt;</span> <span style="color: #BCBCBC;">13</span> Clinical S. pneumo… 0% (0/7… 0% (0/78) <span style="color: #BB0000;">NA</span> 0% (0/78) <span style="color: #BB0000;">NA</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">14</span> ICU S. pneumo… 0% (0/3… 0% (0/30) <span style="color: #BB0000;">NA</span> 0% (0/30) <span style="color: #BB0000;">NA</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 1 more variable: Tobramycin &lt;chr&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</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">&lt;-</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">#&gt;</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="antimicrobial_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></span>
<span class="r-in"><span> <span class="op">)</span>,</span></span>
<span class="r-in"><span> language <span class="op">=</span> <span class="st">"es"</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (non-WISCA): 2 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> `Grupo sindrómico` Patógeno Amikacina Gentamicina Tobramicina </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> No UCI E. coli 100% (119/119) 98% (316/323) 98% (318/325)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> UCI E. coli 100% (52/52) 99% (135/137) 96% (132/137)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># WISCA antibiogram ----------------------------------------------------</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># can be used for any of the above types - just add `wisca = TRUE`</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></span>
<span class="r-in"><span> wisca <span class="op">=</span> <span class="cn">TRUE</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># An Antibiogram (WISCA / 95% CI): 2 × 4</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Pathogen Piperacillin/tazobac…¹ Piperacillin/tazobac…² Piperacillin/tazobac…³</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">*</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Gram-neg… 88% (85-90%,N=641) 98% (97-99%,N=691) 98% (97-99%,N=693) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> Gram-pos… 86% (82-89%,N=345) 97% (96-98%,N=1044) 95% (93-97%,N=550) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># abbreviated names: ¹​`Piperacillin/tazobactam`,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># ²​`Piperacillin/tazobactam + Gentamicin`,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># ³​`Piperacillin/tazobactam + Tobramycin`</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Print the output for R Markdown / Quarto -----------------------------</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">ureido</span> <span class="op">&lt;-</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="antimicrobial_class_selectors.html">ureidopenicillins</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> wisca <span class="op">=</span> <span class="cn">TRUE</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For ureidopenicillins() using column 'TZP' (piperacillin/tazobactam)</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># in an Rmd file, you would just need to return `ureido` in a chunk,</span></span></span>
<span class="r-in"><span><span class="co"># but to be explicit here:</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">"knitr"</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/cat.html" class="external-link">cat</a></span><span class="op">(</span><span class="fu">knitr</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/knitr/man/knit_print.html" class="external-link">knit_print</a></span><span class="op">(</span><span class="va">ureido</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |Pathogen |Piperacillin/tazobactam |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |:---------------|:-----------------------|</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*B. fragilis* |5% (0-17%,N=20) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |CoNS |32% (17-47%,N=33) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*E. cloacae* |73% (51-88%,N=20) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*E. coli* |94% (92-96%,N=416) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*E. faecalis* |95% (82-100%,N=18) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*E. faecium* |10% (1-26%,N=18) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |GBS |95% (84-100%,N=18) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*K. pneumoniae* |87% (78-95%,N=53) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*P. aeruginosa* |97% (88-100%,N=27) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*P. mirabilis* |97% (88-100%,N=27) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*S. anginosus* |94% (80-100%,N=16) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*S. marcescens* |50% (32-69%,N=22) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*S. pneumoniae* |99% (97-100%,N=112) |</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> |*S. pyogenes* |95% (81-100%,N=16) |</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">&lt;-</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> wisca <span class="op">=</span> <span class="cn">TRUE</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ab2</span> <span class="op">&lt;-</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></span>
<span class="r-in"><span><span class="op">)</span></span></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-1.png" alt="" width="700" height="433"></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-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">ab1</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 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-4.png" alt="" width="700" height="433"></span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside></div>
<footer><div class="pkgdown-footer-left">
<p><code>AMR</code> (for R). Free and open-source, licenced under the <a target="_blank" href="https://github.com/msberends/AMR/blob/main/LICENSE" class="external-link">GNU General Public License version 2.0 (GPL-2)</a>.<br>Developed at the <a target="_blank" href="https://www.rug.nl" class="external-link">University of Groningen</a> and <a target="_blank" href="https://www.umcg.nl" class="external-link">University Medical Center Groningen</a> in The Netherlands.</p>
</div>
<div class="pkgdown-footer-right">
<p><a target="_blank" href="https://www.rug.nl" class="external-link"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/logo_rug.svg" style="max-width: 150px;"></a><a target="_blank" href="https://www.umcg.nl" class="external-link"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/logo_umcg.svg" style="max-width: 150px;"></a></p>
</div>
</footer></div>
</body></html>