<!-- Generated by pkgdown: do not edit by hand --><htmllang="en"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><metacharset="utf-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"><metaname="description"content="Generateanantibiogram,andcommunicatetheresultsinplotsortables.ThesefunctionsfollowthelogicofKlinkeretal.(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 --><linkrel="icon"type="image/png"sizes="16x16"href="../favicon-16x16.png"><linkrel="icon"type="image/png"sizes="32x32"href="../favicon-32x32.png"><linkrel="apple-touch-icon"type="image/png"sizes="180x180"href="../apple-touch-icon.png"><linkrel="apple-touch-icon"type="image/png"sizes="120x120"href="../apple-touch-icon-120x120.png"><linkrel="apple-touch-icon"type="image/png"sizes="76x76"href="../apple-touch-icon-76x76.png"><linkrel="apple-touch-icon"type="image/png"sizes="60x60"href="../apple-touch-icon-60x60.png"><scriptsrc="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"><linkhref="../deps/bootstrap-5.2.2/bootstrap.min.css"rel="stylesheet"><scriptsrc="../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script><linkhref="../deps/Fira_Code-0.4.5/font.css"rel="stylesheet"><!-- Font Awesome icons --><linkrel="stylesheet"href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css"integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk="crossorigin="anonymous"><linkrel="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 --><scriptsrc="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 --><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js"integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0="crossorigin="anonymous"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js"integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4="crossorigin="anonymous"></script><!-- clipboard.js --><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js"integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI="crossorigin="anonymous"></script><!-- search --><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js"integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A=="crossorigin="anonymous"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js"integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg=="crossorigin="anonymous"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js"integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww=="crossorigin="anonymous"></script><!-- pkgdown --><scriptsrc="../pkgdown.js"></script><linkhref="../extra.css"rel="stylesheet"><scriptsrc="../extra.js"></script><metaproperty="og:title"content="Generate Antibiogram: Traditional, Combined, Syndromic, or Weighted-Incidence Syndromic Combination (WISCA) — antibiogram"><metaproperty="og:description"content="Generateanantibiogram,andcommunicatetheresultsinplotsortables.ThesefunctionsfollowthelogicofKlinkeretal.(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."><metaproperty="og:image"content="https://msberends.github.io/AMR/logo.svg"><metaname="twitter:card"content="summary_large_image"><metaname="twitter:creator"content="@msberends"><metaname="twitter:site"content="@msberends"><!-- mathjax --><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k="crossorigin="anonymous"></script><scriptsrc="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]>
<p>Generate an antibiogram, and communicate the results in plots or tables. These functions follow the logic of Klinker <em>et al.</em> (2021, <ahref="https://doi.org/10.1177/20499361211011373"class="external-link">doi:10.1177/20499361211011373</a>
) and Barbieri <em>et al.</em> (2021, <ahref="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>
<span> language <spanclass="op">=</span><spanclass="fu"><ahref="translate.html">get_AMR_locale</a></span><spanclass="op">(</span><spanclass="op">)</span>,</span>
<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; <ahref="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; <ahref="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>. <ahref="https://clsi.org/standards/products/microbiology/documents/m39/"class="external-link">https://clsi.org/standards/products/microbiology/documents/m39/</a>.</p></li>
<dd><p>a <ahref="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><ahref="as.sir.html">as.sir()</a></code>)</p></dd>
<dt>antibiotics</dt>
<dd><p>vector of column names, or (any combinations of) <ahref="antibiotic_class_selectors.html">antibiotic selectors</a> such as <code><ahref="antibiotic_class_selectors.html">aminoglycosides()</a></code> or <code><ahref="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 <ahref="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 <ahref="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><ahref="https://rdrr.io/r/base/ifelse.html"class="external-link">ifelse()</a></code> or <code><ahref="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 <ahref="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 <ahref="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><ahref="as.mo.html">as.mo()</a></code>), defaults to the first column of class <code><ahref="as.mo.html">mo</a></code>. Values will be coerced using <code><ahref="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><ahref="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 <ahref="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>
<dd><p>a <ahref="https://rdrr.io/r/base/logical.html"class="external-link">logical</a> to indicate whether the printing should be done using <code><ahref="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>
<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><ahref="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, <ahref="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>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>
</ol><p>All types of antibiograms can be generated with the functions as described on this page, and can be plotted (using <code><ahref="https://ggplot2.tidyverse.org/reference/autoplot.html"class="external-link">ggplot2::autoplot()</a></code> or base <spanstyle="R">R</span><code><ahref="plot.html">plot()</a></code>/<code><ahref="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>
<spanid="cb1-7"><ahref="#cb1-7"aria-hidden="true"tabindex="-1"></a> S or I S or I X X X X</span>
<spanid="cb1-8"><ahref="#cb1-8"aria-hidden="true"tabindex="-1"></a> R S or I X X X X</span>
<spanid="cb1-9"><ahref="#cb1-9"aria-hidden="true"tabindex="-1"></a><spanclass="sc"><</span><spanclass="cn">NA</span><spanclass="sc">></span> S or I X X <spanclass="sc">-</span><spanclass="sc">-</span></span>
<spanid="cb1-10"><ahref="#cb1-10"aria-hidden="true"tabindex="-1"></a> S or I R X X X X</span>
<spanid="cb1-11"><ahref="#cb1-11"aria-hidden="true"tabindex="-1"></a> R R <spanclass="sc">-</span> X <spanclass="sc">-</span> X</span>
<spanid="cb1-12"><ahref="#cb1-12"aria-hidden="true"tabindex="-1"></a><spanclass="sc"><</span><spanclass="cn">NA</span><spanclass="sc">></span> R <spanclass="sc">-</span><spanclass="sc">-</span><spanclass="sc">-</span><spanclass="sc">-</span></span>
<spanid="cb1-13"><ahref="#cb1-13"aria-hidden="true"tabindex="-1"></a> S or I <spanclass="sc"><</span><spanclass="cn">NA</span><spanclass="sc">></span> X X <spanclass="sc">-</span><spanclass="sc">-</span></span>
<spanid="cb1-14"><ahref="#cb1-14"aria-hidden="true"tabindex="-1"></a> R <spanclass="sc"><</span><spanclass="cn">NA</span><spanclass="sc">></span><spanclass="sc">-</span><spanclass="sc">-</span><spanclass="sc">-</span><spanclass="sc">-</span></span>
<p>Printing the antibiogram in non-interactive sessions will be done by <code><ahref="https://rdrr.io/pkg/knitr/man/kable.html"class="external-link">knitr::kable()</a></code>, with support for <ahref="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>
<divclass="sourceCode"><preclass="sourceCode r"><code><spanclass="r-in"><span><spanclass="co"># example_isolates is a data set available in the AMR package.</span></span></span>
<spanclass="r-in"><span><spanclass="co"># run ?example_isolates for more info.</span></span></span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 1</span> 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 2</span> 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 3</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 4</span> 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 5</span> 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 6</span> 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 7</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 8</span> 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;"> 9</span> 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #BCBCBC;">10</span> 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA </span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #949494;"># … with 1,990 more rows, and 36 more variables: AMC <sir>, AMP <sir>,</span></span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #949494;"># … with abbreviated variable name ¹`Piperacillin/tazobactam & Tobramycin`</span></span>
<spanclass="r-in"><span> minimum <spanclass="op">=</span><spanclass="fl">10</span>, <spanclass="co"># this should be >= 30, but now just as example</span></span></span>
<spanclass="r-in"><span><spanclass="st">"WISCA Group 1"</span>, <spanclass="st">"WISCA Group 2"</span><spanclass="op">)</span><spanclass="op">)</span></span></span>
<spanclass="r-msg co"><spanclass="r-pr">#></span>ℹ 8 combinations had less than minimum = 10 results and were ignored</span>
<spanclass="r-out co"><spanclass="r-pr">#></span><spanstyle="color: #949494;"># A tibble: 4 × 6</span></span>
</main><asideclass="col-md-3"><navid="toc"><h2>On this page</h2>
</nav></aside></div>
<footer><divclass="pkgdown-footer-left">
<p></p><p><code>AMR</code> (for R). Free and open-source, licenced under the <atarget="_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 <atarget="_blank"href="https://www.rug.nl"class="external-link">University of Groningen</a> and <atarget="_blank"href="https://www.umcg.nl"class="external-link">University Medical Center Groningen</a> in The Netherlands.</p>