1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:06:12 +01:00

cli-147-2043

This commit is contained in:
github-actions 2024-06-15 13:40:21 +00:00
parent 8e108a2243
commit 51f4d0e546
91 changed files with 280 additions and 1170 deletions

View File

@ -37,7 +37,7 @@
<a class="navbar-brand me-2" href="https://msberends.github.io/AMR/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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -205,7 +205,7 @@
website update since they are based on randomly created values and the
page was written in <a href="https://rmarkdown.rstudio.com/" class="external-link">R
Markdown</a>. However, the methodology remains unchanged. This page was
generated on 14 June 2024.</p>
generated on 15 June 2024.</p>
<div class="section level2">
<h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
</h2>
@ -261,21 +261,21 @@ make the structure of your data generally look like this:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2024-06-14</td>
<td align="center">2024-06-15</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2024-06-14</td>
<td align="center">2024-06-15</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2024-06-14</td>
<td align="center">2024-06-15</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -194,7 +194,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.svg" class="logo" alt=""><h1>Data sets for download / own use</h1>
<h4 data-toc-skip class="date">14 June 2024</h4>
<h4 data-toc-skip class="date">15 June 2024</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small>
<div class="d-none name"><code>datasets.Rmd</code></div>
@ -1560,8 +1560,8 @@ column names:<br><em>date</em>, <em>patient</em>, <em>age</em>, <em>gender</em>,
<em>MUP</em>, and <em>RIF</em>.</p>
<p>This data set is in R available as <code>example_isolates</code>,
after you load the <code>AMR</code> package.</p>
<p>It was last updated on 9 June 2024 09:31:04 UTC. Find more info about
the structure of this data set <a href="https://msberends.github.io/AMR/reference/example_isolates.html">here</a>.</p>
<p>It was last updated on 15 June 2024 13:33:49 UTC. Find more info
about the structure of this data set <a href="https://msberends.github.io/AMR/reference/example_isolates.html">here</a>.</p>
<div class="section level3">
<h3 id="source-6">Source<a class="anchor" aria-label="anchor" href="#source-6"></a>
</h3>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -39,7 +39,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -779,7 +779,7 @@
<p>Manually, using:</p>
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"remotes"</span><span class="op">)</span> <span class="co"># if you haven't already</span></span>
<span><span class="fu">remotes</span><span class="fu">::</span><span class="fu">install_github</span><span class="op">(</span><span class="st">"msberends/AMR"</span><span class="op">)</span></span></code></pre></div>
<span><span class="fu">remotes</span><span class="fu">::</span><span class="fu"><a href="https://remotes.r-lib.org/reference/install_github.html" class="external-link">install_github</a></span><span class="op">(</span><span class="st">"msberends/AMR"</span><span class="op">)</span></span></code></pre></div>
</li>
<li>
<p>Automatically, using the <a href="https://ropensci.org/r-universe/" class="external-link">rOpenSci R-universe platform</a>, by adding <a href="https://msberends.r-universe.dev" class="external-link">our R-universe address</a> to your list of repositories (repos):</p>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -159,18 +159,18 @@
</div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="2.1.1.9049" id="amr-2119049">AMR 2.1.1.9049<a class="anchor" aria-label="anchor" href="#amr-2119049"></a></h2>
<h2 class="pkg-version" data-toc-text="2.1.1.9050" id="amr-2119050">AMR 2.1.1.9050<a class="anchor" aria-label="anchor" href="#amr-2119050"></a></h2>
<p><em>(this beta version will eventually become v3.0. Were happy to reach a new major milestone soon, which will be all about the new One Health support!)</em></p>
<div class="section level5">
<h5 id="a-new-milestone-one-health-support--human--veterinary--environmental-2-1-1-9049">A New Milestone: One Health Support (= Human + Veterinary + Environmental)<a class="anchor" aria-label="anchor" href="#a-new-milestone-one-health-support--human--veterinary--environmental-2-1-1-9049"></a></h5>
<h5 id="a-new-milestone-one-health-support--human--veterinary--environmental-2-1-1-9050">A New Milestone: One Health Support (= Human + Veterinary + Environmental)<a class="anchor" aria-label="anchor" href="#a-new-milestone-one-health-support--human--veterinary--environmental-2-1-1-9050"></a></h5>
<p>This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the <a href="https://www.upei.ca/avc" class="external-link">University of Prince Edward Island</a>, Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change.</p>
</div>
<div class="section level3">
<h3 id="breaking-2-1-1-9049">Breaking<a class="anchor" aria-label="anchor" href="#breaking-2-1-1-9049"></a></h3>
<h3 id="breaking-2-1-1-9050">Breaking<a class="anchor" aria-label="anchor" href="#breaking-2-1-1-9050"></a></h3>
<ul><li>Removed all functions and references that used the deprecated <code>rsi</code> class, which were all replaced with their <code>sir</code> equivalents over a year ago</li>
</ul></div>
<div class="section level3">
<h3 id="new-2-1-1-9049">New<a class="anchor" aria-label="anchor" href="#new-2-1-1-9049"></a></h3>
<h3 id="new-2-1-1-9050">New<a class="anchor" aria-label="anchor" href="#new-2-1-1-9050"></a></h3>
<ul><li>One Health implementation
<ul><li>Function <code><a href="../reference/as.sir.html">as.sir()</a></code> now has extensive support for animal breakpoints from CLSI. Use <code>breakpoint_type = "animal"</code> and set the <code>host</code> argument to a variable that contains animal species names.</li>
<li>The <code>clinical_breakpoints</code> data set contains all these breakpoints, and can be downloaded on our <a href="https://msberends.github.io/AMR/articles/datasets.html">download page</a>.</li>
@ -188,7 +188,7 @@
<li>Clinical breakpoints and intrinsic resistance of EUCAST 2024 and CLSI 2024 have been added to the <code>clinical_breakpoints</code> data set for usage in <code><a href="../reference/as.sir.html">as.sir()</a></code>. EUCAST 2024 (v14.0) is now the new default guideline for all MIC and disks diffusion interpretations.</li>
</ul></div>
<div class="section level3">
<h3 id="changed-2-1-1-9049">Changed<a class="anchor" aria-label="anchor" href="#changed-2-1-1-9049"></a></h3>
<h3 id="changed-2-1-1-9050">Changed<a class="anchor" aria-label="anchor" href="#changed-2-1-1-9050"></a></h3>
<ul><li>For SIR interpretation, it is now possible to use column names for argument <code>ab</code>, <code>mo</code>, and <code>uti</code>: <code>as.sir(..., ab = "column1", mo = "column2", uti = "column3")</code>. This greatly improves the flexibility for users.</li>
<li>Extended the antibiotic selectors with <code><a href="../reference/antibiotic_class_selectors.html">nitrofurans()</a></code> and <code><a href="../reference/antibiotic_class_selectors.html">rifamycins()</a></code>
</li>
@ -221,7 +221,7 @@
<li>Intermediate log2 levels used for MIC plotting are now more common values instead of following a strict dilution range</li>
</ul></div>
<div class="section level3">
<h3 id="other-2-1-1-9049">Other<a class="anchor" aria-label="anchor" href="#other-2-1-1-9049"></a></h3>
<h3 id="other-2-1-1-9050">Other<a class="anchor" aria-label="anchor" href="#other-2-1-1-9050"></a></h3>
<ul><li>Added Jordan Stull, Matthew Saab, and Javier Sanchez as contributors, to thank them for their valuable input</li>
</ul></div>
</div>

View File

