1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 19:26:13 +01:00
AMR/reference/as.sir.html
2024-12-20 10:03:24 +00:00

915 lines
131 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>Translate MIC and Disk Diffusion to SIR, or Clean Existing SIR Data — as.sir • 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="Translate MIC and Disk Diffusion to SIR, or Clean Existing SIR Data — as.sir"><meta name="description" content="Clean up existing SIR values, or interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI. as.sir() transforms the input to a new class sir, which is an ordered factor containing the levels S, SDD, I, R, NI.
These breakpoints are currently implemented:
For clinical microbiology: EUCAST 2011-2024 and CLSI 2011-2024;
For veterinary microbiology: EUCAST 2021-2024 and CLSI 2019-2024;
For ECOFFs (Epidemiological Cut-off Values): EUCAST 2020-2024 and CLSI 2022-2024.
All breakpoints used for interpretation are available in our clinical_breakpoints data set."><meta property="og:description" content="Clean up existing SIR values, or interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI. as.sir() transforms the input to a new class sir, which is an ordered factor containing the levels S, SDD, I, R, NI.
These breakpoints are currently implemented:
For clinical microbiology: EUCAST 2011-2024 and CLSI 2011-2024;
For veterinary microbiology: EUCAST 2021-2024 and CLSI 2019-2024;
For ECOFFs (Epidemiological Cut-off Values): EUCAST 2020-2024 and CLSI 2022-2024.
All breakpoints used for interpretation are available in our clinical_breakpoints data set."><meta property="og:image" content="https://msberends.github.io/AMR/logo.svg"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-primary" data-bs-theme="dark" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">AMR (for R)</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9122</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto"><li class="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="active 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>Translate MIC and Disk Diffusion to SIR, or Clean Existing SIR Data</h1>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/R/sir.R" class="external-link"><code>R/sir.R</code></a></small>
<div class="d-none name"><code>as.sir.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Clean up existing SIR values, or interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI. <code>as.sir()</code> transforms the input to a new class <code>sir</code>, which is an ordered <a href="https://rdrr.io/r/base/factor.html" class="external-link">factor</a> containing the levels <code>S</code>, <code>SDD</code>, <code>I</code>, <code>R</code>, <code>NI</code>.</p>
<p>These breakpoints are currently implemented:</p><ul><li><p>For <strong>clinical microbiology</strong>: EUCAST 2011-2024 and CLSI 2011-2024;</p></li>
<li><p>For <strong>veterinary microbiology</strong>: EUCAST 2021-2024 and CLSI 2019-2024;</p></li>
<li><p>For <strong>ECOFFs</strong> (Epidemiological Cut-off Values): EUCAST 2020-2024 and CLSI 2022-2024.</p></li>
</ul><p>All breakpoints used for interpretation are available in our <a href="clinical_breakpoints.html">clinical_breakpoints</a> data set.</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">as.sir</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="va">NA_sir_</span></span>
<span></span>
<span><span class="fu">is.sir</span><span class="op">(</span><span class="va">x</span><span class="op">)</span></span>
<span></span>
<span><span class="fu">is_sir_eligible</span><span class="op">(</span><span class="va">x</span>, threshold <span class="op">=</span> <span class="fl">0.05</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># Default S3 method</span></span>
<span><span class="fu">as.sir</span><span class="op">(</span></span>
<span> <span class="va">x</span>,</span>
<span> S <span class="op">=</span> <span class="st">"^(S|U)+$"</span>,</span>
<span> I <span class="op">=</span> <span class="st">"^(I)+$"</span>,</span>
<span> R <span class="op">=</span> <span class="st">"^(R)+$"</span>,</span>
<span> NI <span class="op">=</span> <span class="st">"^(N|NI|V)+$"</span>,</span>
<span> SDD <span class="op">=</span> <span class="st">"^(SDD|D|H)+$"</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'mic'</span></span>
<span><span class="fu">as.sir</span><span class="op">(</span></span>
<span> <span class="va">x</span>,</span>
<span> mo <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> ab <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/deparse.html" class="external-link">deparse</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/substitute.html" class="external-link">substitute</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span>,</span>
<span> guideline <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_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span>,</span>
<span> uti <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> conserve_capped_values <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> add_intrinsic_resistance <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> reference_data <span class="op">=</span> <span class="fu">AMR</span><span class="fu">::</span><span class="va"><a href="clinical_breakpoints.html">clinical_breakpoints</a></span>,</span>
<span> include_screening <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_include_screening"</span>, <span class="cn">FALSE</span><span class="op">)</span>,</span>
<span> include_PKPD <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_include_PKPD"</span>, <span class="cn">TRUE</span><span class="op">)</span>,</span>
<span> breakpoint_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_breakpoint_type"</span>, <span class="st">"human"</span><span class="op">)</span>,</span>
<span> host <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> verbose <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'disk'</span></span>
<span><span class="fu">as.sir</span><span class="op">(</span></span>
<span> <span class="va">x</span>,</span>
<span> mo <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> ab <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/deparse.html" class="external-link">deparse</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/substitute.html" class="external-link">substitute</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span>,</span>
<span> guideline <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_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span>,</span>
<span> uti <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> add_intrinsic_resistance <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> reference_data <span class="op">=</span> <span class="fu">AMR</span><span class="fu">::</span><span class="va"><a href="clinical_breakpoints.html">clinical_breakpoints</a></span>,</span>
<span> include_screening <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_include_screening"</span>, <span class="cn">FALSE</span><span class="op">)</span>,</span>
<span> include_PKPD <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_include_PKPD"</span>, <span class="cn">TRUE</span><span class="op">)</span>,</span>
<span> breakpoint_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_breakpoint_type"</span>, <span class="st">"human"</span><span class="op">)</span>,</span>
<span> host <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> verbose <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for class 'data.frame'</span></span>
<span><span class="fu">as.sir</span><span class="op">(</span></span>
<span> <span class="va">x</span>,</span>
<span> <span class="va">...</span>,</span>
<span> col_mo <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> guideline <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_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span>,</span>
<span> uti <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> conserve_capped_values <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> add_intrinsic_resistance <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> reference_data <span class="op">=</span> <span class="fu">AMR</span><span class="fu">::</span><span class="va"><a href="clinical_breakpoints.html">clinical_breakpoints</a></span>,</span>
<span> include_screening <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_include_screening"</span>, <span class="cn">FALSE</span><span class="op">)</span>,</span>
<span> include_PKPD <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_include_PKPD"</span>, <span class="cn">TRUE</span><span class="op">)</span>,</span>
<span> breakpoint_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_breakpoint_type"</span>, <span class="st">"human"</span><span class="op">)</span>,</span>
<span> host <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> verbose <span class="op">=</span> <span class="cn">FALSE</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="fu">sir_interpretation_history</span><span class="op">(</span>clean <span class="op">=</span> <span class="cn">FALSE</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>
<p>For interpretations of minimum inhibitory concentration (MIC) values and disk diffusion diameters:</p><ul><li><p><strong>CLSI M39: Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data</strong>, 2011-2024, <em>Clinical and Laboratory Standards Institute</em> (CLSI). <a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="external-link">https://clsi.org/standards/products/microbiology/documents/m39/</a>.</p></li>
<li><p><strong>CLSI M100: Performance Standard for Antimicrobial Susceptibility Testing</strong>, 2011-2024, <em>Clinical and Laboratory Standards Institute</em> (CLSI). <a href="https://clsi.org/standards/products/microbiology/documents/m100/" class="external-link">https://clsi.org/standards/products/microbiology/documents/m100/</a>.</p></li>
<li><p><strong>CLSI VET01: Performance Standards for Antimicrobial Disk and Dilution Susceptibility Tests for Bacteria Isolated From Animals</strong>, 2019-2024, <em>Clinical and Laboratory Standards Institute</em> (CLSI). <a href="https://clsi.org/standards/products/veterinary-medicine/documents/vet01/" class="external-link">https://clsi.org/standards/products/veterinary-medicine/documents/vet01/</a>.</p></li>
<li><p><strong>CLSI VET09: Understanding Susceptibility Test Data as a Component of Antimicrobial Stewardship in Veterinary Settings</strong>, 2019-2024, <em>Clinical and Laboratory Standards Institute</em> (CLSI). <a href="https://clsi.org/standards/products/veterinary-medicine/documents/vet09/" class="external-link">https://clsi.org/standards/products/veterinary-medicine/documents/vet09/</a>.</p></li>
<li><p><strong>EUCAST Breakpoint tables for interpretation of MICs and zone diameters</strong>, 2011-2024, <em>European Committee on Antimicrobial Susceptibility Testing</em> (EUCAST). <a href="https://www.eucast.org/clinical_breakpoints" class="external-link">https://www.eucast.org/clinical_breakpoints</a>.</p></li>
<li><p><strong>WHONET</strong> as a source for machine-reading the clinical breakpoints (<a href="https://msberends.github.io/AMR/reference/clinical_breakpoints.html#imported-from-whonet">read more here</a>), 1989-2024, <em>WHO Collaborating Centre for Surveillance of Antimicrobial Resistance</em>. <a href="https://whonet.org/" class="external-link">https://whonet.org/</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>vector of values (for class <code><a href="as.mic.html">mic</a></code>: MIC values in mg/L, for class <code><a href="as.disk.html">disk</a></code>: a disk diffusion radius in millimetres)</p></dd>
<dt id="arg--">...<a class="anchor" aria-label="anchor" href="#arg--"></a></dt>
<dd><p>for using on a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>: names of columns to apply <code>as.sir()</code> on (supports tidy selection such as <code>column1:column4</code>). Otherwise: arguments passed on to methods.</p></dd>
<dt id="arg-threshold">threshold<a class="anchor" aria-label="anchor" href="#arg-threshold"></a></dt>
<dd><p>maximum fraction of invalid antimicrobial interpretations of <code>x</code>, see <em>Examples</em></p></dd>
<dt id="arg-s-i-r-ni-sdd">S, I, R, NI, SDD<a class="anchor" aria-label="anchor" href="#arg-s-i-r-ni-sdd"></a></dt>
<dd><p>a case-independent <a href="https://rdrr.io/r/base/regex.html" class="external-link">regular expression</a> to translate input to this result. This regular expression will be run <em>after</em> all non-letters and whitespaces are removed from the input.</p></dd>
<dt id="arg-mo">mo<a class="anchor" aria-label="anchor" href="#arg-mo"></a></dt>
<dd><p>a vector (or column name) with <a href="https://rdrr.io/r/base/character.html" class="external-link">character</a>s that can be coerced to valid microorganism codes with <code><a href="as.mo.html">as.mo()</a></code>, can be left empty to determine it automatically</p></dd>
<dt id="arg-ab">ab<a class="anchor" aria-label="anchor" href="#arg-ab"></a></dt>
<dd><p>a vector (or column name) with <a href="https://rdrr.io/r/base/character.html" class="external-link">character</a>s that can be coerced to a valid antimicrobial drug code with <code><a href="as.ab.html">as.ab()</a></code></p></dd>
<dt id="arg-guideline">guideline<a class="anchor" aria-label="anchor" href="#arg-guideline"></a></dt>
<dd><p>defaults to EUCAST 2024 (the latest implemented EUCAST guideline in the <a href="clinical_breakpoints.html">clinical_breakpoints</a> data set), but can be set with the package option <code><a href="AMR-options.html">AMR_guideline</a></code>. Currently supports EUCAST (2011-2024) and CLSI (2011-2024), see <em>Details</em>.</p></dd>
<dt id="arg-uti">uti<a class="anchor" aria-label="anchor" href="#arg-uti"></a></dt>
<dd><p>(Urinary Tract Infection) a vector (or column name) with <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a>s (<code>TRUE</code> or <code>FALSE</code>) to specify whether a UTI specific interpretation from the guideline should be chosen. For using <code>as.sir()</code> on a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>, this can also be a column containing <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a>s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See <em>Examples</em>.</p></dd>
<dt id="arg-conserve-capped-values">conserve_capped_values<a class="anchor" aria-label="anchor" href="#arg-conserve-capped-values"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate that MIC values starting with <code>"&gt;"</code> (but not <code>"&gt;="</code>) must always return "R" , and that MIC values starting with <code>"&lt;"</code> (but not <code>"&lt;="</code>) must always return "S"</p></dd>
<dt id="arg-add-intrinsic-resistance">add_intrinsic_resistance<a class="anchor" aria-label="anchor" href="#arg-add-intrinsic-resistance"></a></dt>
<dd><p><em>(only useful when using a EUCAST guideline)</em> a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in <em>Klebsiella</em> species. Determination is based on the <a href="intrinsic_resistant.html">intrinsic_resistant</a> data set, that itself is based on <a href="https://www.eucast.org/expert_rules_and_expected_phenotypes" class="external-link">'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3</a> (2021).</p></dd>
<dt id="arg-reference-data">reference_data<a class="anchor" aria-label="anchor" href="#arg-reference-data"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a> to be used for interpretation, which defaults to the <a href="clinical_breakpoints.html">clinical_breakpoints</a> data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the <a href="clinical_breakpoints.html">clinical_breakpoints</a> data set (same column names and column types). Please note that the <code>guideline</code> argument will be ignored when <code>reference_data</code> is manually set.</p></dd>
<dt id="arg-include-screening">include_screening<a class="anchor" aria-label="anchor" href="#arg-include-screening"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate that clinical breakpoints for screening are allowed - the default is <code>FALSE</code>. Can also be set with the package option <code><a href="AMR-options.html">AMR_include_screening</a></code>.</p></dd>
<dt id="arg-include-pkpd">include_PKPD<a class="anchor" aria-label="anchor" href="#arg-include-pkpd"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is <code>TRUE</code>. Can also be set with the package option <code><a href="AMR-options.html">AMR_include_PKPD</a></code>.</p></dd>
<dt id="arg-breakpoint-type">breakpoint_type<a class="anchor" aria-label="anchor" href="#arg-breakpoint-type"></a></dt>
<dd><p>the type of breakpoints to use, either "ECOFF", "animal", or "human". ECOFF stands for Epidemiological Cut-Off values. The default is <code>"human"</code>, which can also be set with the package option <code><a href="AMR-options.html">AMR_breakpoint_type</a></code>. If <code>host</code> is set to values of veterinary species, this will automatically be set to <code>"animal"</code>.</p></dd>
<dt id="arg-host">host<a class="anchor" aria-label="anchor" href="#arg-host"></a></dt>
<dd><p>a vector (or column name) with <a href="https://rdrr.io/r/base/character.html" class="external-link">character</a>s to indicate the host. Only useful for veterinary breakpoints, as it requires <code>breakpoint_type = "animal"</code>. The values can be any text resembling the animal species, even in any of the 20 supported languages of this package. For foreign languages, be sure to set the language with <code><a href="translate.html">set_AMR_locale()</a></code> (though it will be automatically guessed based on the system language).</p></dd>
<dt id="arg-verbose">verbose<a class="anchor" aria-label="anchor" href="#arg-verbose"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate that all notes should be printed during interpretation of MIC values or disk diffusion values.</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-clean">clean<a class="anchor" aria-label="anchor" href="#arg-clean"></a></dt>
<dd><p>a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether previously stored results should be forgotten after returning the 'logbook' with results</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>Ordered <a href="https://rdrr.io/r/base/factor.html" class="external-link">factor</a> with new class <code>sir</code></p>
</div>
<div class="section level2">
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
<p><em>Note: The clinical breakpoints in this package were validated through, and imported from, <a href="https://whonet.org" class="external-link">WHONET</a>. The public use of this <code>AMR</code> package has been endorsed by both CLSI and EUCAST. See <a href="clinical_breakpoints.html">clinical_breakpoints</a> for more information.</em></p><div class="section">
<h3 id="how-it-works">How it Works<a class="anchor" aria-label="anchor" href="#how-it-works"></a></h3>
<p>The <code>as.sir()</code> function can work in four ways:</p><ol><li><p>For <strong>cleaning raw / untransformed data</strong>. The data will be cleaned to only contain valid values, namely: <strong>S</strong> for susceptible, <strong>I</strong> for intermediate or 'susceptible, increased exposure', <strong>R</strong> for resistant, <strong>NI</strong> for non-interpretable, and <strong>SDD</strong> for susceptible dose-dependent. Each of these can be set using a <a href="https://rdrr.io/r/base/regex.html" class="external-link">regular expression</a>. Furthermore, <code>as.sir()</code> will try its best to clean with some intelligence. For example, mixed values with SIR interpretations and MIC values such as <code>"&lt;0.25; S"</code> will be coerced to <code>"S"</code>. Combined interpretations for multiple test methods (as seen in laboratory records) such as <code>"S; S"</code> will be coerced to <code>"S"</code>, but a value like <code>"S; I"</code> will return <code>NA</code> with a warning that the input is invalid.</p></li>
<li><p>For <strong>interpreting minimum inhibitory concentration (MIC) values</strong> according to EUCAST or CLSI. You must clean your MIC values first using <code><a href="as.mic.html">as.mic()</a></code>, that also gives your columns the new data class <code><a href="as.mic.html">mic</a></code>. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the <code>mo</code> argument.</p><ul><li><p>Using <code>dplyr</code>, SIR interpretation can be done very easily with either:</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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.sir</span><span class="op">)</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><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.mic</span><span class="op">)</span>, <span class="va">as.sir</span><span class="op">)</span><span class="op">)</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.sir</span>, ab <span class="op">=</span> <span class="st">"column_with_antibiotics"</span>, mo <span class="op">=</span> <span class="st">"column_with_microorganisms"</span><span class="op">)</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.sir</span>, ab <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">"ampicillin"</span>, <span class="va">...</span><span class="op">)</span>, mo <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">"E. coli"</span>, <span class="st">"K. pneumoniae"</span>, <span class="va">...</span><span class="op">)</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># for veterinary breakpoints, also set `host`:</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.sir</span>, host <span class="op">=</span> <span class="st">"column_with_animal_species"</span>, guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span></span></code></pre><p></p></div></li>
<li><p>Operators like "&lt;=" will be stripped before interpretation. When using <code>conserve_capped_values = TRUE</code>, an MIC value of e.g. "&gt;2" will always return "R", even if the breakpoint according to the chosen guideline is "&gt;=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (<code>conserve_capped_values = FALSE</code>) considers "&gt;2" to be lower than "&gt;=4" and might in this case return "S" or "I".</p></li>
</ul></li>
<li><p>For <strong>interpreting disk diffusion diameters</strong> according to EUCAST or CLSI. You must clean your disk zones first using <code><a href="as.disk.html">as.disk()</a></code>, that also gives your columns the new data class <code><a href="as.disk.html">disk</a></code>. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the <code>mo</code> argument.</p><ul><li><p>Using <code>dplyr</code>, SIR interpretation can be done very easily with either:</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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.disk</span>, <span class="va">as.sir</span><span class="op">)</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><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.disk</span><span class="op">)</span>, <span class="va">as.sir</span><span class="op">)</span><span class="op">)</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.disk</span>, <span class="va">as.sir</span>, ab <span class="op">=</span> <span class="st">"column_with_antibiotics"</span>, mo <span class="op">=</span> <span class="st">"column_with_microorganisms"</span><span class="op">)</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.disk</span>, <span class="va">as.sir</span>, ab <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">"ampicillin"</span>, <span class="va">...</span><span class="op">)</span>, mo <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">"E. coli"</span>, <span class="st">"K. pneumoniae"</span>, <span class="va">...</span><span class="op">)</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># for veterinary breakpoints, also set `host`:</span></span>
<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 class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.disk</span>, <span class="va">as.sir</span>, host <span class="op">=</span> <span class="st">"column_with_animal_species"</span>, guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span></span></code></pre><p></p></div></li>
</ul></li>
<li><p>For <strong>interpreting a complete data set</strong>, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running <code>as.sir(your_data)</code>.</p></li>
</ol><p><strong>For points 2, 3 and 4: Use <code>sir_interpretation_history()</code></strong> to retrieve a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a> (or <a href="https://tibble.tidyverse.org/reference/tibble.html" class="external-link">tibble</a> if the <code>tibble</code> package is installed) with all results of the last <code>as.sir()</code> call.</p>
</div>
<div class="section">
<h3 id="supported-guidelines">Supported Guidelines<a class="anchor" aria-label="anchor" href="#supported-guidelines"></a></h3>
<p>For interpreting MIC values as well as disk diffusion diameters, currently implemented guidelines are for <strong>clinical microbiology</strong>: EUCAST 2011-2024 and CLSI 2011-2024, and for <strong>veterinary microbiology</strong>: EUCAST 2021-2024 and CLSI 2019-2024.</p>
<p>Thus, the <code>guideline</code> argument must be set to e.g., <code>"EUCAST 2024"</code> or <code>"CLSI 2024"</code>. By simply using <code>"EUCAST"</code> (the default) or <code>"CLSI"</code> as input, the latest included version of that guideline will automatically be selected. You can set your own data set using the <code>reference_data</code> argument. The <code>guideline</code> argument will then be ignored.</p>
<p>You can set the default guideline with the package option <code><a href="AMR-options.html">AMR_guideline</a></code> (e.g. in your <code>.Rprofile</code> file), such as:</p>
<p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a> <span class="fu">options</span>(<span class="at">AMR_guideline =</span> <span class="st">"CLSI"</span>)</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a> <span class="fu">options</span>(<span class="at">AMR_guideline =</span> <span class="st">"CLSI 2018"</span>)</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a> <span class="fu">options</span>(<span class="at">AMR_guideline =</span> <span class="st">"EUCAST 2020"</span>)</span>
<span id="cb1-4"><a href="#cb1-4" tabindex="-1"></a> <span class="co"># or to reset:</span></span>
<span id="cb1-5"><a href="#cb1-5" tabindex="-1"></a> <span class="fu">options</span>(<span class="at">AMR_guideline =</span> <span class="cn">NULL</span>)</span></code></pre><p></p></div>
<p>For veterinary guidelines, these might be the best options:</p>
<p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a> <span class="fu">options</span>(<span class="at">AMR_guideline =</span> <span class="st">"CLSI"</span>)</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a> <span class="fu">options</span>(<span class="at">AMR_breakpoint_type =</span> <span class="st">"animal"</span>)</span></code></pre><p></p></div>
<p>When applying veterinary breakpoints (by setting <code>host</code> or by setting <code>breakpoint_type = "animal"</code>), the <a href="https://clsi.org/standards/products/veterinary-medicine/documents/vet09/" class="external-link">CLSI VET09 guideline</a> will be applied to cope with missing animal species-specific breakpoints.</p>
</div>
<div class="section">
<h3 id="after-interpretation">After Interpretation<a class="anchor" aria-label="anchor" href="#after-interpretation"></a></h3>
<p>After using <code>as.sir()</code>, you can use the <code><a href="eucast_rules.html">eucast_rules()</a></code> defined by EUCAST to (1) apply inferred susceptibility and resistance based on results of other antimicrobials and (2) apply intrinsic resistance based on taxonomic properties of a microorganism.</p>
<p>To determine which isolates are multi-drug resistant, be sure to run <code><a href="mdro.html">mdro()</a></code> (which applies the MDR/PDR/XDR guideline from 2012 at default) on a data set that contains S/I/R values. Read more about <a href="mdro.html">interpreting multidrug-resistant organisms here</a>.</p>
</div>
<div class="section">
<h3 id="machine-readable-clinical-breakpoints">Machine-Readable Clinical Breakpoints<a class="anchor" aria-label="anchor" href="#machine-readable-clinical-breakpoints"></a></h3>
<p>The repository of this package <a href="https://github.com/msberends/AMR/blob/main/data-raw/clinical_breakpoints.txt" class="external-link">contains a machine-readable version</a> of all guidelines. This is a CSV file consisting of 34 063 rows and 14 columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. <strong>This allows for easy implementation of these rules in laboratory information systems (LIS)</strong>. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.</p>
</div>
<div class="section">
<h3 id="other">Other<a class="anchor" aria-label="anchor" href="#other"></a></h3>
<p>The function <code>is.sir()</code> detects if the input contains class <code>sir</code>. If the input is a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>, it iterates over all columns and returns a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> vector.</p>
<p>The base R function <code><a href="https://rdrr.io/r/base/double.html" class="external-link">as.double()</a></code> can be used to retrieve quantitative values from a <code>sir</code> object: <code>"S"</code> = 1, <code>"I"</code>/<code>"SDD"</code> = 2, <code>"R"</code> = 3. All other values are rendered <code>NA</code> . <strong>Note:</strong> Do not use <code><a href="https://rdrr.io/r/base/integer.html" class="external-link">as.integer()</a></code>, since that (because of how R works internally) will return the factor level indices, and not these aforementioned quantitative values.</p>
<p>The function <code>is_sir_eligible()</code> returns <code>TRUE</code> when a column contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R and/or NI and/or SDD), and <code>FALSE</code> otherwise. The threshold of 5% can be set with the <code>threshold</code> argument. If the input is a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>, it iterates over all columns and returns a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> vector.</p>
</div>
<p><code>NA_sir_</code> is a missing value of the new <code>sir</code> class, analogous to e.g. base <span style="R">R</span>'s <code><a href="https://rdrr.io/r/base/NA.html" class="external-link">NA_character_</a></code>.</p>
</div>
<div class="section level2">
<h2 id="interpretation-of-sir">Interpretation of SIR<a class="anchor" aria-label="anchor" href="#interpretation-of-sir"></a></h2>
<p>In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories S, I, and R as shown below (<a href="https://www.eucast.org/newsiandr" class="external-link">https://www.eucast.org/newsiandr</a>):</p><ul><li><p><strong>S - Susceptible, standard dosing regimen</strong><br>
A microorganism is categorised as "Susceptible, standard dosing regimen", when there is a high likelihood of therapeutic success using a standard dosing regimen of the agent.</p></li>
<li><p><strong>I - Susceptible, increased exposure</strong> <em><br>
A microorganism is categorised as "Susceptible, Increased exposure</em>" when there is a high likelihood of therapeutic success because exposure to the agent is increased by adjusting the dosing regimen or by its concentration at the site of infection.</p></li>
<li><p><strong>R = Resistant</strong><br>
A microorganism is categorised as "Resistant" when there is a high likelihood of therapeutic failure even when there is increased exposure.</p><ul><li><p><em>Exposure</em> is a function of how the mode of administration, dose, dosing interval, infusion time, as well as distribution and excretion of the antimicrobial agent will influence the infecting organism at the site of infection.</p></li>
</ul></li>
</ul><p>This AMR package honours this insight. Use <code><a href="proportion.html">susceptibility()</a></code> (equal to <code><a href="proportion.html">proportion_SI()</a></code>) to determine antimicrobial susceptibility and <code><a href="count.html">count_susceptible()</a></code> (equal to <code><a href="count.html">count_SI()</a></code>) to count susceptible isolates.</p>
</div>
<div class="section level2">
<h2 id="reference-data-publicly-available">Reference Data Publicly Available<a class="anchor" aria-label="anchor" href="#reference-data-publicly-available"></a></h2>
<p>All data sets in this <code>AMR</code> package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit <a href="https://msberends.github.io/AMR/articles/datasets.html">our website for the download links</a>. The actual files are of course available on <a href="https://github.com/msberends/AMR/tree/main/data-raw" class="external-link">our GitHub repository</a>.</p>
</div>
<div class="section level2">
<h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
<div class="dont-index"><p><code><a href="as.mic.html">as.mic()</a></code>, <code><a href="as.disk.html">as.disk()</a></code>, <code><a href="as.mo.html">as.mo()</a></code></p></div>
</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="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 class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">)</span> <span class="co"># see all SIR results at a glance</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> date patient age gender </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Min. :2002-01-02 Length:2000 Min. : 0.00 Length:2000 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1st Qu.:2005-07-31 Class :character 1st Qu.:63.00 Class :character </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Median :2009-07-31 Mode :character Median :74.00 Mode :character </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Mean :2009-11-20 Mean :70.69 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3rd Qu.:2014-05-30 3rd Qu.:82.00 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Max. :2017-12-28 Max. :97.00 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward mo PEN </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Length:2000 Class :mo Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class :character &lt;NA&gt; :0 %S :25.6% (n=417) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Mode :character Unique:90 %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> #1 :B_ESCHR_COLI %I : 0.7% (n=11) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> #2 :B_STPHY_CONS %R :73.7% (n=1201) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> #3 :B_STPHY_AURS %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> OXA FLC AMX </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :68.8% (n=251) %S :70.5% (n=665) %S :40.2% (n=543) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.0% (n=0) %I : 0.0% (n=0) %I : 0.2% (n=3) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :31.2% (n=114) %R :29.5% (n=278) %R :59.6% (n=804) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> AMC AMP TZP </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :71.4% (n=1342) %S :40.2% (n=543) %S :86.1% (n=862) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 4.8% (n=91) %I : 0.2% (n=3) %I : 1.3% (n=13) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :23.7% (n=446) %R :59.6% (n=804) %R :12.6% (n=126) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> CZO FEP CXM </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :54.9% (n=245) %S :85.6% (n=620) %S :72.5% (n=1297) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.4% (n=2) %I : 0.1% (n=1) %I : 1.2% (n=22) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :44.6% (n=199) %R :14.2% (n=103) %R :26.3% (n=470) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> FOX CTX CAZ </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :71.6% (n=586) %S :84.4% (n=796) %S :33.5% (n=607) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 1.0% (n=8) %I : 0.1% (n=1) %I : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :27.4% (n=224) %R :15.5% (n=146) %R :66.5% (n=1204) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> CRO GEN TOB </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :84.4% (n=796) %S :74.0% (n=1372) %S :65.1% (n=879) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.1% (n=1) %I : 1.5% (n=27) %I : 0.5% (n=7) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :15.5% (n=146) %R :24.6% (n=456) %R :34.4% (n=465) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> AMK KAN TMP </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :36.3% (n=251) %S : 0.0% (n=0) %S :61.2% (n=918) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.0% (n=0) %I : 0.0% (n=0) %I : 0.7% (n=10) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :63.7% (n=441) %R :100.0% (n=471) %R :38.1% (n=571) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> SXT NIT FOS </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :79.1% (n=1392) %S :76.0% (n=565) %S :57.8% (n=203) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.3% (n=6) %I : 6.9% (n=51) %I : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :20.5% (n=361) %R :17.1% (n=127) %R :42.2% (n=148) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> LNZ CIP MFX </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :30.7% (n=314) %S :78.9% (n=1112) %S :64.5% (n=136) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.0% (n=0) %I : 4.9% (n=69) %I : 1.9% (n=4) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :69.3% (n=709) %R :16.2% (n=228) %R :33.6% (n=71) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> VAN TEC TCY </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :61.7% (n=1149) %S :24.3% (n=237) %S :68.3% (n=820) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.0% (n=0) %I : 0.0% (n=0) %I : 1.9% (n=23) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :38.3% (n=712) %R :75.7% (n=739) %R :29.8% (n=357) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> TGC DOX ERY </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :87.3% (n=697) %S :71.7% (n=814) %S :42.3% (n=801) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.0% (n=0) %I : 0.6% (n=7) %I : 0.5% (n=9) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :12.7% (n=101) %R :27.7% (n=315) %R :57.2% (n=1084) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> CLI AZM IPM </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :38.6% (n=586) %S :42.3% (n=801) %S :92.7% (n=824) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.3% (n=4) %I : 0.5% (n=9) %I : 1.1% (n=10) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :61.2% (n=930) %R :57.2% (n=1084) %R : 6.2% (n=55) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> MEM MTR CHL </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :94.1% (n=780) %S :85.3% (n=29) %S :78.6% (n=121) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.0% (n=0) %I : 0.0% (n=0) %I : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R : 5.9% (n=49) %R :14.7% (n=5) %R :21.4% (n=33) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> COL MUP RIF </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class:sir Class:sir Class:sir </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %S :18.8% (n=309) %S :93.0% (n=251) %S :30.2% (n=303) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %I : 0.0% (n=0) %I : 1.1% (n=3) %I : 0.2% (n=2) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %R :81.2% (n=1331) %R : 5.9% (n=16) %R :69.6% (n=698) </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0) </span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># For INTERPRETING disk diffusion and MIC values -----------------------</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># example data sets, with combined MIC values and disk zones</span></span></span>
<span class="r-in"><span><span class="va">df_wide</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span></span>
<span class="r-in"><span> microorganism <span class="op">=</span> <span class="st">"Escherichia coli"</span>,</span></span>
<span class="r-in"><span> amoxicillin <span class="op">=</span> <span class="fu"><a href="as.mic.html">as.mic</a></span><span class="op">(</span><span class="fl">8</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> cipro <span class="op">=</span> <span class="fu"><a href="as.mic.html">as.mic</a></span><span class="op">(</span><span class="fl">0.256</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> tobra <span class="op">=</span> <span class="fu"><a href="as.disk.html">as.disk</a></span><span class="op">(</span><span class="fl">16</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> genta <span class="op">=</span> <span class="fu"><a href="as.disk.html">as.disk</a></span><span class="op">(</span><span class="fl">18</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> ERY <span class="op">=</span> <span class="st">"R"</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">df_long</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span></span>
<span class="r-in"><span> bacteria <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="st">"Escherichia coli"</span>, <span class="fl">4</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> antibiotic <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">"amoxicillin"</span>, <span class="st">"cipro"</span>, <span class="st">"tobra"</span>, <span class="st">"genta"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> mics <span class="op">=</span> <span class="fu"><a href="as.mic.html">as.mic</a></span><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="fl">0.01</span>, <span class="fl">1</span>, <span class="fl">4</span>, <span class="fl">8</span><span class="op">)</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> disks <span class="op">=</span> <span class="fu"><a href="as.disk.html">as.disk</a></span><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="fl">6</span>, <span class="fl">10</span>, <span class="fl">14</span>, <span class="fl">18</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-in"><span></span></span>
<span class="r-in"><span><span class="co"># \donttest{</span></span></span>
<span class="r-in"><span><span class="co">## Using dplyr -------------------------------------------------</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="co"># approaches that all work without additional arguments:</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.sir</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu"><a href="as.mic.html">is.mic</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="op">|</span> <span class="fu"><a href="as.disk.html">is.disk</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>, <span class="va">as.sir</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><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.mic</span><span class="op">)</span>, <span class="va">as.sir</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_at</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html" class="external-link">vars</a></span><span class="op">(</span><span class="va">amoxicillin</span><span class="op">:</span><span class="va">tobra</span><span class="op">)</span>, <span class="va">as.sir</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><span class="op">(</span><span class="va">amoxicillin</span><span class="op">:</span><span class="va">tobra</span>, <span class="va">as.sir</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> </span></span>
<span class="r-in"><span> <span class="co"># approaches that all work with additional arguments:</span></span></span>
<span class="r-in"><span> <span class="va">df_long</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="co"># given a certain data type, e.g. MIC values</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.sir</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> ab <span class="op">=</span> <span class="st">"antibiotic"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_long</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><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.mic</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu">as.sir</span><span class="op">(</span><span class="va">x</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> ab <span class="op">=</span> <span class="st">"antibiotic"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="co"># given certain columns, e.g. from 'cipro' to 'genta'</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_at</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html" class="external-link">vars</a></span><span class="op">(</span><span class="va">cipro</span><span class="op">:</span><span class="va">genta</span><span class="op">)</span>, <span class="va">as.sir</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><span class="op">(</span><span class="va">cipro</span><span class="op">:</span><span class="va">genta</span>,</span></span>
<span class="r-in"><span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu">as.sir</span><span class="op">(</span><span class="va">x</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> </span></span>
<span class="r-in"><span> <span class="co"># for veterinary breakpoints, add 'host':</span></span></span>
<span class="r-in"><span> <span class="va">df_long</span><span class="op">$</span><span class="va">animal_species</span> <span class="op">&lt;-</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">"cats"</span>, <span class="st">"dogs"</span>, <span class="st">"horses"</span>, <span class="st">"cattle"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_long</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="co"># given a certain data type, e.g. MIC values</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.sir</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> ab <span class="op">=</span> <span class="st">"antibiotic"</span>,</span></span>
<span class="r-in"><span> host <span class="op">=</span> <span class="st">"animal_species"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_long</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><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.mic</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu">as.sir</span><span class="op">(</span><span class="va">x</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> ab <span class="op">=</span> <span class="st">"antibiotic"</span>,</span></span>
<span class="r-in"><span> host <span class="op">=</span> <span class="st">"animal_species"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_at</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html" class="external-link">vars</a></span><span class="op">(</span><span class="va">cipro</span><span class="op">:</span><span class="va">genta</span><span class="op">)</span>, <span class="va">as.sir</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> ab <span class="op">=</span> <span class="st">"antibiotic"</span>,</span></span>
<span class="r-in"><span> host <span class="op">=</span> <span class="st">"animal_species"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">across</a></span><span class="op">(</span><span class="va">cipro</span><span class="op">:</span><span class="va">genta</span>,</span></span>
<span class="r-in"><span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu">as.sir</span><span class="op">(</span><span class="va">x</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"bacteria"</span>,</span></span>
<span class="r-in"><span> host <span class="op">=</span> <span class="st">"animal_species"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> </span></span>
<span class="r-in"><span> <span class="co"># to include information about urinary tract infections (UTI)</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>mo <span class="op">=</span> <span class="st">"E. coli"</span>,</span></span>
<span class="r-in"><span> nitrofuratoin <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">"&lt;= 2"</span>, <span class="fl">32</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> from_the_bladder <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="cn">TRUE</span>, <span class="cn">FALSE</span><span class="op">)</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="r-in"><span> <span class="fu">as.sir</span><span class="op">(</span>uti <span class="op">=</span> <span class="st">"from_the_bladder"</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>mo <span class="op">=</span> <span class="st">"E. coli"</span>,</span></span>
<span class="r-in"><span> nitrofuratoin <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">"&lt;= 2"</span>, <span class="fl">32</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> specimen <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">"urine"</span>, <span class="st">"blood"</span><span class="op">)</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="r-in"><span> <span class="fu">as.sir</span><span class="op">(</span><span class="op">)</span> <span class="co"># automatically determines urine isolates</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="va">df_wide</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_at</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html" class="external-link">vars</a></span><span class="op">(</span><span class="va">cipro</span><span class="op">:</span><span class="va">genta</span><span class="op">)</span>, <span class="va">as.sir</span>, mo <span class="op">=</span> <span class="st">"E. coli"</span>, uti <span class="op">=</span> <span class="cn">TRUE</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> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for amoxicillin (AMX) in Escherichia coli - assuming body site 'Intravenous'. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Multiple breakpoints available for ciprofloxacin (CIP) in Escherichia coli - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for amoxicillin (AMX) in Escherichia coli - assuming body site 'Intravenous'. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Multiple breakpoints available for ciprofloxacin (CIP) in Escherichia coli - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'tobra' (TOB, tobramycin) based on</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> column 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for tobramycin (TOB) in Escherichia coli - assuming an unspecified body site. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'genta' (GEN, gentamicin) based on</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> column 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for gentamicin (GEN) in Escherichia coli - assuming an unspecified body site. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for amoxicillin (AMX) in Escherichia coli - assuming body site 'Intravenous'. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Multiple breakpoints available for ciprofloxacin (CIP) in Escherichia coli - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for amoxicillin (AMX) in Escherichia coli - assuming body site 'Intravenous'. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Multiple breakpoints available for ciprofloxacin (CIP) in Escherichia coli - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'tobra' (TOB, tobramycin) based on</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> column 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for tobramycin (TOB) in Escherichia coli - assuming an unspecified body site. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for amoxicillin (AMX) in Escherichia coli - assuming body site 'Intravenous'. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Multiple breakpoints available for ciprofloxacin (CIP) in Escherichia coli - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'tobra' (TOB, tobramycin) based on</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> column 'microorganism', EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for tobramycin (TOB) in Escherichia coli - assuming an unspecified body site. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX), 'cipro' (CIP, ciprofloxacin),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'tobra' (TOB, tobramycin), and 'genta' (GEN, gentamicin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'bacteria', CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX), 'cipro' (CIP, ciprofloxacin),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'tobra' (TOB, tobramycin), and 'genta' (GEN, gentamicin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'bacteria', CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'tobra' (TOB, tobramycin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'genta' (GEN, gentamicin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'tobra' (TOB, tobramycin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'genta' (GEN, gentamicin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming breakpoint_type = "animal", since host is set.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Please note that in the absence of specific veterinary breakpoints for</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> certain animal hosts, the CLSI guideline VET09 will be applied where</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> possible.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX), 'cipro' (CIP, ciprofloxacin),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'tobra' (TOB, tobramycin), and 'genta' (GEN, gentamicin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'bacteria', CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming breakpoint_type = "animal", since host is set.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Please note that in the absence of specific veterinary breakpoints for</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> certain animal hosts, the CLSI guideline VET09 will be applied where</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> possible.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'amoxicillin' (AMX), 'cipro' (CIP, ciprofloxacin),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'tobra' (TOB, tobramycin), and 'genta' (GEN, gentamicin) based on column</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'bacteria', CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming breakpoint_type = "animal", since host is set.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Please note that in the absence of specific veterinary breakpoints for</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> certain animal hosts, the CLSI guideline VET09 will be applied where</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> possible.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'antibiotic' (TESTAB, test Antibiotic), CLSI</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> WARNING </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • No CLSI 2024 MIC breakpoints available for test Antibiotic (TESTAB).</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'antibiotic' (TESTAB, test Antibiotic),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> WARNING </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • No CLSI 2024 DISK breakpoints available for test Antibiotic (TESTAB).</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'antibiotic' (TESTAB, test Antibiotic),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> WARNING </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • No CLSI 2024 DISK breakpoints available for test Antibiotic (TESTAB).</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>There was 1 warning in `mutate()`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #00BBBB;"></span> In argument: `cipro = (function (x, ...) ...`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> Caused by warning:</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #BBBB00;">!</span> The following animal host(s) could not be coerced: "animal_species"</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming breakpoint_type = "animal", since host is set.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Please note that in the absence of specific veterinary breakpoints for</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> certain animal hosts, the CLSI guideline VET09 will be applied where</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> possible.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'tobra' (TOB, tobramycin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'genta' (GEN, gentamicin), CLSI 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>There was 1 warning in `mutate()`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #00BBBB;"></span> In argument: `across(...)`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> Caused by warning:</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #BBBB00;">!</span> The following animal host(s) could not be coerced: "animal_species"</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: column 'nitrofuratoin' (NIT,</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> nitrofurantoin), EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming value "urine" in column 'specimen' reflects a urinary tract</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> infection.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Use as.sir(uti = FALSE) to prevent this.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: column 'nitrofuratoin' (NIT,</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> nitrofurantoin), EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'cipro' (CIP, ciprofloxacin), EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'tobra' (TOB, tobramycin), EUCAST</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'genta' (GEN, gentamicin), EUCAST</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> microorganism amoxicillin cipro tobra genta ERY</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 Escherichia coli 8 &lt;NA&gt; S S R</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## Using base R ------------------------------------------------</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="fu">as.sir</span><span class="op">(</span><span class="va">df_wide</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: column 'amoxicillin' (AMX), EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for amoxicillin (AMX) in Escherichia coli - assuming body site 'Intravenous'. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: column 'cipro' (CIP, ciprofloxacin), EUCAST</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Multiple breakpoints available for ciprofloxacin (CIP) in Escherichia coli - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: column 'tobra' (TOB, tobramycin), EUCAST</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for tobramycin (TOB) in Escherichia coli - assuming an unspecified body site. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: column 'genta' (GEN, gentamicin), EUCAST</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Breakpoints for UTI and non-UTI available for gentamicin (GEN) in Escherichia coli - assuming an unspecified body site. Use argument uti to set which isolates are from urine. See ?as.sir.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assigning class 'sir' to already clean column 'ERY' (erythromycin)...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> microorganism amoxicillin cipro tobra genta ERY</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 Escherichia coli S I S S R</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># return a 'logbook' about the results:</span></span></span>
<span class="r-in"><span><span class="fu">sir_interpretation_history</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 57 × 16</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> datetime index ab_given mo_given host_given ab mo </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;dttm&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&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;ab&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 2024-12-20 <span style="color: #949494;">10:00:38</span> 4 AMX B_STRPT… human AMX B_STRPT_PNMN </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2024-12-20 <span style="color: #949494;">10:00:46</span> 4 genta Escheri… human GEN B_[ORD]_ENTRBCTR</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2024-12-20 <span style="color: #949494;">10:00:46</span> 4 genta Escheri… human GEN B_[ORD]_ENTRBCTR</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2024-12-20 <span style="color: #949494;">10:00:47</span> 4 genta Escheri… cattle GEN B_ESCHR_COLI </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2024-12-20 <span style="color: #949494;">10:00:47</span> 4 genta Escheri… cattle GEN B_ESCHR_COLI </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2024-12-20 <span style="color: #949494;">10:00:38</span> 3 AMX B_STRPT… human AMX B_STRPT_PNMN </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2024-12-20 <span style="color: #949494;">10:00:46</span> 3 tobra Escheri… human TOB B_[ORD]_ENTRBCTR</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2024-12-20 <span style="color: #949494;">10:00:46</span> 3 tobra Escheri… human TOB B_[ORD]_ENTRBCTR</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2024-12-20 <span style="color: #949494;">10:00:47</span> 3 tobra Escheri… horses TOB B_ESCHR_COLI </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2024-12-20 <span style="color: #949494;">10:00:47</span> 3 tobra Escheri… horses TOB B_ESCHR_COLI </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 47 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 9 more variables: host &lt;chr&gt;, method &lt;chr&gt;, input &lt;dbl&gt;, outcome &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># notes &lt;chr&gt;, guideline &lt;chr&gt;, ref_table &lt;chr&gt;, uti &lt;lgl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># breakpoint_S_R &lt;chr&gt;</span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># for single values</span></span></span>
<span class="r-in"><span><span class="fu">as.sir</span><span class="op">(</span></span></span>
<span class="r-in"><span> x <span class="op">=</span> <span class="fu"><a href="as.mic.html">as.mic</a></span><span class="op">(</span><span class="fl">2</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="fu"><a href="as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"S. pneumoniae"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> ab <span class="op">=</span> <span class="st">"AMP"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"EUCAST"</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> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'AMP' (ampicillin), EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> NOTE </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> • Multiple breakpoints available for ampicillin (AMP) in Streptococcus pneumoniae - assuming body site 'Non-meningitis'.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'sir'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] R</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="fu">as.sir</span><span class="op">(</span></span></span>
<span class="r-in"><span> x <span class="op">=</span> <span class="fu"><a href="as.disk.html">as.disk</a></span><span class="op">(</span><span class="fl">18</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"Strep pneu"</span>, <span class="co"># `mo` will be coerced with as.mo()</span></span></span>
<span class="r-in"><span> ab <span class="op">=</span> <span class="st">"ampicillin"</span>, <span class="co"># and `ab` with as.ab()</span></span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"EUCAST"</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> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Run sir_interpretation_history() afterwards to retrieve a logbook with</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> all the details of the breakpoint interpretations.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'ampicillin' (AMP), EUCAST 2024...</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'sir'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] R</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># For CLEANING existing SIR values ------------------------------------</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="fu">as.sir</span><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">"S"</span>, <span class="st">"SDD"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>, <span class="st">"NI"</span>, <span class="st">"A"</span>, <span class="st">"B"</span>, <span class="st">"C"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>in as.sir(): 3 results in column '19' truncated (38%) that were invalid</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> antimicrobial interpretations: "A", "B", and "C"</span>
<span class="r-in"><span><span class="fu">as.sir</span><span class="op">(</span><span class="st">"&lt;= 0.002; S"</span><span class="op">)</span> <span class="co"># will return "S"</span></span></span>
<span class="r-in"><span><span class="va">sir_data</span> <span class="op">&lt;-</span> <span class="fu">as.sir</span><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="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="st">"S"</span>, <span class="fl">474</span><span class="op">)</span>, <span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="st">"I"</span>, <span class="fl">36</span><span class="op">)</span>, <span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="st">"R"</span>, <span class="fl">370</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">is.sir</span><span class="op">(</span><span class="va">sir_data</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE</span>
<span class="r-in"><span><span class="fu"><a href="plot.html">plot</a></span><span class="op">(</span><span class="va">sir_data</span><span class="op">)</span> <span class="co"># for percentages</span></span></span>
<span class="r-plt img"><img src="as.sir-1.png" alt="" width="700" height="433"></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/barplot.html" class="external-link">barplot</a></span><span class="op">(</span><span class="va">sir_data</span><span class="op">)</span> <span class="co"># for frequencies</span></span></span>
<span class="r-plt img"><img src="as.sir-2.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># as common in R, you can use as.integer() to return factor indices:</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/integer.html" class="external-link">as.integer</a></span><span class="op">(</span><span class="fu">as.sir</span><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">"S"</span>, <span class="st">"SDD"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>, <span class="st">"NI"</span>, <span class="cn">NA</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 2 3 4 5 NA</span>
<span class="r-in"><span><span class="co"># but for computational use, as.double() will return 1 for S, 2 for I/SDD, and 3 for R:</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/double.html" class="external-link">as.double</a></span><span class="op">(</span><span class="fu">as.sir</span><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">"S"</span>, <span class="st">"SDD"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>, <span class="st">"NI"</span>, <span class="cn">NA</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 2 2 3 NA NA</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># the dplyr way</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://dplyr.tidyverse.org" class="external-link">"dplyr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_at</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html" class="external-link">vars</a></span><span class="op">(</span><span class="va">PEN</span><span class="op">:</span><span class="va">RIF</span><span class="op">)</span>, <span class="va">as.sir</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="co"># same:</span></span></span>
<span class="r-in"><span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu">as.sir</span><span class="op">(</span><span class="va">PEN</span><span class="op">:</span><span class="va">RIF</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="co"># fastest way to transform all columns with already valid AMR results to class `sir`:</span></span></span>
<span class="r-in"><span> <span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is_sir_eligible</span>, <span class="va">as.sir</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="co"># since dplyr 1.0.0, this can also be:</span></span></span>
<span class="r-in"><span> <span class="co"># example_isolates %&gt;%</span></span></span>
<span class="r-in"><span> <span class="co"># mutate(across(where(is_sir_eligible), as.sir))</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;"># 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 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>