<metaproperty="og:title"content="Key antibiotics for first <em>weighted</em> isolates — key_antibiotics"/>
<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 will 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 will then be called first <em>weighted</em> isolates.</p>
<td><p>column name of the unique IDs of the microorganisms (see <code><ahref='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><ahref='as.mo.html'>as.mo</a></code>.</p></td>
<td><p>column names of antibiotics for <strong>Gram negatives</strong>, case-insensitive</p></td>
</tr>
<tr>
<th>warnings</th>
<td><p>give warning about missing antibiotic columns, they will anyway be ignored</p></td>
</tr>
<tr>
<th>...</th>
<td><p>other parameters passed on to function</p></td>
</tr>
<tr>
<th>x, y</th>
<td><p>characters to compare</p></td>
</tr>
<tr>
<th>type</th>
<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 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>). 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, an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) found within the same episode (see <code>episode</code> parameter of <code><ahref='first_isolate.html'>first_isolate</a></code>). Without key antibiotic comparison it wouldn't.</p>
<p>At default, the antibiotics that are used for <strong>Gram positive bacteria</strong> are (colum names): <br/>
<code>"amox"</code>, <code>"amcl"</code>, <code>"cfur"</code>, <code>"pita"</code>, <code>"cipr"</code>, <code>"trsu"</code> (until here is universal), <code>"vanc"</code>, <code>"teic"</code>, <code>"tetr"</code>, <code>"eryt"</code>, <code>"oxac"</code>, <code>"rifa"</code>.</p>
<p>At default, the antibiotics that are used for <strong>Gram negative bacteria</strong> are (colum names): <br/>
<code>"amox"</code>, <code>"amcl"</code>, <code>"cfur"</code>, <code>"pita"</code>, <code>"cipr"</code>, <code>"trsu"</code> (until here is universal), <code>"gent"</code>, <code>"tobr"</code>, <code>"coli"</code>, <code>"cfot"</code>, <code>"cfta"</code>, <code>"mero"</code>.</p>
<p>The function <code>key_antibiotics_equal</code> checks the characters returned by <code>key_antibiotics</code> for equality, and returns a logical vector.</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: <br/></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. <br/></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>, an isolate will be (re)selected as a first weighted isolate.</p>
<preclass="examples"><divclass='input'><spanclass='co'># septic_patients is a dataset available in the AMR package</span>
?<spanclass='no'>septic_patients</span></div><divclass='output co'>#><spanclass='message'>Rendering development documentation for 'septic_patients'</span></div><divclass='input'><spanclass='fu'><ahref='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<spanclass='no'>dplyr</span>)
)</div><divclass='output co'>#><spanclass='message'><spanstyle='color: #0000BB;'>NOTE: Using column `</span><spanstyle='color: #0000BB;font-weight: bold;'>mo</span><spanstyle='color: #0000BB;'>` as input for `col_mo`.</span><span></span></div><divclass='output co'>#><spanclass='message'></span><spanstyle='color: #0000BB;'>NOTE: Using column `</span><spanstyle='color: #0000BB;font-weight: bold;'>mo</span><spanstyle='color: #0000BB;'>` as input for `col_mo`.</span><span></span></div><divclass='output co'>#><spanclass='message'></span><spanstyle='color: #0000BB;'>NOTE: Using column `</span><spanstyle='color: #0000BB;font-weight: bold;'>date</span><spanstyle='color: #0000BB;'>` as input for `col_date`.</span><span></span></div><divclass='output co'>#><spanclass='message'></span><spanstyle='color: #0000BB;'>NOTE: Using column `</span><spanstyle='color: #0000BB;font-weight: bold;'>patient_id</span><spanstyle='color: #0000BB;'>` as input for `col_patient_id`.</span><span></span></div><divclass='output co'>#><spanclass='message'>=> Found </span><spanstyle='font-weight: bold;'>1,317 first isolates</span><span> (65.9% of total)</span></div><divclass='output co'>#><spanclass='message'></span><spanstyle='color: #0000BB;'>NOTE: Using column `</span><spanstyle='color: #0000BB;font-weight: bold;'>mo</span><spanstyle='color: #0000BB;'>` as input for `col_mo`.</span><span></span></div><divclass='output co'>#><spanclass='message'></span><spanstyle='color: #0000BB;'>NOTE: Using column `</span><spanstyle='color: #0000BB;font-weight: bold;'>date</span><spanstyle='color: #0000BB;'>` as input for `col_date`.</span><span></span></div><divclass='output co'>#><spanclass='message'></span><spanstyle='color: #0000BB;'>NOTE: Using column `</span><spanstyle='color: #0000BB;font-weight: bold;'>patient_id</span><spanstyle='color: #0000BB;'>` as input for `col_patient_id`.</span><span></span></div><divclass='output co'>#> [Criterion] Inclusion based on key antibiotics, ignoring I.</div><divclass='output co'>#><spanclass='message'>=> Found </span><spanstyle='font-weight: bold;'>1,413 first weighted isolates</span><span> (70.7% of total)</span></div><divclass='input'>
<spanclass='fu'>key_antibiotics_equal</span>(<spanclass='no'>strainA</span>, <spanclass='no'>strainB</span>)</div><divclass='output co'>#> [1] TRUE</div><divclass='input'><spanclass='co'># TRUE, because I is ignored (as well as missing values)</span>
<spanclass='fu'>key_antibiotics_equal</span>(<spanclass='no'>strainA</span>, <spanclass='no'>strainB</span>, <spanclass='kw'>ignore_I</span><spanclass='kw'>=</span><spanclass='fl'>FALSE</span>)</div><divclass='output co'>#> [1] FALSE</div><divclass='input'># FALSE, because I is not ignored and so the 4th value differs
<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/c.glasner/'>Corinna Glasner</a>, <ahref='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <ahref='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>.</p>