@ -11,7 +11,7 @@ articles:
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
WHONET: WHONET.html
last_built: 2024-06-14T20:46Z
last_built: 2024-06-15T13:37Z
urls:
reference: https://msberends.github.io/AMR/reference
article: https://msberends.github.io/AMR/articles

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -24,7 +24,7 @@ The AMR package is available in English, Chinese, Czech, Danish, Dutch, Finnish,
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -222,16 +222,16 @@
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">df</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> birth_date age age_exact age_at_y2k</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 1965-12-05 58 58.52459 34</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1980-03-01 44 44.28689 19</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1949-11-01 74 74.61749 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1947-02-14 77 77.33060 52</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1940-02-19 84 84.31694 59</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1988-01-10 36 36.42623 11</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1997-08-27 26 26.79781 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1978-01-26 46 46.38251 21</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1972-06-17 51 51.99180 27</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1986-08-10 37 37.84426 13</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 1965-12-05 58 58.52732 34</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1980-03-01 44 44.28962 19</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1949-11-01 74 74.62022 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1947-02-14 77 77.33333 52</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1940-02-19 84 84.31967 59</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1988-01-10 36 36.42896 11</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1997-08-27 26 26.80055 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1978-01-26 46 46.38525 21</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1972-06-17 51 51.99454 27</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1986-08-10 37 37.84699 13</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -12,7 +12,7 @@ In short, if you have a column name that resembles an antimicrobial drug, it wil
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -326,784 +326,7 @@ In short, if you have a column name that resembles an antimicrobial drug, it wil
<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="co"># `example_isolates` is a data set available in the AMR package.</span></span></span>
<span class="r-in"><span><span class="co"># See ?example_isolates.</span></span></span>
<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></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Examples sections below are split into 'base R', 'dplyr', and 'data.table':</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># base R ------------------------------------------------------------------</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># select columns 'IPM' (imipenem) and 'MEM' (meropenem)</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span>, <span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span><span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 2</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> IPM MEM </span>
<span class="r-out co"><span class="r-pr">#&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> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> NA 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-in"><span></span></span>
<span class="r-in"><span><span class="co"># select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</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">"mo"</span>, <span class="fu">aminoglycosides</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> mo GEN TOB AMK KAN </span>
<span class="r-out co"><span class="r-pr">#&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> B_ESCHR_COLI NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> B_ESCHR_COLI NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> B_STPHY_AURS NA S NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> B_STPHY_AURS NA S NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> B_STPHY_EPDR NA NA NA 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-in"><span></span></span>
<span class="r-in"><span><span class="co"># select only antibiotic columns with DDDs for oral treatment</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span>, <span class="fu">administrable_per_os</span><span class="op">(</span><span class="op">)</span><span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For administrable_per_os() using columns 'OXA' (oxacillin), 'FLC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (flucloxacillin), 'AMX' (amoxicillin), 'AMC' (amoxicillin/clavulanic acid),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'AMP' (ampicillin), 'CXM' (cefuroxime), 'KAN' (kanamycin), 'TMP'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (trimethoprim), 'NIT' (nitrofurantoin), 'FOS' (fosfomycin), 'LNZ'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (linezolid), 'CIP' (ciprofloxacin), 'MFX' (moxifloxacin), 'VAN'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (vancomycin), 'TCY' (tetracycline), 'DOX' (doxycycline), 'ERY'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (erythromycin), 'CLI' (clindamycin), 'AZM' (azithromycin), 'MTR'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (metronidazole), 'CHL' (chloramphenicol), 'COL' (colistin), and 'RIF'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (rifampicin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 23</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> OXA FLC AMX AMC AMP CXM KAN TMP NIT FOS LNZ CIP MFX </span>
<span class="r-out co"><span class="r-pr">#&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 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 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 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> NA NA NA I NA I NA R NA NA R NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> NA NA NA I NA I NA R NA NA R NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> NA R NA NA NA R NA S NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> NA R NA NA NA R NA S NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> NA R NA NA NA R NA R NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> NA R NA NA NA R NA R NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> NA S R S R S NA R NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> NA S R S R S NA R NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> NA R NA NA NA R NA S NA NA NA S NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> NA S NA NA NA S NA S NA NA 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;"># 10 more variables: VAN &lt;sir&gt;, TCY &lt;sir&gt;, DOX &lt;sir&gt;, ERY &lt;sir&gt;, CLI &lt;sir&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># AZM &lt;sir&gt;, MTR &lt;sir&gt;, CHL &lt;sir&gt;, COL &lt;sir&gt;, RIF &lt;sir&gt;</span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># filter using any() or all()</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span>, <span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 55 × 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> 2004-06-09 529296 69 M ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2004-06-09 529296 69 M ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2004-11-03 D65308 80 F ICU B_STNTR_MLTP R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2005-04-21 452212 82 F ICU B_ENTRC NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2005-04-22 452212 82 F ICU B_ENTRC NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2005-04-22 452212 82 F ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2007-02-21 8BBC46 61 F Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2007-12-15 401043 72 M Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2008-01-22 1710B8 82 M Clinical B_PROTS_MRBL R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2008-01-22 1710B8 82 M Clinical B_PROTS_MRBL R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 45 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/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">example_isolates</span>, <span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 55 × 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> 2004-06-09 529296 69 M ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2004-06-09 529296 69 M ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2004-11-03 D65308 80 F ICU B_STNTR_MLTP R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2005-04-21 452212 82 F ICU B_ENTRC NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2005-04-22 452212 82 F ICU B_ENTRC NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2005-04-22 452212 82 F ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2007-02-21 8BBC46 61 F Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2007-12-15 401043 72 M Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2008-01-22 1710B8 82 M Clinical B_PROTS_MRBL R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2008-01-22 1710B8 82 M Clinical B_PROTS_MRBL R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 45 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></span>
<span class="r-in"><span><span class="co"># filter on any or all results in the carbapenem columns (i.e., IPM, MEM):</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span><span class="op">)</span>, <span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Filtering any of columns 'IPM' and 'MEM' to contain value "S", "I" or "R"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 962 × 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-19 738003 71 M 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-19 738003 71 M 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-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2002-02-05 067927 45 F ICU B_SERRT_MRCS R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2002-02-27 066895 85 F Clinical B_KLBSL_PNMN R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2002-02-27 066895 85 F Clinical B_KLBSL_PNMN R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2002-03-08 4FC193 69 M Clinical B_ESCHR_COLI R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 952 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="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/all.html" class="external-link">all</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span><span class="op">)</span>, <span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Filtering all of columns 'IPM' and 'MEM' to contain value "S", "I" or "R"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 756 × 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-04-14 F30196 73 M Outpat… B_STRPT_GRPB S NA S S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2003-04-08 114570 74 M ICU B_STRPT_PYGN S NA S S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2003-04-08 114570 74 M ICU B_STRPT_GRPA S NA S S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2003-04-08 114570 74 M ICU B_STRPT_GRPA S NA S S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2003-08-14 F71508 0 F Clinic… B_STRPT_GRPB S NA S S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2003-10-16 650870 63 F ICU B_ESCHR_COLI R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2003-10-20 F35553 52 M ICU B_ENTRBC_CLOC R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2003-10-20 F35553 52 M ICU B_ENTRBC_CLOC R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2003-11-04 2FC253 87 F ICU B_ESCHR_COLI R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2003-11-04 2FC253 87 F ICU B_ESCHR_COLI R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 746 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></span>
<span class="r-in"><span><span class="co"># filter with multiple antibiotic selectors using c()</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/all.html" class="external-link">all</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="fu">carbapenems</span><span class="op">(</span><span class="op">)</span>, <span class="fu">aminoglycosides</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span>, <span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 26 × 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> 2004-11-03 D65308 80 F ICU B_STNTR_MLTP R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2005-04-22 452212 82 F ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2007-02-21 8BBC46 61 F Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2007-12-15 401043 72 M Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2008-12-06 501361 43 F Clinical B_STNTR_MLTP R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2011-05-09 207325 82 F ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2012-03-12 582258 80 M ICU B_STPHY_CONS R R R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2012-05-19 C25552 89 F Outpati… B_STPHY_CONS R R R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2012-07-17 F05015 83 M ICU B_STPHY_CONS R R R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2012-07-20 404299 66 F Clinical B_STPHY_CONS R R R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 16 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></span>
<span class="r-in"><span><span class="co"># filter + select in one go: get penicillins in carbapenem-resistant strains</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span>, <span class="fu">penicillins</span><span class="op">(</span><span class="op">)</span><span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For penicillins() using columns 'PEN' (benzylpenicillin), 'OXA'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (oxacillin), 'FLC' (flucloxacillin), 'AMX' (amoxicillin), 'AMC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (amoxicillin/clavulanic acid), 'AMP' (ampicillin), and 'TZP'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (piperacillin/tazobactam)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 55 × 7</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> PEN OXA FLC AMX AMC AMP TZP </span>
<span class="r-out co"><span class="r-pr">#&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 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> NA NA NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> NA NA NA NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> R NA NA R R R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> NA NA NA NA NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> NA NA NA NA NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> NA NA NA NA NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> NA NA NA NA NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> NA NA NA NA NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> R NA NA NA S NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> R NA NA NA S NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 45 more rows</span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># You can combine selectors with '&amp;' to be more specific. For example,</span></span></span>
<span class="r-in"><span><span class="co"># penicillins() would select benzylpenicillin ('peni G') and</span></span></span>
<span class="r-in"><span><span class="co"># administrable_per_os() would select erythromycin. Yet, when combined these</span></span></span>
<span class="r-in"><span><span class="co"># drugs are both omitted since benzylpenicillin is not administrable per os</span></span></span>
<span class="r-in"><span><span class="co"># and erythromycin is not a penicillin:</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span>, <span class="fu">penicillins</span><span class="op">(</span><span class="op">)</span> <span class="op">&amp;</span> <span class="fu">administrable_per_os</span><span class="op">(</span><span class="op">)</span><span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For penicillins() using columns 'PEN' (benzylpenicillin), 'OXA'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (oxacillin), 'FLC' (flucloxacillin), 'AMX' (amoxicillin), 'AMC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (amoxicillin/clavulanic acid), 'AMP' (ampicillin), and 'TZP'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (piperacillin/tazobactam)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For administrable_per_os() using columns 'OXA' (oxacillin), 'FLC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (flucloxacillin), 'AMX' (amoxicillin), 'AMC' (amoxicillin/clavulanic acid),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'AMP' (ampicillin), 'CXM' (cefuroxime), 'KAN' (kanamycin), 'TMP'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (trimethoprim), 'NIT' (nitrofurantoin), 'FOS' (fosfomycin), 'LNZ'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (linezolid), 'CIP' (ciprofloxacin), 'MFX' (moxifloxacin), 'VAN'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (vancomycin), 'TCY' (tetracycline), 'DOX' (doxycycline), 'ERY'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (erythromycin), 'CLI' (clindamycin), 'AZM' (azithromycin), 'MTR'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (metronidazole), 'CHL' (chloramphenicol), 'COL' (colistin), and 'RIF'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (rifampicin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> OXA FLC AMX AMC AMP </span>
<span class="r-out co"><span class="r-pr">#&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 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> NA NA NA I NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> NA NA NA I NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> NA S R S R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> NA S R S R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> NA S NA NA 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-in"><span></span></span>
<span class="r-in"><span><span class="co"># ab_selector() applies a filter in the `antibiotics` data set and is thus</span></span></span>
<span class="r-in"><span><span class="co"># very flexible. For instance, to select antibiotic columns with an oral DDD</span></span></span>
<span class="r-in"><span><span class="co"># of at least 1 gram:</span></span></span>
<span class="r-in"><span><span class="va">example_isolates</span><span class="op">[</span>, <span class="fu">ab_selector</span><span class="op">(</span><span class="va">oral_ddd</span> <span class="op">&gt;</span> <span class="fl">1</span> <span class="op">&amp;</span> <span class="va">oral_units</span> <span class="op">==</span> <span class="st">"g"</span><span class="op">)</span><span class="op">]</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For ab_selector(oral_ddd &gt; 1 &amp; oral_units == "g") using columns 'OXA'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (oxacillin), 'FLC' (flucloxacillin), 'AMX' (amoxicillin), 'AMC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (amoxicillin/clavulanic acid), 'AMP' (ampicillin), 'KAN' (kanamycin), 'FOS'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (fosfomycin), 'LNZ' (linezolid), 'VAN' (vancomycin), 'ERY' (erythromycin),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'CLI' (clindamycin), 'MTR' (metronidazole), and 'CHL' (chloramphenicol)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 13</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> OXA FLC AMX AMC AMP KAN FOS LNZ VAN ERY CLI MTR CHL </span>
<span class="r-out co"><span class="r-pr">#&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 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 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 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> NA NA NA I NA NA NA R R R R NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> NA NA NA I NA NA NA R R R R NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> NA R NA NA NA NA NA NA S R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> NA R NA NA NA NA NA NA S R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> NA R NA NA NA NA NA NA S R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> NA R NA NA NA NA NA NA S R R NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> NA S R S R NA NA NA S S NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> NA S R S R NA NA NA S S NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> NA R NA NA NA NA NA NA S R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> NA S NA NA NA NA NA NA S S NA NA 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-in"><span></span></span>
<span class="r-in"><span><span class="co"># \donttest{</span></span></span>
<span class="r-in"><span><span class="co"># dplyr -------------------------------------------------------------------</span></span></span>
<span class="r-in"><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="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html" class="external-link">tibble</a></span><span class="op">(</span>kefzol <span class="op">=</span> <span class="fu"><a href="random.html">random_sir</a></span><span class="op">(</span><span class="fl">5</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"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="fu">cephalosporins</span><span class="op">(</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-msg co"><span class="r-pr">#&gt;</span> For cephalosporins() using column 'kefzol' (cefazolin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 5 × 1</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> kefzol</span>
<span class="r-out co"><span class="r-pr">#&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> S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">5</span> I </span>
<span class="r-in"><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"># get AMR for all aminoglycosides e.g., per ward:</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/group_by.html" class="external-link">group_by</a></span><span class="op">(</span><span class="va">ward</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"><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">summarise</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">aminoglycosides</span><span class="op">(</span><span class="op">)</span>, <span class="va">resistance</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-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>There was 1 warning in `summarise()`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #00BBBB;"></span> In argument: `across(aminoglycosides(), resistance)`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #00BBBB;"></span> In group 3: `ward = "Outpatient"`.</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> Introducing NA: only 23 results available for KAN in group: ward =</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> "Outpatient" (minimum = 30).</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 3 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward GEN TOB AMK KAN</span>
<span class="r-out co"><span class="r-pr">#&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;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clinical 0.229 0.315 0.626 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 0.290 0.400 0.662 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 0.2 0.368 0.605 <span style="color: #BB0000;">NA</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"># You can combine selectors with '&amp;' to be more specific:</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/select.html" class="external-link">select</a></span><span class="op">(</span><span class="fu">penicillins</span><span class="op">(</span><span class="op">)</span> <span class="op">&amp;</span> <span class="fu">administrable_per_os</span><span class="op">(</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-msg co"><span class="r-pr">#&gt;</span> For penicillins() using columns 'PEN' (benzylpenicillin), 'OXA'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (oxacillin), 'FLC' (flucloxacillin), 'AMX' (amoxicillin), 'AMC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (amoxicillin/clavulanic acid), 'AMP' (ampicillin), and 'TZP'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (piperacillin/tazobactam)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For administrable_per_os() using columns 'OXA' (oxacillin), 'FLC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (flucloxacillin), 'AMX' (amoxicillin), 'AMC' (amoxicillin/clavulanic acid),</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> 'AMP' (ampicillin), 'CXM' (cefuroxime), 'KAN' (kanamycin), 'TMP'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (trimethoprim), 'NIT' (nitrofurantoin), 'FOS' (fosfomycin), 'LNZ'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (linezolid), 'CIP' (ciprofloxacin), 'MFX' (moxifloxacin), 'VAN'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (vancomycin), 'TCY' (tetracycline), 'DOX' (doxycycline), 'ERY'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (erythromycin), 'CLI' (clindamycin), 'AZM' (azithromycin), 'MTR'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (metronidazole), 'CHL' (chloramphenicol), 'COL' (colistin), and 'RIF'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (rifampicin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> OXA FLC AMX AMC AMP </span>
<span class="r-out co"><span class="r-pr">#&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 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> NA NA NA I NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> NA NA NA I NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> NA S R S R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> NA S R S R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> NA R NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> NA S NA NA 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-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"># get AMR for only drugs that matter - no intrinsic resistance:</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/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu"><a href="mo_property.html">mo_genus</a></span><span class="op">(</span><span class="op">)</span> <span class="op"><a href="https://rdrr.io/r/base/match.html" class="external-link">%in%</a></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">"Escherichia"</span>, <span class="st">"Klebsiella"</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"><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by</a></span><span class="op">(</span><span class="va">ward</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"><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">summarise</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">not_intrinsic_resistant</span><span class="op">(</span><span class="op">)</span>, <span class="va">resistance</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-msg co"><span class="r-pr">#&gt;</span> Using column 'mo' as input for mo_genus()</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For not_intrinsic_resistant() removing columns 'PEN'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (benzylpenicillin), 'LNZ' (linezolid), 'VAN' (vancomycin), 'TEC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (teicoplanin), 'ERY' (erythromycin), 'CLI' (clindamycin), 'AZM'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (azithromycin), and 'RIF' (rifampicin)</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>There were 52 warnings in `summarise()`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> The first warning was:</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #00BBBB;"></span> In argument: `across(not_intrinsic_resistant(), resistance)`.</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #00BBBB;"></span> In group 1: `ward = "Clinical"`.</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> Introducing NA: no results available for OXA in group: ward = "Clinical"</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> (minimum = 30).</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span style="color: #00BBBB;"></span> Run `dplyr::last_dplyr_warnings()` to see the 51 remaining warnings.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 3 × 33</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward OXA FLC AMX AMC AMP TZP CZO FEP CXM FOX</span>
<span class="r-out co"><span class="r-pr">#&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;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clin… <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 0.606 0.121 0.606 0.050<span style="text-decoration: underline;">4</span> 0.065<span style="text-decoration: underline;">6</span> 0.015<span style="text-decoration: underline;">9</span> 0.062<span style="text-decoration: underline;">2</span> 0.064<span style="text-decoration: underline;">8</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> 0.535 0.172 0.535 0.119 <span style="color: #BB0000;">NA</span> 0.072<span style="text-decoration: underline;">2</span> 0.082<span style="text-decoration: underline;">8</span> 0.099<span style="text-decoration: underline;">2</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outp… <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 22 more variables: CTX &lt;dbl&gt;, CAZ &lt;dbl&gt;, CRO &lt;dbl&gt;, GEN &lt;dbl&gt;, TOB &lt;dbl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># AMK &lt;dbl&gt;, KAN &lt;dbl&gt;, TMP &lt;dbl&gt;, SXT &lt;dbl&gt;, NIT &lt;dbl&gt;, FOS &lt;dbl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># CIP &lt;dbl&gt;, MFX &lt;dbl&gt;, TCY &lt;dbl&gt;, TGC &lt;dbl&gt;, DOX &lt;dbl&gt;, IPM &lt;dbl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># MEM &lt;dbl&gt;, MTR &lt;dbl&gt;, CHL &lt;dbl&gt;, COL &lt;dbl&gt;, MUP &lt;dbl&gt;</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"># get susceptibility for antibiotics whose name contains "trim":</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/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu"><a href="first_isolate.html">first_isolate</a></span><span class="op">(</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"><a href="https://dplyr.tidyverse.org/reference/group_by.html" class="external-link">group_by</a></span><span class="op">(</span><span class="va">ward</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"><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">summarise</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">ab_selector</span><span class="op">(</span><span class="va">name</span> <span class="op"><a href="like.html">%like%</a></span> <span class="st">"trim"</span><span class="op">)</span>, <span class="va">susceptibility</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-msg co"><span class="r-pr">#&gt;</span> For ab_selector(name %like% "trim") using columns 'TMP' (trimethoprim)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> and 'SXT' (trimethoprim/sulfamethoxazole)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 3 × 3</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward TMP SXT</span>
<span class="r-out co"><span class="r-pr">#&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;dbl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clinical 0.627 0.807</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 0.551 0.780</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 0.667 0.821</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"># this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):</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/select.html" class="external-link">select</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</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-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 2</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> IPM MEM </span>
<span class="r-out co"><span class="r-pr">#&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> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> NA 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-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"># this will select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB':</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/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">mo</span>, <span class="fu">aminoglycosides</span><span class="op">(</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-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> mo GEN TOB AMK KAN </span>
<span class="r-out co"><span class="r-pr">#&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> B_ESCHR_COLI NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> B_ESCHR_COLI NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> B_STPHY_AURS NA S NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> B_STPHY_AURS NA S NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> B_STPHY_EPDR NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> B_STPHY_EPDR NA NA NA 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-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"># any() and all() work in dplyr's filter() too:</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/filter.html" class="external-link">filter</a></span><span class="op">(</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu">aminoglycosides</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/all.html" class="external-link">all</a></span><span class="op">(</span><span class="fu">cephalosporins_2nd</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span></span></span>
<span class="r-in"><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> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For cephalosporins_2nd() using columns 'CXM' (cefuroxime) and 'FOX'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (cefoxitin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 112 × 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-02-21 4FC193 69 M Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2002-03-16 4FC193 69 M Clinical B_PSDMN_AERG R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2002-04-08 130252 78 M ICU B_ENTRC_FCLS NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2002-06-23 798871 82 M Clinical B_ENTRC_FCLS NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2002-06-23 798871 82 M Clinical B_ENTRC_FCLS NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2002-07-21 955940 82 F Clinical B_PSDMN_AERG R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2002-07-21 955940 82 F Clinical B_PSDMN_AERG R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2003-08-13 F35553 52 M ICU B_ENTRC_FCLS NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2003-09-05 F35553 52 M ICU B_ENTRC_FCLS NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2004-06-09 529296 69 M ICU B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 102 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="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"># also works with c():</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/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</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="fu">carbapenems</span><span class="op">(</span><span class="op">)</span>, <span class="fu">aminoglycosides</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</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-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 531 × 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-02-21 4FC193 69 M Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2002-03-16 4FC193 69 M Clinical B_PSDMN_AERG R NA NA R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2002-03-17 B30560 78 M Clinical B_STPHY_CONS R NA R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2002-04-04 E61143 67 M Clinical B_STRPT_SNGN S NA NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2002-04-08 130252 78 M ICU B_ENTRC_FCLS NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2002-04-14 F30196 73 M Outpati… B_STRPT_GRPB S NA S S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2002-05-07 D91570 83 M Clinical B_STPHY_CONS R NA R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2002-05-07 D91570 83 M Clinical B_STPHY_CONS R NA R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2002-05-14 077552 86 F Clinical B_STRPT_PNMN S NA NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2002-05-14 077552 86 F Clinical B_STRPT_PNMN S NA NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 521 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="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"># not setting any/all will automatically apply all():</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/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu">aminoglycosides</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</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> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming a filter on all 4 aminoglycosides. Wrap around all() or</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> any() to prevent this note.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 427 × 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-02-21 4FC193 69 M Clinical B_ENTRC_FACM NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2002-03-17 B30560 78 M Clinical B_STPHY_CONS R NA R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2002-04-04 E61143 67 M Clinical B_STRPT_SNGN S NA NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2002-04-08 130252 78 M ICU B_ENTRC_FCLS NA NA NA NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2002-04-14 F30196 73 M Outpati… B_STRPT_GRPB S NA S S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2002-05-07 D91570 83 M Clinical B_STPHY_CONS R NA R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2002-05-07 D91570 83 M Clinical B_STPHY_CONS R NA R R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2002-05-14 077552 86 F Clinical B_STRPT_PNMN S NA NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2002-05-14 077552 86 F Clinical B_STRPT_PNMN S NA NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2002-05-16 D25302 65 F ICU B_STRPT_ANGN S NA NA S </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 417 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="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"># this will select columns 'mo' and all antimycobacterial drugs ('RIF'):</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/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">mo</span>, <span class="fu">ab_class</span><span class="op">(</span><span class="st">"mycobact"</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-msg co"><span class="r-pr">#&gt;</span> For ab_class("mycobact") using column 'RIF' (rifampicin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2,000 × 2</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> mo RIF </span>
<span class="r-out co"><span class="r-pr">#&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>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> B_ESCHR_COLI R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> B_ESCHR_COLI R </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> B_STPHY_EPDR NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> B_STPHY_EPDR NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> B_STPHY_EPDR NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> B_STPHY_EPDR NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> B_STPHY_AURS NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> B_STPHY_AURS NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> B_STPHY_EPDR NA </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> B_STPHY_EPDR 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-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"># get bug/drug combinations for only glycopeptides in Gram-positives:</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/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu"><a href="mo_property.html">mo_is_gram_positive</a></span><span class="op">(</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"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">mo</span>, <span class="fu">glycopeptides</span><span class="op">(</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"><a href="bug_drug_combinations.html">bug_drug_combinations</a></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"><a href="https://rdrr.io/r/base/format.html" class="external-link">format</a></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-msg co"><span class="r-pr">#&gt;</span> Using column 'mo' as input for mo_is_gram_positive()</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For glycopeptides() using columns 'VAN' (vancomycin) and 'TEC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (teicoplanin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 2 × 8</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Group Drug CoNS `E. faecalis` `S. aureus` `S. epidermidis` `S. hominis`</span>
<span class="r-out co"><span class="r-pr">#&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;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;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> <span style="color: #949494;">"</span>Glycopep… Teic… <span style="color: #949494;">""</span> <span style="color: #949494;">""</span> <span style="color: #949494;">"</span> 0.0% (0/… <span style="color: #949494;">"</span>64.1% (25/39)<span style="color: #949494;">"</span> <span style="color: #949494;">"</span> 6.8% (4/5…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> <span style="color: #949494;">""</span> Vanc… <span style="color: #949494;">"</span> 0.… <span style="color: #949494;">"</span> 0.0% (0/39… <span style="color: #949494;">"</span> 0.0% (0/… <span style="color: #949494;">"</span> 0.0% (0/171)<span style="color: #949494;">"</span> <span style="color: #949494;">"</span> 0.0% (0/8…</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 1 more variable: `S. pneumoniae` &lt;chr&gt;</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="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> some_column <span class="op">=</span> <span class="st">"some_value"</span>,</span></span>
<span class="r-in"><span> J01CA01 <span class="op">=</span> <span class="st">"S"</span></span></span>
<span class="r-in"><span> <span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span> <span class="co"># ATC code of ampicillin</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="fu">penicillins</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="co"># only the 'J01CA01' column will be selected</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> For penicillins() using column 'J01CA01' (ampicillin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> J01CA01</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 S</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"># with recent versions of dplyr, this is all equal:</span></span></span>
<span class="r-in"><span> <span class="va">x</span> <span class="op">&lt;-</span> <span class="va">example_isolates</span><span class="op">[</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span>, <span class="op">]</span></span></span>
<span class="r-in"><span> <span class="va">y</span> <span class="op">&lt;-</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 class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">z</span> <span class="op">&lt;-</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 class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html" class="external-link">filter</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html" class="external-link">if_all</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span>, <span class="op">~</span> <span class="va">.x</span> <span class="op">==</span> <span class="st">"R"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/identical.html" class="external-link">identical</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">y</span><span class="op">)</span> <span class="op">&amp;&amp;</span> <span class="fu"><a href="https://rdrr.io/r/base/identical.html" class="external-link">identical</a></span><span class="op">(</span><span class="va">y</span>, <span class="va">z</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> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming a filter on all 2 carbapenems. Wrap around all() or any() to</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> prevent this note.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Assuming a filter on all 2 carbapenems. Wrap around all() or any() to</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> prevent this note.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># data.table --------------------------------------------------------------</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># data.table is supported as well, just use it in the same way as with</span></span></span>
<span class="r-in"><span><span class="co"># base R, but add `with = FALSE` if using a single AB selector.</span></span></span>
<span class="r-in"><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://r-datatable.com" class="external-link">"data.table"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">dt</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdatatable.gitlab.io/data.table/reference/as.data.table.html" class="external-link">as.data.table</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="co"># this does not work, it returns column *names*</span></span></span>
<span class="r-in"><span> <span class="va">dt</span><span class="op">[</span>, <span class="fu">carbapenems</span><span class="op">(</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-msg co"><span class="r-pr">#&gt;</span> Loading required package: data.table</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Attaching package: data.table</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> The following objects are masked from package:dplyr:</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> between, first, last</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> The following objects are masked from package:AMR:</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> %like%, like</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "IPM" "MEM"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> attr(,"class")</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "ab_selector" "character" </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://r-datatable.com" class="external-link">"data.table"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="co"># so `with = FALSE` is required</span></span></span>
<span class="r-in"><span> <span class="va">dt</span><span class="op">[</span>, <span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span>, with <span class="op">=</span> <span class="cn">FALSE</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> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> IPM MEM</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1996: &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1997: S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1998: S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1999: S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2000: S S</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># for multiple selections or AB selectors, `with = FALSE` is not needed:</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://r-datatable.com" class="external-link">"data.table"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">dt</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">"mo"</span>, <span class="fu">aminoglycosides</span><span class="op">(</span><span class="op">)</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-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> mo GEN TOB AMK KAN</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;mo&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: B_ESCHR_COLI &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: B_ESCHR_COLI &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: B_STPHY_EPDR &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: B_STPHY_EPDR &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: B_STPHY_EPDR &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1996: B_STRPT_PNMN R R R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1997: B_ESCHR_COLI S S S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1998: B_STPHY_CONS S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1999: B_ESCHR_COLI S S &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2000: B_KLBSL_PNMN S S &lt;NA&gt; &lt;NA&gt;</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://r-datatable.com" class="external-link">"data.table"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">dt</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">carbapenems</span><span class="op">(</span><span class="op">)</span>, <span class="fu">aminoglycosides</span><span class="op">(</span><span class="op">)</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-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For aminoglycosides() using columns 'GEN' (gentamicin), 'TOB'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> IPM MEM GEN TOB AMK KAN</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1996: &lt;NA&gt; &lt;NA&gt; R R R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1997: S S S S S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1998: S S S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1999: S S S S &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2000: S S S S &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># row filters are also supported:</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://r-datatable.com" class="external-link">"data.table"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">dt</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"S"</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-msg co"><span class="r-pr">#&gt;</span> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> date patient age gender ward mo PEN OXA FLC</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;Date&gt; &lt;char&gt; &lt;num&gt; &lt;char&gt; &lt;char&gt; &lt;mo&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: 2002-01-19 738003 71 M Clinical B_ESCHR_COLI R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: 2002-01-22 F35553 50 M ICU B_PROTS_MRBL R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: 2002-02-05 067927 45 F ICU B_SERRT_MRCS R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 905: 2005-04-12 D71461 70 M ICU B_ESCHR_COLI R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 906: 2009-11-12 650870 69 F Outpatient B_ESCHR_COLI R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 907: 2012-06-14 8CBCF2 41 F Clinical B_STPHY_CONS R S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 908: 2012-10-11 175532 78 M Clinical B_ESCHR_COLI R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 909: 2013-11-23 A97263 77 M Clinical B_KLBSL_PNMN R &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> AMX AMC AMP TZP CZO FEP CXM FOX CTX CAZ CRO GEN</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S &lt;NA&gt; S &lt;NA&gt; S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S &lt;NA&gt; S &lt;NA&gt; S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S &lt;NA&gt; S S S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S &lt;NA&gt; S S S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: R R R &lt;NA&gt; R &lt;NA&gt; R R &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 905: S S S S &lt;NA&gt; S S S S S S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 906: S S S S S S S S S S S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 907: &lt;NA&gt; S &lt;NA&gt; &lt;NA&gt; S S S S S R S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 908: R S R S &lt;NA&gt; S R R S S S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 909: R S R S &lt;NA&gt; S S S S S S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> TOB AMK KAN TMP SXT NIT FOS LNZ CIP MFX VAN TEC</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: S &lt;NA&gt; &lt;NA&gt; S S &lt;NA&gt; &lt;NA&gt; R &lt;NA&gt; &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: S &lt;NA&gt; &lt;NA&gt; S S &lt;NA&gt; &lt;NA&gt; R &lt;NA&gt; &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S S R &lt;NA&gt; R S &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S S R &lt;NA&gt; R S &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S S R &lt;NA&gt; R S &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 905: S S &lt;NA&gt; &lt;NA&gt; S S &lt;NA&gt; R S &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 906: S S &lt;NA&gt; S S S &lt;NA&gt; R S &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 907: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S &lt;NA&gt; S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 908: S &lt;NA&gt; &lt;NA&gt; R R R &lt;NA&gt; R R R R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 909: S &lt;NA&gt; &lt;NA&gt; S S S &lt;NA&gt; R S &lt;NA&gt; R R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> TCY TGC DOX ERY CLI AZM IPM MEM MTR CHL COL MUP</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R R R S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R R R S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: R R R R R R S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: R R R R R R S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: R R R R R R S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 905: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R R R S S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 906: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R R R S S &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 907: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; S S S S S &lt;NA&gt; &lt;NA&gt; R &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 908: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R R R S S &lt;NA&gt; &lt;NA&gt; S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 909: &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; R R R S S &lt;NA&gt; &lt;NA&gt; S &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> RIF</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 905: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 906: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 907: &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 908: R</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 909: R</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://r-datatable.com" class="external-link">"data.table"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="va">dt</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/any.html" class="external-link">any</a></span><span class="op">(</span><span class="fu">carbapenems</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="st">"S"</span><span class="op">)</span>, <span class="fu">penicillins</span><span class="op">(</span><span class="op">)</span>, with <span class="op">=</span> <span class="cn">FALSE</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> For carbapenems() using columns 'IPM' (imipenem) and 'MEM' (meropenem)</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> For penicillins() using columns 'PEN' (benzylpenicillin), 'OXA'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (oxacillin), 'FLC' (flucloxacillin), 'AMX' (amoxicillin), 'AMC'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (amoxicillin/clavulanic acid), 'AMP' (ampicillin), and 'TZP'</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> (piperacillin/tazobactam)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> PEN OXA FLC AMX AMC AMP TZP</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt; &lt;sir&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1: R &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2: R &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3: R &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4: R &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; I &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5: R &lt;NA&gt; &lt;NA&gt; R R R &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> --- </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 905: R &lt;NA&gt; &lt;NA&gt; S S S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 906: R &lt;NA&gt; &lt;NA&gt; S S S S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 907: R S S &lt;NA&gt; S &lt;NA&gt; &lt;NA&gt;</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 908: R &lt;NA&gt; &lt;NA&gt; R S R S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 909: R &lt;NA&gt; &lt;NA&gt; R S R S</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"><h2>On this page</h2>
</nav></aside></div>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -242,7 +242,7 @@
<span id="cb1-13"><a href="#cb1-13" tabindex="-1"></a><span class="co">#&gt; 10 16 A</span></span></code></pre><p></p></div>
<p>All so-called <a href="https://rdrr.io/r/base/groupGeneric.html" class="external-link">group generic functions</a> are implemented for the MIC class (such as <code>!</code>, <code>!=</code>, <code>&lt;</code>, <code>&gt;=</code>, <code><a href="https://rdrr.io/r/base/Log.html" class="external-link">exp()</a></code>, <code><a href="https://rdrr.io/r/base/Log.html" class="external-link">log2()</a></code>). Some functions of the <code>stats</code> package are also implemented (such as <code><a href="https://rdrr.io/r/stats/quantile.html" class="external-link">quantile()</a></code>, <code><a href="https://rdrr.io/r/stats/median.html" class="external-link">median()</a></code>, <code><a href="https://rdrr.io/r/stats/fivenum.html" class="external-link">fivenum()</a></code>). Since <code><a href="https://rdrr.io/r/stats/sd.html" class="external-link">sd()</a></code> and <code><a href="https://rdrr.io/r/stats/cor.html" class="external-link">var()</a></code> are non-generic functions, these could not be extended. Use <code><a href="https://rdrr.io/r/stats/mad.html" class="external-link">mad()</a></code> as an alternative, or use e.g. <code>sd(as.numeric(x))</code> where <code>x</code> is your vector of MIC values.</p>
<p>Using <code><a href="https://rdrr.io/r/base/double.html" class="external-link">as.double()</a></code> or <code><a href="https://rdrr.io/r/base/numeric.html" class="external-link">as.numeric()</a></code> on MIC values will remove the operators and return a numeric vector. Do <strong>not</strong> use <code><a href="https://rdrr.io/r/base/integer.html" class="external-link">as.integer()</a></code> on MIC values as by the <span style="R">R</span> convention on <a href="https://rdrr.io/r/base/factor.html" class="external-link">factor</a>s, it will return the index of the factor levels (which is often useless for regular users).</p>
<p>Use <code><a href="https://rdatatable.gitlab.io/data.table/reference/fdroplevels.html" class="external-link">droplevels()</a></code> to drop unused levels. At default, it will return a plain factor. Use <code>droplevels(..., as.mic = TRUE)</code> to maintain the <code>mic</code> class.</p>
<p>Use <code><a href="https://rdrr.io/r/base/droplevels.html" class="external-link">droplevels()</a></code> to drop unused levels. At default, it will return a plain factor. Use <code>droplevels(..., as.mic = TRUE)</code> to maintain the <code>mic</code> class.</p>
<p>With <code>rescale_mic()</code>, existing MIC ranges can be limited to a defined range of MIC values. This can be useful to better compare MIC distributions.</p>
<p>For <code>ggplot2</code>, use one of the <code><a href="plot.html">scale_*_mic()</a></code> functions to plot MIC values. They allows custom MIC ranges and to plot intermediate log2 levels for missing MIC values.</p>
<p><code>NA_mic_</code> is a missing value of the new <code>mic</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>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -24,7 +24,7 @@ All breakpoints used for interpretation are available in our clinical_breakpoint
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -567,6 +567,52 @@ A microorganism is categorised as "Resistant" when there is a high likelihood of
<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"># \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</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</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</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</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">AMP</span><span class="op">:</span><span class="va">TOB</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</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">AMP</span><span class="op">:</span><span class="va">TOB</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</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>, mo <span class="op">=</span> <span class="st">"column1"</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</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></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>, mo <span class="op">=</span> <span class="st">"column1"</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</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">AMP</span><span class="op">:</span><span class="va">TOB</span><span class="op">)</span>, <span class="va">as.sir</span>, mo <span class="op">=</span> <span class="st">"column1"</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</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">AMP</span><span class="op">:</span><span class="va">TOB</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>, mo <span class="op">=</span> <span class="st">"column1"</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</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>, guideline <span class="op">=</span> <span class="st">"CLSI"</span>, host <span class="op">=</span> <span class="st">"species_column"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df</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>, guideline <span class="op">=</span> <span class="st">"CLSI"</span>, host <span class="op">=</span> <span class="st">"horse"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df</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></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>, guideline <span class="op">=</span> <span class="st">"CLSI"</span>, host <span class="op">=</span> <span class="st">"species_column"</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df</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">AMP</span><span class="op">:</span><span class="va">TOB</span><span class="op">)</span>, <span class="va">as.sir</span>, guideline <span class="op">=</span> <span class="st">"CLSI"</span>, host <span class="op">=</span> <span class="st">"species_column"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="va">df</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">AMP</span><span class="op">:</span><span class="va">TOB</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>, mo <span class="op">=</span> <span class="st">"column1"</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</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">AMP</span><span class="op">:</span><span class="va">TOB</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-err co"><span class="r-pr">#&gt;</span> <span class="error">Error in UseMethod("tbl_vars"):</span> no applicable method for 'tbl_vars' applied to an object of class "function"</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="co"># a whole data set, even with combined MIC values and disk zones</span></span></span>
<span class="r-in"><span><span class="va">df</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>
@ -600,24 +646,24 @@ A microorganism is categorised as "Resistant" when there is a high likelihood of
<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: 13 × 14</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> datetime index ab_user mo_user ab mo input</span>
<span class="r-out co"><span class="r-pr">#&gt;</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;ab&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;dbl&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 2024-06-14 <span style="color: #949494;">20:46:45</span> 1 TOB Escherich… TOB B_[ORD]_ENTRBCTR 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2024-06-14 <span style="color: #949494;">20:46:45</span> 1 GEN Escherich… GEN B_[ORD]_ENTRBCTR 18 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2024-06-14 <span style="color: #949494;">20:46:45</span> 1 CIP Escherich… CIP B_[ORD]_ENTRBCTR 0.256</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2024-06-14 <span style="color: #949494;">20:46:45</span> 1 AMP Escherich… AMP B_[ORD]_ENTRBCTR 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2024-06-14 <span style="color: #949494;">20:46:40</span> 1 AMX B_STRPT_P… AMX B_STRPT_PNMN 0.01 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2024-06-14 <span style="color: #949494;">20:46:40</span> 2 AMX B_STRPT_P… AMX B_STRPT_PNMN 2 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2024-06-14 <span style="color: #949494;">20:46:40</span> 3 AMX B_STRPT_P… AMX B_STRPT_PNMN 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2024-06-14 <span style="color: #949494;">20:46:40</span> 4 AMX B_STRPT_P… AMX B_STRPT_PNMN 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2024-06-14 <span style="color: #949494;">20:46:40</span> 1 AMX B_STRPT_P… AMX B_STRPT_PNMN 2 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2024-06-14 <span style="color: #949494;">20:46:40</span> 1 TOB Escherich… TOB B_[ORD]_ENTRBCTR 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">11</span> 2024-06-14 <span style="color: #949494;">20:46:40</span> 1 GEN Escherich… GEN B_[ORD]_ENTRBCTR 18 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">12</span> 2024-06-14 <span style="color: #949494;">20:46:39</span> 1 AMP Escherich… AMP B_[ORD]_ENTRBCTR 20 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">13</span> 2024-06-14 <span style="color: #949494;">20:46:39</span> 1 ampicillin Strep pneu AMP B_STRPT_PNMN 18 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 7 more variables: outcome &lt;sir&gt;, method &lt;chr&gt;, breakpoint_S_R &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># guideline &lt;chr&gt;, host &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;"># A tibble: 13 × 15</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> datetime index ab_user mo_user ab mo method</span>
<span class="r-out co"><span class="r-pr">#&gt;</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;ab&gt;</span> <span style="color: #949494; font-style: italic;">&lt;mo&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 2024-06-15 <span style="color: #949494;">13:38:22</span> 1 TOB Escherich… TOB B_[ORD]_ENTRBCTR DISK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 2024-06-15 <span style="color: #949494;">13:38:22</span> 1 GEN Escherich… GEN B_[ORD]_ENTRBCTR DISK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 2024-06-15 <span style="color: #949494;">13:38:22</span> 1 CIP Escherich… CIP B_[ORD]_ENTRBCTR MIC </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 2024-06-15 <span style="color: #949494;">13:38:22</span> 1 AMP Escherich… AMP B_[ORD]_ENTRBCTR MIC </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 2024-06-15 <span style="color: #949494;">13:38:18</span> 1 AMX B_STRPT_P… AMX B_STRPT_PNMN MIC </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 2024-06-15 <span style="color: #949494;">13:38:18</span> 2 AMX B_STRPT_P… AMX B_STRPT_PNMN MIC </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 2024-06-15 <span style="color: #949494;">13:38:18</span> 3 AMX B_STRPT_P… AMX B_STRPT_PNMN MIC </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 2024-06-15 <span style="color: #949494;">13:38:18</span> 4 AMX B_STRPT_P… AMX B_STRPT_PNMN MIC </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 2024-06-15 <span style="color: #949494;">13:38:18</span> 1 AMX B_STRPT_P… AMX B_STRPT_PNMN MIC </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 2024-06-15 <span style="color: #949494;">13:38:17</span> 1 TOB Escherich… TOB B_[ORD]_ENTRBCTR DISK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">11</span> 2024-06-15 <span style="color: #949494;">13:38:17</span> 1 GEN Escherich… GEN B_[ORD]_ENTRBCTR DISK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">12</span> 2024-06-15 <span style="color: #949494;">13:38:17</span> 1 AMP Escherich… AMP B_[ORD]_ENTRBCTR DISK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">13</span> 2024-06-15 <span style="color: #949494;">13:38:17</span> 1 ampicillin Strep pneu AMP B_STRPT_PNMN DISK </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 8 more variables: input &lt;dbl&gt;, outcome &lt;sir&gt;, host &lt;chr&gt;, notes &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># guideline &lt;chr&gt;, ref_table &lt;chr&gt;, uti &lt;lgl&gt;, 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>
@ -652,172 +698,11 @@ A microorganism is categorised as "Resistant" when there is a high likelihood of
<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="co"># \donttest{</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">df</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</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</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</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">AMP</span><span class="op">:</span><span class="va">TOB</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</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">AMP</span><span class="op">:</span><span class="va">TOB</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="va">df</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">AMP</span><span class="op">:</span><span class="va">TOB</span><span class="op">)</span>, <span class="va">as.sir</span>, mo <span class="op">=</span> <span class="st">"microorganism"</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></span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"E. coli"</span>,</span></span>
<span class="r-in"><span> NIT <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></span>
<span class="r-in"><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></span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"E. coli"</span>,</span></span>
<span class="r-in"><span> NIT <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></span>
<span class="r-in"><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</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">AMP</span><span class="op">:</span><span class="va">TOB</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> 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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'AMP' (ampicillin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: '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</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> - assuming body site 'Non-meningitis'.</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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'AMP' (ampicillin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: '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</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'GEN' (gentamicin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'TOB' (tobramycin) 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> OK </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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'AMP' (ampicillin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: '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</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> - assuming body site 'Non-meningitis'.</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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'AMP' (ampicillin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: '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</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'GEN' (gentamicin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'TOB' (tobramycin) 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> OK </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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'AMP' (ampicillin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: '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</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'GEN' (gentamicin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'TOB' (tobramycin) 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> OK </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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: 'AMP' (ampicillin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: '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</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> - assuming body site 'Non-meningitis'.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'GEN' (gentamicin) 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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting disk diffusion zones: 'TOB' (tobramycin) 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> OK </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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: column 'NIT' (nitrofurantoin), EUCAST 2024...</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>in as.sir(): interpretation of nitrofurantoin (NIT) is only available for</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> (uncomplicated) urinary tract infections (UTI) for some microorganisms,</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> thus assuming uti = TRUE. See ?as.sir.</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> 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> 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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: column 'NIT' (nitrofurantoin), EUCAST 2024...</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>in as.sir(): interpretation of nitrofurantoin (NIT) is only available for</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> (uncomplicated) urinary tract infections (UTI) for some microorganisms,</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> thus assuming uti = TRUE. See ?as.sir.</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> 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. Note that some</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> microorganisms might not have breakpoints for each antimicrobial drug in</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> EUCAST 2024.</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> OK </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Interpreting MIC values: '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: 'GEN' (gentamicin), 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: 'TOB' (tobramycin), 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> microorganism AMP CIP GEN TOB ERY</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 Escherichia coli S &lt;NA&gt; S S R</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 '24' truncated (38%) that were invalid</span>
<span class="r-wrn co"><span class="r-pr">#&gt;</span> <span class="warning">Warning: </span>in as.sir(): 3 results in column '28' 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-out co"><span class="r-pr">#&gt;</span> Class 'sir'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] S SDD I R NI &lt;NA&gt; &lt;NA&gt; &lt;NA&gt;</span>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -16,7 +16,7 @@ Use as.sir() to transform MICs or disks measurements to SIR values."><meta prope
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -12,7 +12,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -12,7 +12,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -12,7 +12,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -263,27 +263,27 @@
<span class="r-in"><span><span class="va">df</span> <span class="op">&lt;-</span> <span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/seq.html" class="external-link">seq_len</a></span><span class="op">(</span><span class="fl">2000</span><span class="op">)</span>, size <span class="op">=</span> <span class="fl">100</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="fu">get_episode</span><span class="op">(</span><span class="va">df</span><span class="op">$</span><span class="va">date</span>, episode_days <span class="op">=</span> <span class="fl">60</span><span class="op">)</span> <span class="co"># indices</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 29 45 31 14 41 39 26 40 18 36 15 39 18 45 32 27 10 2 13 24 43 12 8 5 3</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [26] 12 31 9 16 4 1 26 32 27 21 45 42 17 16 21 8 4 30 1 17 25 34 5 10 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [51] 18 44 33 4 6 12 43 2 43 45 37 33 18 38 45 36 46 4 35 40 12 7 11 23 10</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [76] 35 20 4 5 29 27 41 12 30 45 18 46 22 28 39 19 27 45 16 4 21 40 39 39 10</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 19 2 28 25 19 31 2 32 42 3 36 31 24 12 31 7 29 25 5 25 1 32 8 36 26</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [26] 11 35 43 33 5 47 2 12 15 47 30 17 30 11 45 37 5 24 9 20 23 44 41 34 39</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [51] 40 4 23 20 29 11 34 28 40 9 16 8 39 4 23 14 16 40 39 17 1 18 2 46 11</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [76] 47 17 35 29 19 10 47 34 47 38 13 27 31 41 16 38 6 14 22 8 45 38 13 21 45</span>
<span class="r-in"><span><span class="fu">is_new_episode</span><span class="op">(</span><span class="va">df</span><span class="op">$</span><span class="va">date</span>, episode_days <span class="op">=</span> <span class="fl">60</span><span class="op">)</span> <span class="co"># TRUE/FALSE</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] TRUE FALSE FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [37] TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [49] FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [61] TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [73] TRUE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [85] FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [97] FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] TRUE TRUE FALSE TRUE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] TRUE TRUE TRUE TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [37] TRUE FALSE FALSE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [49] TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [61] TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [73] FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [85] TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [97] FALSE FALSE TRUE FALSE</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># filter on results from the third 60-day episode only, using base R</span></span></span>
<span class="r-in"><span><span class="va">df</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/which.html" class="external-link">which</a></span><span class="op">(</span><span class="fu">get_episode</span><span class="op">(</span><span class="va">df</span><span class="op">$</span><span class="va">date</span>, <span class="fl">60</span><span class="op">)</span> <span class="op">==</span> <span class="fl">3</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: 1 × 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-12-13 285137 78 F ICU B_ESCHR_COLI R NA NA NA </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-11-04 304347 62 M Clinical B_STRPT_PNMN S NA NA S </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>
@ -317,19 +317,19 @@
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/arrange.html" class="external-link">arrange</a></span><span class="op">(</span><span class="va">patient</span>, <span class="va">condition</span>, <span class="va">date</span><span class="op">)</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: 100 × 4</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: patient, condition [99]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: patient, condition [96]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> patient date condition new_episode</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&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;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 036063 2010-01-28 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 077922 2009-08-18 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 080086 2010-08-08 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 0DBF93 2015-10-12 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 105248 2005-06-16 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 114570 2003-04-08 C TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 119392 2010-11-01 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 161740 2005-06-21 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 174209 2011-10-03 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 210105 2009-06-13 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 001213 2009-08-03 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 012595 2002-06-18 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 067927 2002-01-13 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 097186 2015-10-28 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> 0E2483 2007-05-29 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 156730 2012-04-12 C TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 180928 2008-06-14 C TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 183220 2008-11-14 A TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 192790 2008-02-15 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 195736 2015-01-02 B TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 90 more rows</span></span>
<span class="r-in"><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>
@ -343,19 +343,19 @@
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/arrange.html" class="external-link">arrange</a></span><span class="op">(</span><span class="va">patient</span>, <span class="va">ward</span>, <span class="va">date</span><span class="op">)</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: 100 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: ward, patient [96]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: ward, patient [92]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward date patient new_index new_logical</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&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;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> Clinical 2010-01-28 036063 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> Clinical 2009-08-18 077922 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> Clinical 2010-08-08 080086 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> Clinical 2015-10-12 0DBF93 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> Clinical 2005-06-16 105248 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> ICU 2003-04-08 114570 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> Clinical 2010-11-01 119392 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> Clinical 2005-06-21 161740 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> Outpatient 2011-10-03 174209 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> Clinical 2009-06-13 210105 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> Clinical 2009-08-03 001213 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> ICU 2002-06-18 012595 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> ICU 2002-01-13 067927 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> Clinical 2015-10-28 097186 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> Clinical 2007-05-29 0E2483 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> Clinical 2012-04-12 156730 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> Clinical 2008-06-14 180928 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> Clinical 2008-11-14 183220 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> Outpatient 2008-02-15 192790 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> Outpatient 2015-01-02 195736 1 TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 90 more rows</span></span>
<span class="r-in"><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>
@ -371,9 +371,9 @@
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 3 × 5</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ward n_patients n_episodes_365 n_episodes_60 n_episodes_30</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span> <span style="color: #949494; font-style: italic;">&lt;int&gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clinical 63 12 35 45</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 24 9 17 21</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 9 7 7 9</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> Clinical 61 13 36 45</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> ICU 25 11 20 24</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> Outpatient 6 4 5 5</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># grouping on patients and microorganisms leads to the same</span></span></span>
<span class="r-in"><span><span class="co"># results as first_isolate() when using 'episode-based':</span></span></span>
@ -391,7 +391,7 @@
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/identical.html" class="external-link">identical</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">y</span><span class="op">)</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> [1] TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] FALSE</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># but is_new_episode() has a lot more flexibility than first_isolate(),</span></span></span>
<span class="r-in"><span><span class="co"># since you can now group on anything that seems relevant:</span></span></span>
@ -402,19 +402,19 @@
<span class="r-in"><span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_data.html" class="external-link">group_vars</a></span><span class="op">(</span><span class="va">.</span><span class="op">)</span>, <span class="va">flag_episode</span><span class="op">)</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: 100 × 4</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: patient, mo, ward [96]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> patient mo ward flag_episode</span>
<span class="r-out co"><span class="r-pr">#&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;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> 686445 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> D39422 B_KLBSL_PNMN Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 298662 B_ESCHR_COLI Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 5B78D5 B_STPHY_AURS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> E52625 B_STRPT_PNMN Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> 645121 B_SERRT_MRCS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 807228 B_STRPT_PNMN Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> D41749 B_ESCHR_COLI ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> 210105 B_ENTRC Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 789292 B_STRPT_SLVR Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># Groups: patient, mo, ward [98]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> patient mo ward flag_episode</span>
<span class="r-out co"><span class="r-pr">#&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;chr&gt;</span> <span style="color: #949494; font-style: italic;">&lt;lgl&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> C89738 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 2</span> 798871 B_ENTRC_FCLS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 3</span> 6C1111 B_PSDMN_AERG Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 4</span> 945BD5 B_ENTRBC_CLOC Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 5</span> C89738 B_STRPT_MITS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 6</span> BC9909 B_ESCHR_COLI Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 7</span> 218912 B_ESCHR_COLI ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> 156730 B_STPHY_CONS Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> D41749 B_ESCHR_COLI ICU TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> 304347 B_STRPT_PNMN Clinical TRUE </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 90 more rows</span></span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -207,7 +207,7 @@
<div class="section level2">
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
<p><strong>Note:</strong> As opposed to the <code>join()</code> functions of <code>dplyr</code>, <a href="https://rdrr.io/r/base/character.html" class="external-link">character</a> vectors are supported and at default existing columns will get a suffix <code>"2"</code> and the newly joined columns will not get a suffix.</p>
<p>If the <code>dplyr</code> package is installed, their join functions will be used. Otherwise, the much slower <code><a href="https://rdatatable.gitlab.io/data.table/reference/merge.html" class="external-link">merge()</a></code> and <code><a href="https://rdrr.io/r/base/interaction.html" class="external-link">interaction()</a></code> functions from base <span style="R">R</span> will be used.</p>
<p>If the <code>dplyr</code> package is installed, their join functions will be used. Otherwise, the much slower <code><a href="https://rdrr.io/r/base/merge.html" class="external-link">merge()</a></code> and <code><a href="https://rdrr.io/r/base/interaction.html" class="external-link">interaction()</a></code> functions from base <span style="R">R</span> will be used.</p>
</div>
<div class="section level2">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -199,9 +199,9 @@
<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="fu">kurtosis</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">10000</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 3.021297</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 3.020084</span>
<span class="r-in"><span><span class="fu">kurtosis</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">10000</span><span class="op">)</span>, excess <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.08143396</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.08523356</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -218,30 +218,30 @@
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">sir</span> <span class="op">&lt;-</span> <span class="fu"><a href="random.html">random_sir</a></span><span class="op">(</span><span class="fl">10</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">sir</span></span></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 R S I I S I I R I</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] S I R S R R I I I I</span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">sir</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.449138 1.449138 -0.621059 -0.621059 -0.621059 -0.621059 -0.621059</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [8] -0.621059 1.449138 -0.621059</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.621059 -0.621059 1.449138 -0.621059 1.449138 1.449138 -0.621059</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [8] -0.621059 -0.621059 -0.621059</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">mic</span> <span class="op">&lt;-</span> <span class="fu"><a href="random.html">random_mic</a></span><span class="op">(</span><span class="fl">10</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">mic</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.002 0.5 0.125 128 0.25 0.5 256 0.125 0.125 64 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 128 0.01 1 4 0.5 0.125 0.0625 0.01 0.25 256 </span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">mic</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -1.6429088 -0.1673475 -0.5378223 1.3145519 -0.3525849 -0.1673475</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 1.4997893 -0.5378223 -0.5378223 1.1293145</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.50474059 -1.18644827 0.12402228 0.51851322 -0.07322319 -0.46771414</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.66495961 -1.18644827 -0.27046866 1.70198606</span>
<span class="r-in"><span><span class="co"># equal to the Z-score of their log2:</span></span></span>
<span class="r-in"><span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log2</a></span><span class="op">(</span><span class="va">mic</span><span class="op">)</span> <span class="op">-</span> <span class="fu"><a href="https://rdrr.io/r/base/mean.html" class="external-link">mean</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log2</a></span><span class="op">(</span><span class="va">mic</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> <span class="op">/</span> <span class="fu"><a href="https://rdrr.io/r/stats/sd.html" class="external-link">sd</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log2</a></span><span class="op">(</span><span class="va">mic</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -1.6429088 -0.1673475 -0.5378223 1.3145519 -0.3525849 -0.1673475</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 1.4997893 -0.5378223 -0.5378223 1.1293145</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.50474059 -1.18644827 0.12402228 0.51851322 -0.07322319 -0.46771414</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] -0.66495961 -1.18644827 -0.27046866 1.70198606</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">disk</span> <span class="op">&lt;-</span> <span class="fu"><a href="random.html">random_disk</a></span><span class="op">(</span><span class="fl">10</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">disk</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 40 45 43 14 42 40 37 15 42 11</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 48 25 20 10 7 42 36 37 21 50</span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">disk</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.5182957 0.8832927 0.7372939 -1.3796886 0.6642945 0.5182957</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 0.2992975 -1.3066892 0.6642945 -1.5986868</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1.2084823 -0.3021206 -0.6305125 -1.2872964 -1.4843315 0.8144120</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 0.4203417 0.4860201 -0.5648341 1.3398391</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">y</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> id <span class="op">=</span> <span class="va">LETTERS</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">10</span><span class="op">]</span>,</span></span>
@ -251,22 +251,22 @@
<span class="r-in"><span> tobr <span class="op">=</span> <span class="fu"><a href="random.html">random_mic</a></span><span class="op">(</span><span class="fl">10</span>, ab <span class="op">=</span> <span class="st">"tobr"</span>, mo <span class="op">=</span> <span class="st">"Escherichia coli"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">y</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A R 17 &lt;=0.5 &gt;=8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B I 26 &lt;=0.5 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C R 18 4 &gt;=8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D R 22 &lt;=0.5 &lt;=0.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E I 30 &lt;=0.5 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F S 18 4 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G I 26 8 2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H S 29 8 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I I 22 16 1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J S 31 1 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 A R 17 2 &lt;=2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 B R 28 2 &lt;=2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 C I 19 2 &lt;=2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 D I 31 4 &lt;=2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 E S 25 1 &lt;=2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 F S 30 1 &lt;=2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G S 24 1 8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 H I 30 1 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 I S 29 2 &lt;=2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J R 21 4 4</span>
<span class="r-in"><span><span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">y</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Calculating mean AMR distance based on columns "amox", "cipr", "gent",</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> and "tobr"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.12957466 -0.14083442 0.55230568 -0.36152662 -0.31478853 -0.33012168</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 0.17672648 0.13748045 -0.07163669 0.22282068</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.13604780 0.41224903 -0.55390664 0.36116821 -0.57176848 -0.32254265</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [7] 0.09348329 0.03500582 -0.05545497 0.73781418</span>
<span class="r-in"><span><span class="va">y</span><span class="op">$</span><span class="va">amr_distance</span> <span class="op">&lt;-</span> <span class="fu">mean_amr_distance</span><span class="op">(</span><span class="va">y</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="op">)</span></span></span>
<span class="r-err co"><span class="r-pr">#&gt;</span> <span class="error">Error in .subset(x, j):</span> invalid subscript type 'list'</span>
<span class="r-in"><span><span class="va">y</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">y</span><span class="op">$</span><span class="va">amr_distance</span><span class="op">)</span>, <span class="op">]</span></span></span>
@ -282,17 +282,17 @@
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Calculating mean AMR distance based on columns "amox", "cipr", "gent",</span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> and "tobr"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr amr_distance check_id_C</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 C R 18 4 &gt;=8 0.55230568 0.0000000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 J S 31 1 4 0.22282068 0.3294850</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 G I 26 8 2 0.17672648 0.3755792</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 H S 29 8 1 0.13748045 0.4148252</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 A R 17 &lt;=0.5 &gt;=8 0.12957466 0.4227310</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 I I 22 16 1 -0.07163669 0.6239424</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 B I 26 &lt;=0.5 4 -0.14083442 0.6931401</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 E I 30 &lt;=0.5 1 -0.31478853 0.8670942</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 F S 18 4 2 -0.33012168 0.8824274</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 D R 22 &lt;=0.5 &lt;=0.5 -0.36152662 0.9138323</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> id amox cipr gent tobr amr_distance check_id_C</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 C I 19 2 &lt;=2 -0.55390664 0.00000000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 E S 25 1 &lt;=2 -0.57176848 0.01786185</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 F S 30 1 &lt;=2 -0.32254265 0.23136399</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 A R 17 2 &lt;=2 -0.13604780 0.41785884</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 I S 29 2 &lt;=2 -0.05545497 0.49845167</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 H I 30 1 4 0.03500582 0.58891246</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 G S 24 1 8 0.09348329 0.64738993</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 D I 31 4 &lt;=2 0.36116821 0.91507485</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 B R 28 2 &lt;=2 0.41224903 0.96615567</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 J R 21 4 4 0.73781418 1.29172082</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"># support for groups</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>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -12,7 +12,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -12,7 +12,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -12,7 +12,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -210,42 +210,44 @@
<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="fu">random_mic</span><span class="op">(</span><span class="fl">25</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 16 64 256 0.002 1 0.001 64 0.25 1 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [11] 0.5 8 8 0.0625 1 0.5 0.025 256 256 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [21] 0.01 1 64 32 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.025 1 &lt;=0.001 16 &lt;=0.001 1 0.025 8 0.025 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [10] 0.125 &gt;=256 16 &gt;=256 16 &lt;=0.001 1 0.005 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [19] 32 64 0.25 16 0.125 8 4 </span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 49 47 14 33 49 43 41 41 43 31 20 43 42 11 18 42 8 42 16 25 42 8 15 30 29</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 30 7 9 44 30 41 45 40 7 41 49 10 12 19 28 8 33 48 44 46 44 18 37 50 16</span>
<span class="r-in"><span><span class="fu">random_sir</span><span class="op">(</span><span class="fl">25</span><span class="op">)</span></span></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] I S S I S I I S R S S I I S S I I S I R S S R I S</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] R S S I S I R I R R S I I S S S S R I I I I R I S</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"># make the random generation more realistic by setting a bug and/or drug:</span></span></span>
<span class="r-in"><span><span class="fu">random_mic</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span><span class="op">)</span> <span class="co"># range 0.0625-64</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 64 0.025 2 0.25 32 64 0.002 32 0.01 0.001 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [11] 0.25 0.125 0.0625 64 128 0.002 128 128 1 0.002 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [21] 1 0.005 0.001 4 0.001 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 0.25 1 &gt;=64 32 &lt;=0.001 &gt;=64 0.025 32 32 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [10] 0.005 16 1 0.005 4 0.25 8 4 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [19] 0.01 0.25 0.01 0.25 &gt;=64 0.125 0.125 </span>
<span class="r-in"><span><span class="fu">random_mic</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span>, <span class="st">"meropenem"</span><span class="op">)</span> <span class="co"># range 0.0625-16</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 1 2 1 &gt;=16 8 1 &gt;=16 &gt;=16 2 1 2 1 1 8 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [16] 1 1 4 2 &gt;=16 &gt;=16 2 4 2 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 8 16 2 2 1 16 8 8 2 2 4 &gt;=32 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] 8 1 16 &lt;=0.5 1 &gt;=32 &gt;=32 &gt;=32 8 4 8 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] 16 </span>
<span class="r-in"><span><span class="fu">random_mic</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Streptococcus pneumoniae"</span>, <span class="st">"meropenem"</span><span class="op">)</span> <span class="co"># range 0.0625-4</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'mic'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 2 0.25 &gt;=8 &gt;=8 0.5 1 1 0.125 0.25 1 2 1 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] 0.25 &gt;=8 0.25 2 1 1 &gt;=8 0.125 0.5 &gt;=8 0.125 0.25 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] 0.25 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] &lt;=0.0625 4 2 &lt;=0.0625 4 1 4 0.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [9] 2 4 1 4 0.25 0.25 0.5 0.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [17] &lt;=0.0625 0.5 1 1 0.125 0.125 2 4 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] 2 </span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span><span class="op">)</span> <span class="co"># range 8-50</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 45 49 24 46 23 18 15 17 17 28 40 20 21 43 39 9 33 17 8 20 30 21 44 48 41</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 14 39 35 18 41 39 48 44 48 24 26 40 47 10 31 21 31 48 12 24 50 8 25 40 48</span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Klebsiella pneumoniae"</span>, <span class="st">"ampicillin"</span><span class="op">)</span> <span class="co"># range 11-17</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 13 15 11 14 16 16 11 15 11 17 14 15 17 17 16 16 16 12 14 12 15 13 13 13 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 11 12 17 14 17 17 13 14 11 13 13 16 16 17 15 13 14 14 15 16 17 11 14 16 14</span>
<span class="r-in"><span><span class="fu">random_disk</span><span class="op">(</span><span class="fl">25</span>, <span class="st">"Streptococcus pneumoniae"</span>, <span class="st">"ampicillin"</span><span class="op">)</span> <span class="co"># range 12-27</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'disk'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 22 23 19 19 23 15 23 18 21 24 22 25 19 19 16 17 17 16 27 21 27 25 15 21 27</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 17 15 16 16 24 15 27 22 24 19 23 25 21 27 23 27 21 21 27 20 26 24 23 25 18</span>
<span class="r-in"><span><span class="co"># }</span></span></span>
</code></pre></div>
</div>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

View File

@ -12,7 +12,7 @@ When negative ('left-skewed'): the left tail is longer; the mass of the distribu
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">
@ -198,7 +198,7 @@ When negative ('left-skewed'): the left tail is longer; the mass of the distribu
<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="fu">skewness</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Uniform.html" class="external-link">runif</a></span><span class="op">(</span><span class="fl">1000</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.03310027</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] -0.040407</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -10,7 +10,7 @@
<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.9049</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.1.1.9050</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">

File diff suppressed because one or more lines are too long