<metaproperty="og:description"content="Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing R/SI values. This transforms the input to a new class rsi, which is an ordered factor with levels S &lt; I &lt; R. Values that cannot be interpreted will be returned as NA with a warning."/>
<p>Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing R/SI values. This transforms the input to a new class <code>rsi</code>, which is an ordered factor with levels <code>S < I < R</code>. Values that cannot be interpreted will be returned as <code>NA</code> with a warning.</p>
mo <spanclass='op'>=</span><spanclass='cn'>NULL</span>,
ab <spanclass='op'>=</span><spanclass='fu'><ahref='https://rdrr.io/r/base/deparse.html'>deparse</a></span><spanclass='op'>(</span><spanclass='fu'><ahref='https://rdrr.io/r/base/substitute.html'>substitute</a></span><spanclass='op'>(</span><spanclass='va'>x</span><spanclass='op'>)</span><spanclass='op'>)</span>,
mo <spanclass='op'>=</span><spanclass='cn'>NULL</span>,
ab <spanclass='op'>=</span><spanclass='fu'><ahref='https://rdrr.io/r/base/deparse.html'>deparse</a></span><spanclass='op'>(</span><spanclass='fu'><ahref='https://rdrr.io/r/base/substitute.html'>substitute</a></span><spanclass='op'>(</span><spanclass='va'>x</span><spanclass='op'>)</span><spanclass='op'>)</span>,
<td><p>vector of values (for class <code><ahref='as.mic.html'>mic</a></code>: an MIC value in mg/L, for class <code><ahref='as.disk.html'>disk</a></code>: a disk diffusion radius in millimetres)</p></td>
<td><p>for using on a <ahref='https://rdrr.io/r/base/data.frame.html'>data.frame</a>: names of columns to apply <code>as.rsi()</code> on (supports tidy selection like <code>AMX:VAN</code>). Otherwise: parameters passed on to methods.</p></td>
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><ahref='as.mo.html'>as.mo()</a></code>, will be determined automatically if the <code>dplyr</code> package is installed</p></td>
<td><p>(Urinary Tract Infection) A vector with <ahref='https://rdrr.io/r/base/logical.html'>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.rsi()</code> on a <ahref='https://rdrr.io/r/base/data.frame.html'>data.frame</a>, this can also be a column containing <ahref='https://rdrr.io/r/base/logical.html'>logical</a>s or when left blank, the data set will be searched for a 'specimen' and rows containing 'urin' (such as 'urine', 'urina') in that column will be regarded isolates from a UTI. See <em>Examples</em>.</p></td>
<td><p>a logical to indicate that MIC values starting with <code>">"</code> (but not <code>">="</code>) must always return "R" , and that MIC values starting with <code>"<"</code> (but not <code>"<="</code>) must always return "S"</p></td>
<td><p><em>(only useful when using a EUCAST guideline)</em> a logical 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 <ahref='intrinsic_resistant.html'>intrinsic_resistant</a> data set, that itself is based on <ahref='https://www.eucast.org/expert_rules_and_intrinsic_resistance/'>'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2</a> from 2020.</p></td>
<td><p>a <ahref='https://rdrr.io/r/base/data.frame.html'>data.frame</a> to be used for interpretation, which defaults to the <ahref='rsi_translation.html'>rsi_translation</a> data set. Changing this parameter allows for using own interpretation guidelines. This parameter must contain a data set that is equal in structure to the <ahref='rsi_translation.html'>rsi_translation</a> data set (same column names and column types). Please note that the <code>guideline</code> parameter will be ignored when <code>reference_data</code> is manually set.</p></td>
<td><p>column name of the IDs of the microorganisms (see <code><ahref='as.mo.html'>as.mo()</a></code>), defaults to the first column of class <code><ahref='as.mo.html'>mo</a></code>. Values will be coerced using <code><ahref='as.mo.html'>as.mo()</a></code>.</p></td>
<p>The <code>as.rsi()</code> function works in four ways:</p><ol>
<li><p>For <strong>cleaning raw / untransformed data</strong>. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with R/SI interpretations and MIC values such as <code>"<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 unclear.</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><ahref='as.mic.html'>as.mic()</a></code>, that also gives your columns the new data class <code><ahref='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> parameter.</p><ul>
<li><p>Using <code>dplyr</code>, R/SI interpretation can be done very easily with either:</p><pre><spanclass='va'>your_data</span><spanclass='op'>%>%</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span><spanclass='op'>(</span><spanclass='va'>is.mic</span>, <spanclass='va'>as.rsi</span><spanclass='op'>)</span><spanclass='co'># until dplyr 1.0.0</span>
<spanclass='va'>your_data</span><spanclass='op'>%>%</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span><spanclass='op'>(</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/across.html'>across</a></span><spanclass='op'>(</span><spanclass='fu'>where</span><spanclass='op'>(</span><spanclass='va'>is.mic</span><spanclass='op'>)</span>, <spanclass='va'>as.rsi</span><spanclass='op'>)</span><spanclass='op'>)</span><spanclass='co'># since dplyr 1.0.0</span>
<li><p>Operators like "<=" will be stripped before interpretation. When using <code>conserve_capped_values = TRUE</code>, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=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 ">2" to be lower than ">=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><ahref='as.disk.html'>as.disk()</a></code>, that also gives your columns the new data class <code><ahref='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> parameter.</p><ul>
<li><p>Using <code>dplyr</code>, R/SI interpretation can be done very easily with either:</p><pre><spanclass='va'>your_data</span><spanclass='op'>%>%</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span><spanclass='op'>(</span><spanclass='va'>is.disk</span>, <spanclass='va'>as.rsi</span><spanclass='op'>)</span><spanclass='co'># until dplyr 1.0.0</span>
<spanclass='va'>your_data</span><spanclass='op'>%>%</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span><spanclass='op'>(</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/across.html'>across</a></span><spanclass='op'>(</span><spanclass='fu'>where</span><spanclass='op'>(</span><spanclass='va'>is.disk</span><spanclass='op'>)</span>, <spanclass='va'>as.rsi</span><spanclass='op'>)</span><spanclass='op'>)</span><spanclass='co'># since dplyr 1.0.0</span>
<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.rsi(data)</code>.</p></li>
<p>Simply using <code>"CLSI"</code> or <code>"EUCAST"</code> as input will automatically select the latest version of that guideline. You can set your own data set using the <code>reference_data</code> parameter. The <code>guideline</code> parameter will then be ignored.</p>
<p>After using <code>as.rsi()</code>, you can use the <code><ahref='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>The repository of this package <ahref='https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt'>contains a machine readable version</a> of all guidelines. This is a CSV file consisting of 18,650 rows and 10 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 agent 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>
<p>The function <code>is.rsi.eligible()</code> returns <code>TRUE</code> when a columns contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R), and <code>FALSE</code> otherwise. The threshold of 5% can be set with the <code>threshold</code> parameter.</p>
<p>In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories R and S/I as shown below (<ahref='https://www.eucast.org/newsiandr/'>https://www.eucast.org/newsiandr/</a>).</p><ul>
A microorganism is categorised as <em>Resistant</em> when there is a high likelihood of therapeutic failure even when there is increased exposure. Exposure 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>
<li><p><strong>S = Susceptible</strong><br/>
A microorganism is categorised as <em>Susceptible, standard dosing regimen</em>, when there is a high likelihood of therapeutic success using a standard dosing regimen of the agent.</p></li>
<li><p><strong>I = Increased exposure, but still susceptible</strong><br/>
A microorganism is categorised as <em>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>
<p>This AMR package honours this new insight. Use <code><ahref='proportion.html'>susceptibility()</a></code> (equal to <code><ahref='proportion.html'>proportion_SI()</a></code>) to determine antimicrobial susceptibility and <code><ahref='count.html'>count_susceptible()</a></code> (equal to <code><ahref='count.html'>count_SI()</a></code>) to count susceptible isolates.</p>
The <ahref='lifecycle.html'>lifecycle</a> of this function is <strong>stable</strong>. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.</p>
<p>If the unlying code needs breaking changes, they will occur gradually. For example, a parameter will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.</p>
<h2class="hasAnchor"id="reference-data-publicly-available"><aclass="anchor"href="#reference-data-publicly-available"></a>Reference data publicly available</h2>
<p>All reference data sets (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) in this <code>AMR</code> package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, SAS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find <ahref='https://msberends.github.io/AMR/articles/datasets.html'>all download links on our website</a>, which is automatically updated with every code change.</p>
<p>On our website <ahref='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <ahref='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <ahref='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <ahref='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <ahref='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
<preclass="examples"><spanclass='fu'><ahref='https://rdrr.io/r/base/summary.html'>summary</a></span><spanclass='op'>(</span><spanclass='va'>example_isolates</span><spanclass='op'>)</span><spanclass='co'># see all R/SI results at a glance</span>
GEN <spanclass='op'>=</span><spanclass='fu'><ahref='as.disk.html'>as.disk</a></span><spanclass='op'>(</span><spanclass='fl'>18</span><spanclass='op'>)</span>,
mo <spanclass='op'>=</span><spanclass='fu'><ahref='as.mo.html'>as.mo</a></span><spanclass='op'>(</span><spanclass='st'>"S. pneumoniae"</span><spanclass='op'>)</span>,
ab <spanclass='op'>=</span><spanclass='st'>"AMP"</span>,
<spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span><spanclass='op'>(</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span><spanclass='op'>(</span><spanclass='va'>AMP</span><spanclass='op'>:</span><spanclass='va'>TOB</span><spanclass='op'>)</span>, <spanclass='va'>as.rsi</span>, mo <spanclass='op'>=</span><spanclass='va'>.</span><spanclass='op'>$</span><spanclass='va'>microorganism</span><spanclass='op'>)</span>
<spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span><spanclass='op'>(</span><spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span><spanclass='op'>(</span><spanclass='va'>AMP</span><spanclass='op'>:</span><spanclass='va'>NIT</span><spanclass='op'>)</span>, <spanclass='va'>as.rsi</span>, mo <spanclass='op'>=</span><spanclass='st'>"E. coli"</span>, uti <spanclass='op'>=</span><spanclass='cn'>TRUE</span><spanclass='op'>)</span>
<spanclass='fu'><ahref='plot.html'>plot</a></span><spanclass='op'>(</span><spanclass='va'>rsi_data</span><spanclass='op'>)</span><spanclass='co'># for percentages</span>
<spanclass='fu'><ahref='https://rdrr.io/r/graphics/barplot.html'>barplot</a></span><spanclass='op'>(</span><spanclass='va'>rsi_data</span><spanclass='op'>)</span><spanclass='co'># for frequencies</span>
<p>Developed by <ahref='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <ahref='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <ahref='https://www.rug.nl/staff/a.w.friedrich/'>Alexander W. Friedrich</a>, <ahref='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <ahref='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <ahref='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
<p>Made with <ahref="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1, using <ahref="https://preferably.amirmasoudabdol.name/?source=footer">preferably</a> template.</p>