<metaproperty="og:description"content="These function can be used to determine first isolates (see first_isolate()). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates can then be called first weighted isolates."/>
<p>These function can be used to determine first isolates (see <code><ahref='first_isolate.html'>first_isolate()</a></code>). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates can then be called first <em>weighted</em> isolates.</p>
type <spanclass='op'>=</span><spanclass='fu'><ahref='https://rdrr.io/r/base/c.html'>c</a></span><spanclass='op'>(</span><spanclass='st'>"keyantibiotics"</span>, <spanclass='st'>"points"</span><spanclass='op'>)</span>,
<td><p>a <ahref='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with antibiotics columns, like <code>AMX</code> or <code>amox</code>. Can be omitted when used inside <code>dplyr</code> verbs, such as <code><ahref='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code>, <code><ahref='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code> and <code><ahref='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>.</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>
<td><p>column names of <strong>broad-spectrum</strong> antibiotics, case-insensitive. See details for which antibiotics will be used at default (which are guessed with <code><ahref='guess_ab_col.html'>guess_ab_col()</a></code>).</p></td>
<td><p>column names of antibiotics for <strong>Gram-positives</strong>, case-insensitive. See details for which antibiotics will be used at default (which are guessed with <code><ahref='guess_ab_col.html'>guess_ab_col()</a></code>).</p></td>
<td><p>column names of antibiotics for <strong>Gram-negatives</strong>, case-insensitive. See details for which antibiotics will be used at default (which are guessed with <code><ahref='guess_ab_col.html'>guess_ab_col()</a></code>).</p></td>
<td><p>type to determine weighed isolates; can be <code>"keyantibiotics"</code> or <code>"points"</code>, see Details</p></td>
</tr>
<tr>
<th>ignore_I</th>
<td><p>logical to determine whether antibiotic interpretations with <code>"I"</code> will be ignored when <code>type = "keyantibiotics"</code>, see Details</p></td>
</tr>
<tr>
<th>points_threshold</th>
<td><p>points until the comparison of key antibiotics will lead to inclusion of an isolate when <code>type = "points"</code>, see Details</p></td>
<p>The <code>key_antibiotics()</code> function is context-aware when used inside <code>dplyr</code> verbs, such as <code><ahref='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code>, <code><ahref='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code> and <code><ahref='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>. This means that then the <code>x</code> argument can be omitted, please see <em>Examples</em>.</p>
<p>The function <code>key_antibiotics()</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal()</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>) by <code>key_antibiotics()</code> and ignored by <code>key_antibiotics_equal()</code>.</p>
<p>The <code><ahref='first_isolate.html'>first_isolate()</a></code> function only uses this function on the same microbial species from the same patient. Using this, e.g. an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) is found within the same patient episode. Without key antibiotic comparison it would not. See <code><ahref='first_isolate.html'>first_isolate()</a></code> for more info.</p>
<p>At default, the antibiotics that are used for <strong>Gram-positive bacteria</strong> are:</p><ul>
<li><p>Amoxicillin</p></li>
<li><p>Amoxicillin/clavulanic acid</p></li>
<li><p>Cefuroxime</p></li>
<li><p>Piperacillin/tazobactam</p></li>
<li><p>Ciprofloxacin</p></li>
<li><p>Trimethoprim/sulfamethoxazole</p></li>
<li><p>Vancomycin</p></li>
<li><p>Teicoplanin</p></li>
<li><p>Tetracycline</p></li>
<li><p>Erythromycin</p></li>
<li><p>Oxacillin</p></li>
<li><p>Rifampin</p></li>
</ul>
<p>At default the antibiotics that are used for <strong>Gram-negative bacteria</strong> are:</p><ul>
<li><p>Amoxicillin</p></li>
<li><p>Amoxicillin/clavulanic acid</p></li>
<li><p>Cefuroxime</p></li>
<li><p>Piperacillin/tazobactam</p></li>
<li><p>Ciprofloxacin</p></li>
<li><p>Trimethoprim/sulfamethoxazole</p></li>
<li><p>Gentamicin</p></li>
<li><p>Tobramycin</p></li>
<li><p>Colistin</p></li>
<li><p>Cefotaxime</p></li>
<li><p>Ceftazidime</p></li>
<li><p>Meropenem</p></li>
</ul>
<p>The function <code>key_antibiotics_equal()</code> checks the characters returned by <code>key_antibiotics()</code> for equality, and returns a <code><ahref='https://rdrr.io/r/base/logical.html'>logical</a></code> vector.</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 argument 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>
<p>There are two ways to determine whether isolates can be included as first <em>weighted</em> isolates which will give generally the same results:</p><ol>
<p>Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With <code>ignore_I = FALSE</code>, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the <code>key_antibiotics()</code> function.</p></li>
<p>A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds <code>points_threshold</code>, which default to <code>2</code>, an isolate will be (re)selected as a first weighted isolate.</p></li>
<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>
<spanclass='fu'><ahref='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span><spanclass='op'>(</span>keyab <spanclass='op'>=</span><spanclass='fu'>key_antibiotics</span><spanclass='op'>(</span><spanclass='op'>)</span><spanclass='op'>)</span><spanclass='op'>%>%</span><spanclass='co'># no need to define `x`</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>