<p>These functions can be used to calculate the (co-)resistance of microbial isolates (i.e. percentage S, SI, I, IR or R). All functions support quasiquotation with pipes, can be used in <code>dplyr</code>s <code><ahref='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></code> and support grouped variables, see <em>Examples</em>.</p>
<p><code>portion_R</code> and <code>portion_IR</code> can be used to calculate resistance, <code>portion_S</code> and <code>portion_SI</code> can be used to calculate susceptibility.<br/></p>
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code><ahref='as.rsi.html'>as.rsi</a></code> if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See Examples.</p></td>
</tr>
<tr>
<th>minimum</th>
<td><p>the minimal amount of available isolates. Any number lower than <code>minimum</code> will return <code>NA</code> with a warning. The default number of <code>30</code> isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.</p></td>
</tr>
<tr>
<th>as_percent</th>
<td><p>a logical to indicate whether the output must be returned as a hundred fold with % sign (a character). A value of <code>0.123456</code> will then be returned as <code>"12.3%"</code>.</p></td>
</tr>
<tr>
<th>also_single_tested</th>
<td><p>a logical to indicate whether (in combination therapies) also observations should be included where not all antibiotics were tested, but at least one of the tested antibiotics contains a target interpretation (e.g. S in case of <code>portion_S</code> and R in case of <code>portion_R</code>). <strong>This would lead to selection bias in almost all cases.</strong></p></td>
</tr>
<tr>
<th>data</th>
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code><ahref='as.rsi.html'>as.rsi</a></code>)</p></td>
</tr>
<tr>
<th>translate_ab</th>
<td><p>a column name of the <code><ahref='antibiotics.html'>antibiotics</a></code> data set to translate the antibiotic abbreviations to, using <code><ahref='abname.html'>abname</a></code>. This can be set with <code><ahref='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
</tr>
<tr>
<th>combine_IR</th>
<td><p>a logical to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)</p></td>
<p><strong>M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition</strong>, 2014, <em>Clinical and Laboratory Standards Institute (CLSI)</em>. <ahref='https://clsi.org/standards/products/microbiology/documents/m39/'>https://clsi.org/standards/products/microbiology/documents/m39/</a>.</p>
<p>Wickham H. <strong>Tidy Data.</strong> The Journal of Statistical Software, vol. 59, 2014. <ahref='http://vita.had.co.nz/papers/tidy-data.html'>http://vita.had.co.nz/papers/tidy-data.html</a></p>
<p><strong>Remember that you should filter your table to let it contain only first isolates!</strong> Use <code><ahref='first_isolate.html'>first_isolate</a></code> to determine them in your data set.</p>
<p>These functions are not meant to count isolates, but to calculate the portion of resistance/susceptibility. Use the <code><ahref='count.html'>count</a></code> functions to count isolates. <em>Low counts can infuence the outcome - these <code>portion</code> functions may camouflage this, since they only return the portion albeit being dependent on the <code>minimum</code> parameter.</em></p>
<p><code>portion_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code><ahref='as.rsi.html'>as.rsi</a></code>) and calculates the portions R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
<p>The old <code><ahref='rsi.html'>rsi</a></code> function is still available for backwards compatibility but is deprecated.
<br/><br/>
To calculate the probability (<em>p</em>) of susceptibility of one antibiotic, we use this formula:
To calculate the probability (<em>p</em>) of susceptibility of more antibiotics (i.e. combination therapy), we need to check whether one of them has a susceptible result (as numerator) and count all cases where all antibiotics were tested (as denominator). <br/>
<spanclass='kw'>n</span><spanclass='kw'>=</span><spanclass='fu'><ahref='count.html'>n_rsi</a></span>(<spanclass='no'>cipr</span>)) <spanclass='co'># n_rsi works like n_distinct in dplyr</span>
<spanclass='kw'>n</span><spanclass='kw'>=</span><spanclass='fu'><ahref='count.html'>n_rsi</a></span>(<spanclass='no'>cipr</span>), <spanclass='co'># works like n_distinct in dplyr</span>
<spanclass='kw'>total</span><spanclass='kw'>=</span><spanclass='fu'><ahref='http://dplyr.tidyverse.org/reference/n.html'>n</a></span>()) <spanclass='co'># NOT the amount of tested isolates!</span>
<spanclass='no'>septic_patients</span><spanclass='kw'>%>%</span><spanclass='fu'>portion_S</span>(<spanclass='no'>amcl</span>) <spanclass='co'># S = 67.1%</span>
<spanclass='no'>septic_patients</span><spanclass='kw'>%>%</span><spanclass='fu'><ahref='count.html'>count_all</a></span>(<spanclass='no'>amcl</span>) <spanclass='co'># n = 1576</span>
<spanclass='no'>septic_patients</span><spanclass='kw'>%>%</span><spanclass='fu'>portion_S</span>(<spanclass='no'>gent</span>) <spanclass='co'># S = 74.0%</span>
<spanclass='no'>septic_patients</span><spanclass='kw'>%>%</span><spanclass='fu'><ahref='count.html'>count_all</a></span>(<spanclass='no'>gent</span>) <spanclass='co'># n = 1855</span>
<spanclass='no'>septic_patients</span><spanclass='kw'>%>%</span><spanclass='fu'>portion_S</span>(<spanclass='no'>amcl</span>, <spanclass='no'>gent</span>) <spanclass='co'># S = 92.0%</span>
<spanclass='no'>septic_patients</span><spanclass='kw'>%>%</span><spanclass='fu'><ahref='count.html'>count_all</a></span>(<spanclass='no'>amcl</span>, <spanclass='no'>gent</span>) <spanclass='co'># n = 1517</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/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>