1
0
mirror of https://github.com/msberends/AMR.git synced 2026-08-29 11:19:00 +02:00

Built site for AMR@3.0.1.9003: ba30b08

This commit is contained in:
github-actions
2025-11-24 10:42:21 +00:00
parent 7d16891987
commit 141fc468f8
161 changed files with 21798 additions and 313 deletions

View File

@@ -31,7 +31,7 @@
<a class="navbar-brand me-2" href="https://amr-for-r.org/index.html">AMR (for R)</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">

3
404.md Normal file
View File

@@ -0,0 +1,3 @@
Content not found. Please use links in the navbar.
# Page not found (404)

View File

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

250
LICENSE-text.md Normal file
View File

@@ -0,0 +1,250 @@
# License
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
A SUMMARY OF THIS LICENSE BY THE ORIGINAL AUTHORS OF THE AMR R PACKAGE
This R package, with package name 'AMR':
- May be used for commercial purposes
- May be used for private purposes
- May NOT be used for patent purposes
- May be modified, although:
- Modifications MUST be released under the same license when distributing the package
- Changes made to the code MUST be documented
- May be distributed, although:
- Source code MUST be made available when the package is distributed
- A copy of the license and copyright notice MUST be included with the package.
- Comes with a LIMITATION of liability
- Comes with NO warranty
END OF THE SUMMARY
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

View File

@@ -30,7 +30,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -91,7 +91,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 13 October 2025.</p>
generated on 24 November 2025.</p>
<div class="section level2">
<h2 id="introduction">Introduction<a class="anchor" aria-label="anchor" href="#introduction"></a>
</h2>
@@ -147,21 +147,21 @@ make the structure of your data generally look like this:</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2025-10-13</td>
<td align="center">2025-11-24</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">2025-10-13</td>
<td align="center">2025-11-24</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">2025-10-13</td>
<td align="center">2025-11-24</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@@ -1254,7 +1254,7 @@ function on a grouped <code>tibble</code>, i.e., using
provides an extension to that function:</p>
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">autoplot</a></span><span class="op">(</span><span class="va">combined_ab</span><span class="op">)</span></span></code></pre></div>
<p><img src="AMR_files/figure-html/unnamed-chunk-10-1.png" width="720"></p>
<p><img src="AMR_files/figure-html/unnamed-chunk-10-1.png" class="r-plt" width="720"></p>
<p>To calculate antimicrobial resistance in a more sensible way, also by
correcting for too few results, we use the <code><a href="../reference/proportion.html">resistance()</a></code> and
<code><a href="../reference/proportion.html">susceptibility()</a></code> functions.</p>
@@ -1348,7 +1348,7 @@ categories.</p>
<span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html" class="external-link">labs</a></span><span class="op">(</span>title <span class="op">=</span> <span class="st">"MIC Distribution and SIR Interpretation"</span>,</span>
<span> x <span class="op">=</span> <span class="st">"Sample Groups"</span>,</span>
<span> y <span class="op">=</span> <span class="st">"MIC (mg/L)"</span><span class="op">)</span></span></code></pre></div>
<p><img src="AMR_files/figure-html/mic_plot-1.png" width="720"></p>
<p><img src="AMR_files/figure-html/mic_plot-1.png" class="r-plt" width="720"></p>
<p>This plot provides an intuitive way to assess susceptibility patterns
across different groups while incorporating clinical breakpoints.</p>
<p>For a more straightforward and less manual approach,
@@ -1357,12 +1357,12 @@ extended by this package to directly plot MIC and disk diffusion
values:</p>
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">autoplot</a></span><span class="op">(</span><span class="va">mic_values</span><span class="op">)</span></span></code></pre></div>
<p><img src="AMR_files/figure-html/autoplot-1.png" width="720"></p>
<p><img src="AMR_files/figure-html/autoplot-1.png" class="r-plt" width="720"></p>
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="co"># by providing `mo` and `ab`, colours will indicate the SIR interpretation:</span></span>
<span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">autoplot</a></span><span class="op">(</span><span class="va">mic_values</span>, mo <span class="op">=</span> <span class="st">"K. pneumoniae"</span>, ab <span class="op">=</span> <span class="st">"cipro"</span>, guideline <span class="op">=</span> <span class="st">"EUCAST 2024"</span><span class="op">)</span></span></code></pre></div>
<p><img src="AMR_files/figure-html/autoplot-2.png" width="720"></p>
<p><img src="AMR_files/figure-html/autoplot-2.png" class="r-plt" width="720"></p>
<hr>
<p><em>Author: Dr. Matthijs Berends, 23rd Feb 2025</em></p>
</div>

951
articles/AMR.md Normal file
View File

@@ -0,0 +1,951 @@
# Conduct AMR data analysis
**Note:** values on this page will change with every website update
since they are based on randomly created values and the page was written
in [R Markdown](https://rmarkdown.rstudio.com/). However, the
methodology remains unchanged. This page was generated on 24 November
2025.
## Introduction
Conducting AMR data analysis unfortunately requires in-depth knowledge
from different scientific fields, which makes it hard to do right. At
least, it requires:
- Good questions (always start with those!) and reliable data
- A thorough understanding of (clinical) epidemiology, to understand the
clinical and epidemiological relevance and possible bias of results
- A thorough understanding of (clinical) microbiology/infectious
diseases, to understand which microorganisms are causal to which
infections and the implications of pharmaceutical treatment, as well
as understanding intrinsic and acquired microbial resistance
- Experience with data analysis with microbiological tests and their
results, to understand the determination and limitations of MIC values
and their interpretations to SIR values
- Availability of the biological taxonomy of microorganisms and probably
normalisation factors for pharmaceuticals, such as defined daily doses
(DDD)
- Available (inter-)national guidelines, and profound methods to apply
them
Of course, we cannot instantly provide you with knowledge and
experience. But with this `AMR` package, we aimed at providing (1) tools
to simplify antimicrobial resistance data cleaning, transformation and
analysis, (2) methods to easily incorporate international guidelines and
(3) scientifically reliable reference data, including the requirements
mentioned above.
The `AMR` package enables standardised and reproducible AMR data
analysis, with the application of evidence-based rules, determination of
first isolates, translation of various codes for microorganisms and
antimicrobial agents, determination of (multi-drug) resistant
microorganisms, and calculation of antimicrobial resistance, prevalence
and future trends.
## Preparation
For this tutorial, we will create fake demonstration data to work with.
You can skip to [Cleaning the data](#cleaning-the-data) if you already
have your own data ready. If you start your analysis, try to make the
structure of your data generally look like this:
| date | patient_id | mo | AMX | CIP |
|:----------:|:----------:|:----------------:|:---:|:---:|
| 2025-11-24 | abcd | Escherichia coli | S | S |
| 2025-11-24 | abcd | Escherichia coli | S | R |
| 2025-11-24 | efgh | Escherichia coli | R | S |
### Needed R packages
As with many uses in R, we need some additional packages for AMR data
analysis. Our package works closely together with the [tidyverse
packages](https://www.tidyverse.org)
[`dplyr`](https://dplyr.tidyverse.org/) and
[`ggplot2`](https://ggplot2.tidyverse.org) by RStudio. The tidyverse
tremendously improves the way we conduct data science - it allows for a
very natural way of writing syntaxes and creating beautiful plots in R.
We will also use the `cleaner` package, that can be used for cleaning
data and creating frequency tables.
``` r
library(dplyr)
library(ggplot2)
library(AMR)
# (if not yet installed, install with:)
# install.packages(c("dplyr", "ggplot2", "AMR"))
```
The `AMR` package contains a data set `example_isolates_unclean`, which
might look data that users have extracted from their laboratory systems:
``` r
example_isolates_unclean
#> # A tibble: 3,000 × 8
#> patient_id hospital date bacteria AMX AMC CIP GEN
#> <chr> <chr> <date> <chr> <chr> <chr> <chr> <chr>
#> 1 J3 A 2012-11-21 E. coli R I S S
#> 2 R7 A 2018-04-03 K. pneumoniae R I S S
#> 3 P3 A 2014-09-19 E. coli R S S S
#> 4 P10 A 2015-12-10 E. coli S I S S
#> 5 B7 A 2015-03-02 E. coli S S S S
#> 6 W3 A 2018-03-31 S. aureus R S R S
#> 7 J8 A 2016-06-14 E. coli R S S S
#> 8 M3 A 2015-10-25 E. coli R S S S
#> 9 J3 A 2019-06-19 E. coli S S S S
#> 10 G6 A 2015-04-27 S. aureus S S S S
#> # 2,990 more rows
# we will use 'our_data' as the data set name for this tutorial
our_data <- example_isolates_unclean
```
For AMR data analysis, we would like the microorganism column to contain
valid, up-to-date taxonomy, and the antibiotic columns to be cleaned as
SIR values as well.
### Taxonomy of microorganisms
With [`as.mo()`](https://amr-for-r.org/reference/as.mo.md), users can
transform arbitrary microorganism names or codes to current taxonomy.
The `AMR` package contains up-to-date taxonomic data. To be specific,
currently included data were retrieved on 24 Jun 2024.
The codes of the AMR packages that come from
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) are short, but
still human readable. More importantly,
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) supports all kinds
of input:
``` r
as.mo("Klebsiella pneumoniae")
#> Class 'mo'
#> [1] B_KLBSL_PNMN
as.mo("K. pneumoniae")
#> Class 'mo'
#> [1] B_KLBSL_PNMN
as.mo("KLEPNE")
#> Class 'mo'
#> [1] B_KLBSL_PNMN
as.mo("KLPN")
#> Class 'mo'
#> [1] B_KLBSL_PNMN
```
The first character in above codes denote their taxonomic kingdom, such
as Bacteria (B), Fungi (F), and Protozoa (P).
The `AMR` package also contain functions to directly retrieve taxonomic
properties, such as the name, genus, species, family, order, and even
Gram-stain. They all start with `mo_` and they use
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) internally, so
that still any arbitrary user input can be used:
``` r
mo_family("K. pneumoniae")
#> [1] "Enterobacteriaceae"
mo_genus("K. pneumoniae")
#> [1] "Klebsiella"
mo_species("K. pneumoniae")
#> [1] "pneumoniae"
mo_gramstain("Klebsiella pneumoniae")
#> [1] "Gram-negative"
mo_ref("K. pneumoniae")
#> [1] "Trevisan, 1887"
mo_snomed("K. pneumoniae")
#> [[1]]
#> [1] "1098101000112102" "446870005" "1098201000112108" "409801009"
#> [5] "56415008" "714315002" "713926009"
```
Now we can thus clean our data:
``` r
our_data$bacteria <- as.mo(our_data$bacteria, info = TRUE)
#> Retrieved values from the `microorganisms.codes` data set for "ESCCOL",
#> "KLEPNE", "STAAUR", and "STRPNE".
#> Microorganism translation was uncertain for four microorganisms. Run
#> `mo_uncertainties()` to review these uncertainties, or use
#> `add_custom_microorganisms()` to add custom entries.
```
Apparently, there was some uncertainty about the translation to
taxonomic codes. Lets check this:
``` r
mo_uncertainties()
#> Matching scores are based on the resemblance between the input and the full
#> taxonomic name, and the pathogenicity in humans. See `?mo_matching_score`.
#> Colour keys: 0.000-0.549 0.550-0.649 0.650-0.749 0.750-1.000
#>
#> --------------------------------------------------------------------------------
#> "E. coli" -> Escherichia coli (B_ESCHR_COLI, 0.688)
#> Also matched: Enterococcus crotali (0.650), Escherichia coli coli
#> (0.643), Escherichia coli expressing (0.611), Enterobacter cowanii
#> (0.600), Enterococcus columbae (0.595), Enterococcus camelliae (0.591),
#> Enterococcus casseliflavus (0.577), Enterobacter cloacae cloacae
#> (0.571), Enterobacter cloacae complex (0.571), and Enterobacter cloacae
#> dissolvens (0.565)
#> --------------------------------------------------------------------------------
#> "K. pneumoniae" -> Klebsiella pneumoniae (B_KLBSL_PNMN, 0.786)
#> Also matched: Klebsiella pneumoniae complex (0.707), Klebsiella
#> pneumoniae ozaenae (0.707), Klebsiella pneumoniae pneumoniae (0.688),
#> Klebsiella pneumoniae rhinoscleromatis (0.658), Klebsiella pasteurii
#> (0.500), Klebsiella planticola (0.500), Kingella potus (0.400),
#> Kluyveromyces pseudotropicale (0.386), Kluyveromyces pseudotropicalis
#> (0.363), and Kosakonia pseudosacchari (0.361)
#> --------------------------------------------------------------------------------
#> "S. aureus" -> Staphylococcus aureus (B_STPHY_AURS, 0.690)
#> Also matched: Staphylococcus aureus aureus (0.643), Staphylococcus
#> argenteus (0.625), Staphylococcus aureus anaerobius (0.625),
#> Staphylococcus auricularis (0.615), Salmonella Aurelianis (0.595),
#> Salmonella Aarhus (0.588), Salmonella Amounderness (0.587),
#> Staphylococcus argensis (0.587), Streptococcus australis (0.587), and
#> Salmonella choleraesuis arizonae (0.562)
#> --------------------------------------------------------------------------------
#> "S. pneumoniae" -> Streptococcus pneumoniae (B_STRPT_PNMN, 0.750)
#> Also matched: Streptococcus pseudopneumoniae (0.700), Streptococcus
#> phocae salmonis (0.552), Serratia proteamaculans quinovora (0.545),
#> Streptococcus pseudoporcinus (0.536), Staphylococcus piscifermentans
#> (0.533), Staphylococcus pseudintermedius (0.532), Serratia
#> proteamaculans proteamaculans (0.526), Streptococcus gallolyticus
#> pasteurianus (0.526), Salmonella Portanigra (0.524), and Streptococcus
#> periodonticum (0.519)
#>
#> Only the first 10 other matches of each record are shown. Run
#> `print(mo_uncertainties(), n = ...)` to view more entries, or save
#> `mo_uncertainties()` to an object.
```
Thats all good.
### Antibiotic results
The column with antibiotic test results must also be cleaned. The `AMR`
package comes with three new data types to work with such test results:
`mic` for minimal inhibitory concentrations (MIC), `disk` for disk
diffusion diameters, and `sir` for SIR data that have been interpreted
already. This package can also determine SIR values based on MIC or disk
diffusion values, read more about that on the
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md) page.
For now, we will just clean the SIR columns in our data using dplyr:
``` r
# method 1, be explicit about the columns:
our_data <- our_data %>%
mutate_at(vars(AMX:GEN), as.sir)
# method 2, let the AMR package determine the eligible columns
our_data <- our_data %>%
mutate_if(is_sir_eligible, as.sir)
# result:
our_data
#> # A tibble: 3,000 × 8
#> patient_id hospital date bacteria AMX AMC CIP GEN
#> <chr> <chr> <date> <mo> <sir> <sir> <sir> <sir>
#> 1 J3 A 2012-11-21 B_ESCHR_COLI R I S S
#> 2 R7 A 2018-04-03 B_KLBSL_PNMN R I S S
#> 3 P3 A 2014-09-19 B_ESCHR_COLI R S S S
#> 4 P10 A 2015-12-10 B_ESCHR_COLI S I S S
#> 5 B7 A 2015-03-02 B_ESCHR_COLI S S S S
#> 6 W3 A 2018-03-31 B_STPHY_AURS R S R S
#> 7 J8 A 2016-06-14 B_ESCHR_COLI R S S S
#> 8 M3 A 2015-10-25 B_ESCHR_COLI R S S S
#> 9 J3 A 2019-06-19 B_ESCHR_COLI S S S S
#> 10 G6 A 2015-04-27 B_STPHY_AURS S S S S
#> # 2,990 more rows
```
This is basically it for the cleaning, time to start the data inclusion.
### First isolates
We need to know which isolates we can *actually* use for analysis
without repetition bias.
To conduct an analysis of antimicrobial resistance, you must [only
include the first isolate of every patient per
episode](https:/pubmed.ncbi.nlm.nih.gov/17304462/) (Hindler *et al.*,
Clin Infect Dis. 2007). If you would not do this, you could easily get
an overestimate or underestimate of the resistance of an antibiotic.
Imagine that a patient was admitted with an MRSA and that it was found
in 5 different blood cultures the following weeks (yes, some countries
like the Netherlands have these blood drawing policies). The resistance
percentage of oxacillin of all isolates would be overestimated, because
you included this MRSA more than once. It would clearly be [selection
bias](https://en.wikipedia.org/wiki/Selection_bias).
The Clinical and Laboratory Standards Institute (CLSI) appoints this as
follows:
> *(…) When preparing a cumulative antibiogram to guide clinical
> decisions about empirical antimicrobial therapy of initial infections,
> **only the first isolate of a given species per patient, per analysis
> period (eg, one year) should be included, irrespective of body site,
> antimicrobial susceptibility profile, or other phenotypical
> characteristics (eg, biotype)**. The first isolate is easily
> identified, and cumulative antimicrobial susceptibility test data
> prepared using the first isolate are generally comparable to
> cumulative antimicrobial susceptibility test data calculated by other
> methods, providing duplicate isolates are excluded.*
> [M39-A4 Analysis and Presentation of Cumulative Antimicrobial
> Susceptibility Test Data, 4th Edition. CLSI, 2014. Chapter
> 6.4](https://clsi.org/standards/products/microbiology/documents/m39/)
This `AMR` package includes this methodology with the
[`first_isolate()`](https://amr-for-r.org/reference/first_isolate.md)
function and is able to apply the four different methods as defined by
[Hindler *et al.* in
2007](https://academic.oup.com/cid/article/44/6/867/364325):
phenotype-based, episode-based, patient-based, isolate-based. The right
method depends on your goals and analysis, but the default
phenotype-based method is in any case the method to properly correct for
most duplicate isolates. Read more about the methods on the
[`first_isolate()`](https://amr-for-r.org/reference/first_isolate.md)
page.
The outcome of the function can easily be added to our data:
``` r
our_data <- our_data %>%
mutate(first = first_isolate(info = TRUE))
#> Determining first isolates using an episode length of 365 days
#> Using column 'bacteria' as input for `col_mo`.
#> Using column 'date' as input for `col_date`.
#> Using column 'patient_id' as input for `col_patient_id`.
#> Basing inclusion on all antimicrobial results, using a points threshold
#> of 2
#> => Found 2,724 'phenotype-based' first isolates (90.8% of total where a
#> microbial ID was available)
```
So only 91% is suitable for resistance analysis! We can now filter on it
with the [`filter()`](https://dplyr.tidyverse.org/reference/filter.html)
function, also from the `dplyr` package:
``` r
our_data_1st <- our_data %>%
filter(first == TRUE)
```
For future use, the above two syntaxes can be shortened:
``` r
our_data_1st <- our_data %>%
filter_first_isolate()
```
So we end up with 2 724 isolates for analysis. Now our data looks like:
``` r
our_data_1st
#> # A tibble: 2,724 × 9
#> patient_id hospital date bacteria AMX AMC CIP GEN first
#> <chr> <chr> <date> <mo> <sir> <sir> <sir> <sir> <lgl>
#> 1 J3 A 2012-11-21 B_ESCHR_COLI R I S S TRUE
#> 2 R7 A 2018-04-03 B_KLBSL_PNMN R I S S TRUE
#> 3 P3 A 2014-09-19 B_ESCHR_COLI R S S S TRUE
#> 4 P10 A 2015-12-10 B_ESCHR_COLI S I S S TRUE
#> 5 B7 A 2015-03-02 B_ESCHR_COLI S S S S TRUE
#> 6 W3 A 2018-03-31 B_STPHY_AURS R S R S TRUE
#> 7 M3 A 2015-10-25 B_ESCHR_COLI R S S S TRUE
#> 8 J3 A 2019-06-19 B_ESCHR_COLI S S S S TRUE
#> 9 G6 A 2015-04-27 B_STPHY_AURS S S S S TRUE
#> 10 P4 A 2011-06-21 B_ESCHR_COLI S S S S TRUE
#> # 2,714 more rows
```
Time for the analysis.
## Analysing the data
The base R [`summary()`](https://rdrr.io/r/base/summary.html) function
gives a good first impression, as it comes with support for the new `mo`
and `sir` classes that we now have in our data set:
``` r
summary(our_data_1st)
#> patient_id hospital date
#> Length:2724 Length:2724 Min. :2011-01-01
#> Class :character Class :character 1st Qu.:2013-04-07
#> Mode :character Mode :character Median :2015-06-03
#> Mean :2015-06-09
#> 3rd Qu.:2017-08-11
#> Max. :2019-12-27
#> bacteria AMX AMC
#> Class :mo Class:sir Class:sir
#> <NA> :0 %S :41.6% (n=1133) %S :52.6% (n=1432)
#> Unique:4 %SDD : 0.0% (n=0) %SDD : 0.0% (n=0)
#> #1 :B_ESCHR_COLI %I :16.4% (n=446) %I :12.2% (n=333)
#> #2 :B_STPHY_AURS %R :42.0% (n=1145) %R :35.2% (n=959)
#> #3 :B_STRPT_PNMN %NI : 0.0% (n=0) %NI : 0.0% (n=0)
#> CIP GEN first
#> Class:sir Class:sir Mode:logical
#> %S :52.5% (n=1431) %S :61.0% (n=1661) TRUE:2724
#> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0)
#> %I : 6.5% (n=176) %I : 3.0% (n=82)
#> %R :41.0% (n=1117) %R :36.0% (n=981)
#> %NI : 0.0% (n=0) %NI : 0.0% (n=0)
glimpse(our_data_1st)
#> Rows: 2,724
#> Columns: 9
#> $ patient_id <chr> "J3", "R7", "P3", "P10", "B7", "W3", "M3", "J3", "G6", "P4"…
#> $ hospital <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",…
#> $ date <date> 2012-11-21, 2018-04-03, 2014-09-19, 2015-12-10, 2015-03-02…
#> $ bacteria <mo> "B_ESCHR_COLI", "B_KLBSL_PNMN", "B_ESCHR_COLI", "B_ESCHR_COL…
#> $ AMX <sir> R, R, R, S, S, R, R, S, S, S, S, R, S, S, R, R, R, R, S, R,…
#> $ AMC <sir> I, I, S, I, S, S, S, S, S, S, S, S, S, S, S, S, S, R, S, S,…
#> $ CIP <sir> S, S, S, S, S, R, S, S, S, S, S, S, S, S, S, S, S, S, S, S,…
#> $ GEN <sir> S, S, S, S, S, S, S, S, S, S, S, R, S, S, S, S, S, S, S, S,…
#> $ first <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
# number of unique values per column:
sapply(our_data_1st, n_distinct)
#> patient_id hospital date bacteria AMX AMC CIP
#> 260 3 1854 4 3 3 3
#> GEN first
#> 3 1
```
### Availability of species
To just get an idea how the species are distributed, create a frequency
table with [`count()`](https://amr-for-r.org/reference/count.md) based
on the name of the microorganisms:
``` r
our_data %>%
count(mo_name(bacteria), sort = TRUE)
#> # A tibble: 4 × 2
#> `mo_name(bacteria)` n
#> <chr> <int>
#> 1 Escherichia coli 1518
#> 2 Staphylococcus aureus 730
#> 3 Streptococcus pneumoniae 426
#> 4 Klebsiella pneumoniae 326
our_data_1st %>%
count(mo_name(bacteria), sort = TRUE)
#> # A tibble: 4 × 2
#> `mo_name(bacteria)` n
#> <chr> <int>
#> 1 Escherichia coli 1321
#> 2 Staphylococcus aureus 682
#> 3 Streptococcus pneumoniae 402
#> 4 Klebsiella pneumoniae 319
```
### Select and filter with antibiotic selectors
Using so-called antibiotic class selectors, you can select or filter
columns based on the antibiotic class that your antibiotic results are
in:
``` r
our_data_1st %>%
select(date, aminoglycosides())
#> For `aminoglycosides()` using column 'GEN' (gentamicin)
#> # A tibble: 2,724 × 2
#> date GEN
#> <date> <sir>
#> 1 2012-11-21 S
#> 2 2018-04-03 S
#> 3 2014-09-19 S
#> 4 2015-12-10 S
#> 5 2015-03-02 S
#> 6 2018-03-31 S
#> 7 2015-10-25 S
#> 8 2019-06-19 S
#> 9 2015-04-27 S
#> 10 2011-06-21 S
#> # 2,714 more rows
our_data_1st %>%
select(bacteria, betalactams())
#> For `betalactams()` using columns 'AMX' (amoxicillin) and 'AMC'
#> (amoxicillin/clavulanic acid)
#> # A tibble: 2,724 × 3
#> bacteria AMX AMC
#> <mo> <sir> <sir>
#> 1 B_ESCHR_COLI R I
#> 2 B_KLBSL_PNMN R I
#> 3 B_ESCHR_COLI R S
#> 4 B_ESCHR_COLI S I
#> 5 B_ESCHR_COLI S S
#> 6 B_STPHY_AURS R S
#> 7 B_ESCHR_COLI R S
#> 8 B_ESCHR_COLI S S
#> 9 B_STPHY_AURS S S
#> 10 B_ESCHR_COLI S S
#> # 2,714 more rows
our_data_1st %>%
select(bacteria, where(is.sir))
#> # A tibble: 2,724 × 5
#> bacteria AMX AMC CIP GEN
#> <mo> <sir> <sir> <sir> <sir>
#> 1 B_ESCHR_COLI R I S S
#> 2 B_KLBSL_PNMN R I S S
#> 3 B_ESCHR_COLI R S S S
#> 4 B_ESCHR_COLI S I S S
#> 5 B_ESCHR_COLI S S S S
#> 6 B_STPHY_AURS R S R S
#> 7 B_ESCHR_COLI R S S S
#> 8 B_ESCHR_COLI S S S S
#> 9 B_STPHY_AURS S S S S
#> 10 B_ESCHR_COLI S S S S
#> # 2,714 more rows
# filtering using AB selectors is also possible:
our_data_1st %>%
filter(any(aminoglycosides() == "R"))
#> For `aminoglycosides()` using column 'GEN' (gentamicin)
#> # A tibble: 981 × 9
#> patient_id hospital date bacteria AMX AMC CIP GEN first
#> <chr> <chr> <date> <mo> <sir> <sir> <sir> <sir> <lgl>
#> 1 J5 A 2017-12-25 B_STRPT_PNMN R S S R TRUE
#> 2 X1 A 2017-07-04 B_STPHY_AURS R S S R TRUE
#> 3 B3 A 2016-07-24 B_ESCHR_COLI S S S R TRUE
#> 4 V7 A 2012-04-03 B_ESCHR_COLI S S S R TRUE
#> 5 C9 A 2017-03-23 B_ESCHR_COLI S S S R TRUE
#> 6 R1 A 2018-06-10 B_STPHY_AURS S S S R TRUE
#> 7 S2 A 2013-07-19 B_STRPT_PNMN S S S R TRUE
#> 8 P5 A 2019-03-09 B_STPHY_AURS S S S R TRUE
#> 9 Q8 A 2019-08-10 B_STPHY_AURS S S S R TRUE
#> 10 K5 A 2013-03-15 B_STRPT_PNMN S S S R TRUE
#> # 971 more rows
our_data_1st %>%
filter(all(betalactams() == "R"))
#> For `betalactams()` using columns 'AMX' (amoxicillin) and 'AMC'
#> (amoxicillin/clavulanic acid)
#> # A tibble: 462 × 9
#> patient_id hospital date bacteria AMX AMC CIP GEN first
#> <chr> <chr> <date> <mo> <sir> <sir> <sir> <sir> <lgl>
#> 1 M7 A 2013-07-22 B_STRPT_PNMN R R S S TRUE
#> 2 R10 A 2013-12-20 B_STPHY_AURS R R S S TRUE
#> 3 R7 A 2015-10-25 B_STPHY_AURS R R S S TRUE
#> 4 R8 A 2019-10-25 B_STPHY_AURS R R S S TRUE
#> 5 B6 A 2016-11-20 B_ESCHR_COLI R R R R TRUE
#> 6 I7 A 2015-08-19 B_ESCHR_COLI R R S S TRUE
#> 7 N3 A 2014-12-29 B_STRPT_PNMN R R R S TRUE
#> 8 Q2 A 2019-09-22 B_ESCHR_COLI R R S S TRUE
#> 9 X7 A 2011-03-20 B_ESCHR_COLI R R S R TRUE
#> 10 V1 A 2018-08-07 B_STPHY_AURS R R S S TRUE
#> # 452 more rows
# even works in base R (since R 3.0):
our_data_1st[all(betalactams() == "R"), ]
#> For `betalactams()` using columns 'AMX' (amoxicillin) and 'AMC'
#> (amoxicillin/clavulanic acid)
#> # A tibble: 462 × 9
#> patient_id hospital date bacteria AMX AMC CIP GEN first
#> <chr> <chr> <date> <mo> <sir> <sir> <sir> <sir> <lgl>
#> 1 M7 A 2013-07-22 B_STRPT_PNMN R R S S TRUE
#> 2 R10 A 2013-12-20 B_STPHY_AURS R R S S TRUE
#> 3 R7 A 2015-10-25 B_STPHY_AURS R R S S TRUE
#> 4 R8 A 2019-10-25 B_STPHY_AURS R R S S TRUE
#> 5 B6 A 2016-11-20 B_ESCHR_COLI R R R R TRUE
#> 6 I7 A 2015-08-19 B_ESCHR_COLI R R S S TRUE
#> 7 N3 A 2014-12-29 B_STRPT_PNMN R R R S TRUE
#> 8 Q2 A 2019-09-22 B_ESCHR_COLI R R S S TRUE
#> 9 X7 A 2011-03-20 B_ESCHR_COLI R R S R TRUE
#> 10 V1 A 2018-08-07 B_STPHY_AURS R R S S TRUE
#> # 452 more rows
```
### Generate antibiograms
Since AMR v2.0 (March 2023), it is very easy to create different types
of antibiograms, with support for 20 different languages.
There are four antibiogram types, as proposed by Klinker *et al.* (2021,
[DOI
10.1177/20499361211011373](https://doi.org/10.1177/20499361211011373)),
and they are all supported by the new
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
function:
1. **Traditional Antibiogram (TA)** e.g, for the susceptibility of
*Pseudomonas aeruginosa* to piperacillin/tazobactam (TZP)
2. **Combination Antibiogram (CA)** e.g, for the sdditional
susceptibility of *Pseudomonas aeruginosa* to TZP + tobramycin
versus TZP alone
3. **Syndromic Antibiogram (SA)** e.g, for the susceptibility of
*Pseudomonas aeruginosa* to TZP among respiratory specimens
(obtained among ICU patients only)
4. **Weighted-Incidence Syndromic Combination Antibiogram (WISCA)**
e.g, for the susceptibility of *Pseudomonas aeruginosa* to TZP among
respiratory specimens (obtained among ICU patients only) for male
patients age \>=65 years with heart failure
In this section, we show how to use the
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
function to create any of the above antibiogram types. For starters,
this is what the included `example_isolates` data set looks like:
``` r
example_isolates
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
```
#### Traditional Antibiogram
To create a traditional antibiogram, simply state which antibiotics
should be used. The `antibiotics` argument in the
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
function supports any (combination) of the previously mentioned
antibiotic class selectors:
``` r
antibiogram(example_isolates,
antibiotics = c(aminoglycosides(), carbapenems()))
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
```
| Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
|:-----------------|:---------------------|:--------------------|:---------------------|:----------------|:---------------------|:--------------------|
| CoNS | 0% (0-8%,N=43) | 86% (82-90%,N=309) | 52% (37-67%,N=48) | 0% (0-8%,N=43) | 52% (37-67%,N=48) | 22% (12-35%,N=55) |
| *E. coli* | 100% (98-100%,N=171) | 98% (96-99%,N=460) | 100% (99-100%,N=422) | NA | 100% (99-100%,N=418) | 97% (96-99%,N=462) |
| *E. faecalis* | 0% (0-9%,N=39) | 0% (0-9%,N=39) | 100% (91-100%,N=38) | 0% (0-9%,N=39) | NA | 0% (0-9%,N=39) |
| *K. pneumoniae* | NA | 90% (79-96%,N=58) | 100% (93-100%,N=51) | NA | 100% (93-100%,N=53) | 90% (79-96%,N=58) |
| *P. aeruginosa* | NA | 100% (88-100%,N=30) | NA | 0% (0-12%,N=30) | NA | 100% (88-100%,N=30) |
| *P. mirabilis* | NA | 94% (80-99%,N=34) | 94% (79-99%,N=32) | NA | NA | 94% (80-99%,N=34) |
| *S. aureus* | NA | 99% (97-100%,N=233) | NA | NA | NA | 98% (92-100%,N=86) |
| *S. epidermidis* | 0% (0-8%,N=44) | 79% (71-85%,N=163) | NA | 0% (0-8%,N=44) | NA | 51% (40-61%,N=89) |
| *S. hominis* | NA | 92% (84-97%,N=80) | NA | NA | NA | 85% (74-93%,N=62) |
| *S. pneumoniae* | 0% (0-3%,N=117) | 0% (0-3%,N=117) | NA | 0% (0-3%,N=117) | NA | 0% (0-3%,N=117) |
Notice that the
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
function automatically prints in the right format when using Quarto or R
Markdown (such as this page), and even applies italics for taxonomic
names (by using
[`italicise_taxonomy()`](https://amr-for-r.org/reference/italicise_taxonomy.md)
internally).
It also uses the language of your OS if this is either English, Arabic,
Bengali, Chinese, Czech, Danish, Dutch, Finnish, French, German, Greek,
Hindi, Indonesian, Italian, Japanese, Korean, Norwegian, Polish,
Portuguese, Romanian, Russian, Spanish, Swahili, Swedish, Turkish,
Ukrainian, Urdu, or Vietnamese. In this next example, we force the
language to be Spanish using the `language` argument:
``` r
antibiogram(example_isolates,
mo_transform = "gramstain",
antibiotics = aminoglycosides(),
ab_transform = "name",
language = "es")
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
```
| Patógeno | Amikacina | Gentamicina | Kanamicina | Tobramicina |
|:--------------|:-------------------|:--------------------|:----------------|:-------------------|
| Gram negativo | 98% (96-99%,N=256) | 96% (95-98%,N=684) | 0% (0-10%,N=35) | 96% (94-97%,N=686) |
| Gram positivo | 0% (0-1%,N=436) | 63% (60-66%,N=1170) | 0% (0-1%,N=436) | 34% (31-38%,N=665) |
#### Combined Antibiogram
To create a combined antibiogram, use antibiotic codes or names with a
plus `+` character like this:
``` r
combined_ab <- antibiogram(example_isolates,
antibiotics = c("TZP", "TZP+TOB", "TZP+GEN"),
ab_transform = NULL)
combined_ab
```
| Pathogen | TZP | TZP + GEN | TZP + TOB |
|:-----------------|:---------------------|:---------------------|:---------------------|
| CoNS | 30% (16-49%,N=33) | 97% (95-99%,N=274) | NA |
| *E. coli* | 94% (92-96%,N=416) | 100% (98-100%,N=459) | 99% (97-100%,N=461) |
| *K. pneumoniae* | 89% (77-96%,N=53) | 93% (83-98%,N=58) | 93% (83-98%,N=58) |
| *P. aeruginosa* | NA | 100% (88-100%,N=30) | 100% (88-100%,N=30) |
| *P. mirabilis* | NA | 100% (90-100%,N=34) | 100% (90-100%,N=34) |
| *S. aureus* | NA | 100% (98-100%,N=231) | 100% (96-100%,N=91) |
| *S. epidermidis* | NA | 100% (97-100%,N=128) | 100% (92-100%,N=46) |
| *S. hominis* | NA | 100% (95-100%,N=74) | 100% (93-100%,N=53) |
| *S. pneumoniae* | 100% (97-100%,N=112) | 100% (97-100%,N=112) | 100% (97-100%,N=112) |
#### Syndromic Antibiogram
To create a syndromic antibiogram, the `syndromic_group` argument must
be used. This can be any column in the data, or e.g. an
[`ifelse()`](https://rdrr.io/r/base/ifelse.html) with calculations based
on certain columns:
``` r
antibiogram(example_isolates,
antibiotics = c(aminoglycosides(), carbapenems()),
syndromic_group = "ward")
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
```
| Syndromic Group | Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
|:----------------|:-----------------|:---------------------|:--------------------|:---------------------|:----------------|:---------------------|:--------------------|
| Clinical | CoNS | NA | 89% (84-93%,N=205) | 57% (39-74%,N=35) | NA | 57% (39-74%,N=35) | 26% (12-45%,N=31) |
| ICU | CoNS | NA | 79% (68-88%,N=73) | NA | NA | NA | NA |
| Outpatient | CoNS | NA | 84% (66-95%,N=31) | NA | NA | NA | NA |
| Clinical | *E. coli* | 100% (97-100%,N=104) | 98% (96-99%,N=297) | 100% (99-100%,N=266) | NA | 100% (99-100%,N=276) | 98% (96-99%,N=299) |
| ICU | *E. coli* | 100% (93-100%,N=52) | 99% (95-100%,N=137) | 100% (97-100%,N=133) | NA | 100% (97-100%,N=118) | 96% (92-99%,N=137) |
| Clinical | *K. pneumoniae* | NA | 92% (81-98%,N=51) | 100% (92-100%,N=44) | NA | 100% (92-100%,N=46) | 92% (81-98%,N=51) |
| Clinical | *P. mirabilis* | NA | 100% (88-100%,N=30) | NA | NA | NA | 100% (88-100%,N=30) |
| Clinical | *S. aureus* | NA | 99% (95-100%,N=150) | NA | NA | NA | 97% (89-100%,N=63) |
| ICU | *S. aureus* | NA | 100% (95-100%,N=66) | NA | NA | NA | NA |
| Clinical | *S. epidermidis* | NA | 82% (72-90%,N=79) | NA | NA | NA | 55% (39-70%,N=44) |
| ICU | *S. epidermidis* | NA | 72% (60-82%,N=75) | NA | NA | NA | 41% (26-58%,N=41) |
| Clinical | *S. hominis* | NA | 96% (85-99%,N=45) | NA | NA | NA | 94% (79-99%,N=31) |
| Clinical | *S. pneumoniae* | 0% (0-5%,N=78) | 0% (0-5%,N=78) | NA | 0% (0-5%,N=78) | NA | 0% (0-5%,N=78) |
| ICU | *S. pneumoniae* | 0% (0-12%,N=30) | 0% (0-12%,N=30) | NA | 0% (0-12%,N=30) | NA | 0% (0-12%,N=30) |
#### Weighted-Incidence Syndromic Combination Antibiogram (WISCA)
To create a **Weighted-Incidence Syndromic Combination Antibiogram
(WISCA)**, simply set `wisca = TRUE` in the
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
function, or use the dedicated
[`wisca()`](https://amr-for-r.org/reference/antibiogram.md) function.
Unlike traditional antibiograms, WISCA provides syndrome-based
susceptibility estimates, weighted by pathogen incidence and
antimicrobial susceptibility patterns.
``` r
example_isolates %>%
wisca(antibiotics = c("TZP", "TZP+TOB", "TZP+GEN"),
minimum = 10) # Recommended threshold: ≥30
```
| Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|:------------------------|:-------------------------------------|:-------------------------------------|
| 69.4% (64.3-74.3%) | 92.6% (91.1-93.9%) | 88.7% (85.8-91.2%) |
WISCA uses a **Bayesian decision model** to integrate data from multiple
pathogens, improving empirical therapy guidance, especially for
low-incidence infections. It is **pathogen-agnostic**, meaning results
are syndrome-based rather than stratified by microorganism.
For reliable results, ensure your data includes **only first isolates**
(use
[`first_isolate()`](https://amr-for-r.org/reference/first_isolate.md))
and consider filtering for **the top *n* species** (use
[`top_n_microorganisms()`](https://amr-for-r.org/reference/top_n_microorganisms.md)),
as WISCA outcomes are most meaningful when based on robust incidence
estimates.
For **patient- or syndrome-specific WISCA**, run the function on a
grouped `tibble`, i.e., using
[`group_by()`](https://dplyr.tidyverse.org/reference/group_by.html)
first:
``` r
example_isolates %>%
top_n_microorganisms(n = 10) %>%
group_by(age_group = age_groups(age, c(25, 50, 75)),
gender) %>%
wisca(antibiotics = c("TZP", "TZP+TOB", "TZP+GEN"))
```
| age_group | gender | Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|:----------|:-------|:------------------------|:-------------------------------------|:-------------------------------------|
| 0-24 | F | 56.6% (25.2-83.9%) | 73.6% (48-91.6%) | 68.6% (42.9-89.5%) |
| 0-24 | M | 60.3% (28.4-87.1%) | 79.7% (57.6-94.2%) | 60.1% (29.5-87.7%) |
| 25-49 | F | 66.6% (45.6-85.5%) | 91.7% (84.6-96.7%) | 83% (67.9-94%) |
| 25-49 | M | 56.4% (29.1-81.7%) | 89.2% (80.3-95.7%) | 72.4% (49.7-90%) |
| 50-74 | F | 67.8% (55.8-80.1%) | 95.6% (93.2-97.5%) | 88.1% (80.4-94.6%) |
| 50-74 | M | 66.2% (54.8-75.8%) | 95.2% (92.4-97.4%) | 84.4% (74.4-92.5%) |
| 75+ | F | 71.7% (61-81.7%) | 96.6% (94.4-98.2%) | 90.6% (84.6-95.3%) |
| 75+ | M | 72.9% (63.8-82%) | 96.6% (94.6-98.1%) | 92.8% (87.8-96.5%) |
#### Plotting antibiograms
Antibiograms can be plotted using
[`autoplot()`](https://ggplot2.tidyverse.org/reference/autoplot.html)
from the `ggplot2` packages, since this `AMR` package provides an
extension to that function:
``` r
autoplot(combined_ab)
```
![](AMR_files/figure-html/unnamed-chunk-10-1.png)
To calculate antimicrobial resistance in a more sensible way, also by
correcting for too few results, we use the
[`resistance()`](https://amr-for-r.org/reference/proportion.md) and
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
functions.
### Resistance percentages
The functions
[`resistance()`](https://amr-for-r.org/reference/proportion.md) and
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md) can
be used to calculate antimicrobial resistance or susceptibility. For
more specific analyses, the functions
[`proportion_S()`](https://amr-for-r.org/reference/proportion.md),
[`proportion_SI()`](https://amr-for-r.org/reference/proportion.md),
[`proportion_I()`](https://amr-for-r.org/reference/proportion.md),
[`proportion_IR()`](https://amr-for-r.org/reference/proportion.md) and
[`proportion_R()`](https://amr-for-r.org/reference/proportion.md) can be
used to determine the proportion of a specific antimicrobial outcome.
All these functions contain a `minimum` argument, denoting the minimum
required number of test results for returning a value. These functions
will otherwise return `NA`. The default is `minimum = 30`, following the
[CLSI M39-A4
guideline](https://clsi.org/standards/products/microbiology/documents/m39/)
for applying microbial epidemiology.
As per the EUCAST guideline of 2019, we calculate resistance as the
proportion of R
([`proportion_R()`](https://amr-for-r.org/reference/proportion.md),
equal to
[`resistance()`](https://amr-for-r.org/reference/proportion.md)) and
susceptibility as the proportion of S and I
([`proportion_SI()`](https://amr-for-r.org/reference/proportion.md),
equal to
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)).
These functions can be used on their own:
``` r
our_data_1st %>% resistance(AMX)
#> [1] 0.4203377
```
Or can be used in conjunction with
[`group_by()`](https://dplyr.tidyverse.org/reference/group_by.html) and
[`summarise()`](https://dplyr.tidyverse.org/reference/summarise.html),
both from the `dplyr` package:
``` r
our_data_1st %>%
group_by(hospital) %>%
summarise(amoxicillin = resistance(AMX))
#> # A tibble: 3 × 2
#> hospital amoxicillin
#> <chr> <dbl>
#> 1 A 0.340
#> 2 B 0.551
#> 3 C 0.370
```
### Interpreting MIC and Disk Diffusion Values
Minimal inhibitory concentration (MIC) values and disk diffusion
diameters can be interpreted into clinical breakpoints (SIR) using
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md). Heres an
example with randomly generated MIC values for *Klebsiella pneumoniae*
and ciprofloxacin:
``` r
set.seed(123)
mic_values <- random_mic(100)
sir_values <- as.sir(mic_values, mo = "K. pneumoniae", ab = "cipro", guideline = "EUCAST 2024")
my_data <- tibble(MIC = mic_values, SIR = sir_values)
my_data
#> # A tibble: 100 × 2
#> MIC SIR
#> <mic> <sir>
#> 1 <=0.0001 S
#> 2 0.0160 S
#> 3 >=8.0000 R
#> 4 0.0320 S
#> 5 0.0080 S
#> 6 64.0000 R
#> 7 0.0080 S
#> 8 0.1250 S
#> 9 0.0320 S
#> 10 0.0002 S
#> # 90 more rows
```
This allows direct interpretation according to EUCAST or CLSI
breakpoints, facilitating automated AMR data processing.
### Plotting MIC and SIR Interpretations
We can visualise MIC distributions and their SIR interpretations using
`ggplot2`, using the new
[`scale_y_mic()`](https://amr-for-r.org/reference/plot.md) for the
y-axis and
[`scale_colour_sir()`](https://amr-for-r.org/reference/plot.md) to
colour-code SIR categories.
``` r
# add a group
my_data$group <- rep(c("A", "B", "C", "D"), each = 25)
ggplot(my_data,
aes(x = group, y = MIC, colour = SIR)) +
geom_jitter(width = 0.2, size = 2) +
geom_boxplot(fill = NA, colour = "grey40") +
scale_y_mic() +
scale_colour_sir() +
labs(title = "MIC Distribution and SIR Interpretation",
x = "Sample Groups",
y = "MIC (mg/L)")
```
![](AMR_files/figure-html/mic_plot-1.png)
This plot provides an intuitive way to assess susceptibility patterns
across different groups while incorporating clinical breakpoints.
For a more straightforward and less manual approach, `ggplot2`s
function
[`autoplot()`](https://ggplot2.tidyverse.org/reference/autoplot.html)
has been extended by this package to directly plot MIC and disk
diffusion values:
``` r
autoplot(mic_values)
```
![](AMR_files/figure-html/autoplot-1.png)
``` r
# by providing `mo` and `ab`, colours will indicate the SIR interpretation:
autoplot(mic_values, mo = "K. pneumoniae", ab = "cipro", guideline = "EUCAST 2024")
```
![](AMR_files/figure-html/autoplot-2.png)
------------------------------------------------------------------------
*Author: Dr. Matthijs Berends, 23rd Feb 2025*

View File

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

217
articles/AMR_for_Python.md Normal file
View File

@@ -0,0 +1,217 @@
# AMR for Python
## Introduction
The `AMR` package for R is a powerful tool for antimicrobial resistance
(AMR) analysis. It provides extensive features for handling microbial
and antimicrobial data. However, for those who work primarily in Python,
we now have a more intuitive option available: the [`AMR` Python
package](https://pypi.org/project/AMR/).
This Python package is a wrapper around the `AMR` R package. It uses the
`rpy2` package internally. Despite the need to have R installed, Python
users can now easily work with AMR data directly through Python code.
## Prerequisites
This package was only tested with a [virtual environment
(venv)](https://docs.python.org/3/library/venv.html). You can set up
such an environment by running:
``` python
# linux and macOS:
python -m venv /path/to/new/virtual/environment
# Windows:
python -m venv C:\path\to\new\virtual\environment
```
Then you can [activate the
environment](https://docs.python.org/3/library/venv.html#how-venvs-work),
after which the venv is ready to work with.
## Install AMR
1. Since the Python package is available on the official [Python
Package Index](https://pypi.org/project/AMR/), you can just run:
``` bash
pip install AMR
```
2. Make sure you have R installed. There is **no need to install the
`AMR` R package**, as it will be installed automatically.
For Linux:
``` bash
# Ubuntu / Debian
sudo apt install r-base
# Fedora:
sudo dnf install R
# CentOS/RHEL
sudo yum install R
```
For macOS (using [Homebrew](https://brew.sh)):
``` bash
brew install r
```
For Windows, visit the [CRAN download
page](https://cran.r-project.org) to download and install R.
## Examples of Usage
### Cleaning Taxonomy
Heres an example that demonstrates how to clean microorganism and drug
names using the `AMR` Python package:
``` python
import pandas as pd
import AMR
# Sample data
data = {
"MOs": ['E. coli', 'ESCCOL', 'esco', 'Esche coli'],
"Drug": ['Cipro', 'CIP', 'J01MA02', 'Ciproxin']
}
df = pd.DataFrame(data)
# Use AMR functions to clean microorganism and drug names
df['MO_clean'] = AMR.mo_name(df['MOs'])
df['Drug_clean'] = AMR.ab_name(df['Drug'])
# Display the results
print(df)
```
| MOs | Drug | MO_clean | Drug_clean |
|------------|----------|------------------|---------------|
| E. coli | Cipro | Escherichia coli | Ciprofloxacin |
| ESCCOL | CIP | Escherichia coli | Ciprofloxacin |
| esco | J01MA02 | Escherichia coli | Ciprofloxacin |
| Esche coli | Ciproxin | Escherichia coli | Ciprofloxacin |
#### Explanation
- **mo_name:** This function standardises microorganism names. Here,
different variations of *Escherichia coli* (such as “E. coli”,
“ESCCOL”, “esco”, and “Esche coli”) are all converted into the
correct, standardised form, “Escherichia coli”.
- **ab_name**: Similarly, this function standardises antimicrobial
names. The different representations of ciprofloxacin (e.g., “Cipro”,
“CIP”, “J01MA02”, and “Ciproxin”) are all converted to the standard
name, “Ciprofloxacin”.
### Calculating AMR
``` python
import AMR
import pandas as pd
df = AMR.example_isolates
result = AMR.resistance(df["AMX"])
print(result)
```
[0.59555556]
### Generating Antibiograms
One of the core functions of the `AMR` package is generating an
antibiogram, a table that summarises the antimicrobial susceptibility of
bacterial isolates. Heres how you can generate an antibiogram from
Python:
``` python
result2a = AMR.antibiogram(df[["mo", "AMX", "CIP", "TZP"]])
print(result2a)
```
| Pathogen | Amoxicillin | Ciprofloxacin | Piperacillin/tazobactam |
|----------------|----------------|---------------|-------------------------|
| CoNS | 7% (10/142) | 73% (183/252) | 30% (10/33) |
| E. coli | 50% (196/392) | 88% (399/456) | 94% (393/416) |
| K. pneumoniae | 0% (0/58) | 96% (53/55) | 89% (47/53) |
| P. aeruginosa | 0% (0/30) | 100% (30/30) | None |
| P. mirabilis | None | 94% (34/36) | None |
| S. aureus | 6% (8/131) | 90% (171/191) | None |
| S. epidermidis | 1% (1/91) | 64% (87/136) | None |
| S. hominis | None | 80% (56/70) | None |
| S. pneumoniae | 100% (112/112) | None | 100% (112/112) |
``` python
result2b = AMR.antibiogram(df[["mo", "AMX", "CIP", "TZP"]], mo_transform = "gramstain")
print(result2b)
```
| Pathogen | Amoxicillin | Ciprofloxacin | Piperacillin/tazobactam |
|---------------|---------------|---------------|-------------------------|
| Gram-negative | 36% (226/631) | 91% (621/684) | 88% (565/641) |
| Gram-positive | 43% (305/703) | 77% (560/724) | 86% (296/345) |
In this example, we generate an antibiogram by selecting various
antibiotics.
### Taxonomic Data Sets Now in Python!
As a Python user, you might like that the most important data sets of
the `AMR` R package, `microorganisms`, `antimicrobials`,
`clinical_breakpoints`, and `example_isolates`, are now available as
regular Python data frames:
``` python
AMR.microorganisms
```
| mo | fullname | status | kingdom | gbif | gbif_parent | gbif_renamed_to | prevalence |
|--------------|------------------------------------|----------|----------|----------|-------------|-----------------|------------|
| B_GRAMN | (unknown Gram-negatives) | unknown | Bacteria | None | None | None | 2.0 |
| B_GRAMP | (unknown Gram-positives) | unknown | Bacteria | None | None | None | 2.0 |
| B_ANAER-NEG | (unknown anaerobic Gram-negatives) | unknown | Bacteria | None | None | None | 2.0 |
| B_ANAER-POS | (unknown anaerobic Gram-positives) | unknown | Bacteria | None | None | None | 2.0 |
| B_ANAER | (unknown anaerobic bacteria) | unknown | Bacteria | None | None | None | 2.0 |
| … | … | … | … | … | … | … | … |
| B_ZYMMN_POMC | Zymomonas pomaceae | accepted | Bacteria | 10744418 | 3221412 | None | 2.0 |
| B_ZYMPH | Zymophilus | synonym | Bacteria | None | 9475166 | None | 2.0 |
| B_ZYMPH_PCVR | Zymophilus paucivorans | synonym | Bacteria | None | None | None | 2.0 |
| B_ZYMPH_RFFN | Zymophilus raffinosivorans | synonym | Bacteria | None | None | None | 2.0 |
| F_ZYZYG | Zyzygomyces | unknown | Fungi | None | 7581 | None | 2.0 |
``` python
AMR.antimicrobials
```
| ab | cid | name | group | oral_ddd | oral_units | iv_ddd | iv_units |
|-----|------------|-----------------------|--------------------------|----------|------------|--------|----------|
| AMA | 4649.0 | 4-aminosalicylic acid | Antimycobacterials | 12.00 | g | NaN | None |
| ACM | 6450012.0 | Acetylmidecamycin | Macrolides/lincosamides | NaN | None | NaN | None |
| ASP | 49787020.0 | Acetylspiramycin | Macrolides/lincosamides | NaN | None | NaN | None |
| ALS | 8954.0 | Aldesulfone sodium | Other antibacterials | 0.33 | g | NaN | None |
| AMK | 37768.0 | Amikacin | Aminoglycosides | NaN | None | 1.0 | g |
| … | … | … | … | … | … | … | … |
| VIR | 11979535.0 | Virginiamycine | Other antibacterials | NaN | None | NaN | None |
| VOR | 71616.0 | Voriconazole | Antifungals/antimycotics | 0.40 | g | 0.4 | g |
| XBR | 72144.0 | Xibornol | Other antibacterials | NaN | None | NaN | None |
| ZID | 77846445.0 | Zidebactam | Other antibacterials | NaN | None | NaN | None |
| ZFD | NaN | Zoliflodacin | None | NaN | None | NaN | None |
## Conclusion
With the `AMR` Python package, Python users can now effortlessly call R
functions from the `AMR` R package. This eliminates the need for complex
`rpy2` configurations and provides a clean, easy-to-use interface for
antimicrobial resistance analysis. The examples provided above
demonstrate how this can be applied to typical workflows, such as
standardising microorganism and antimicrobial names or calculating
resistance.
By just running `import AMR`, users can seamlessly integrate the robust
features of the R `AMR` package into Python workflows.
Whether youre cleaning data or analysing resistance patterns, the `AMR`
Python package makes it easy to work with AMR data in Python.

View File

@@ -30,7 +30,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -413,7 +413,7 @@ ROC curve looks like this:</p>
<code class="sourceCode R"><span><span class="va">predictions</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span>
<span> <span class="fu">roc_curve</span><span class="op">(</span><span class="va">mo</span>, <span class="va">`.pred_Gram-negative`</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="fu"><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">autoplot</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p><img src="AMR_with_tidymodels_files/figure-html/unnamed-chunk-8-1.png" width="720"></p>
<p><img src="AMR_with_tidymodels_files/figure-html/unnamed-chunk-8-1.png" class="r-plt" width="720"></p>
</div>
<div class="section level3">
<h3 id="conclusion">
@@ -677,7 +677,7 @@ sets.</li>
<span> x <span class="op">=</span> <span class="st">"Year"</span>,</span>
<span> y <span class="op">=</span> <span class="st">"Resistance Proportion"</span><span class="op">)</span> <span class="op">+</span></span>
<span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html" class="external-link">theme_minimal</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p><img src="AMR_with_tidymodels_files/figure-html/unnamed-chunk-14-1.png" width="720"></p>
<p><img src="AMR_with_tidymodels_files/figure-html/unnamed-chunk-14-1.png" class="r-plt" width="720"></p>
<p>Additionally, we can visualise resistance trends in
<code>ggplot2</code> and directly add linear models there:</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
@@ -691,7 +691,7 @@ sets.</li>
<span> formula <span class="op">=</span> <span class="va">y</span> <span class="op">~</span> <span class="va">x</span>,</span>
<span> alpha <span class="op">=</span> <span class="fl">0.25</span><span class="op">)</span> <span class="op">+</span></span>
<span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html" class="external-link">theme_minimal</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p><img src="AMR_with_tidymodels_files/figure-html/unnamed-chunk-15-1.png" width="720"></p>
<p><img src="AMR_with_tidymodels_files/figure-html/unnamed-chunk-15-1.png" class="r-plt" width="720"></p>
</div>
<div class="section level3">
<h3 id="conclusion-1">

View File

@@ -0,0 +1,606 @@
# AMR with tidymodels
> This page was entirely written by our [AMR for R
> Assistant](https://chat.amr-for-r.org), a ChatGPT manually-trained
> model able to answer any question about the `AMR` package.
Antimicrobial resistance (AMR) is a global health crisis, and
understanding resistance patterns is crucial for managing effective
treatments. The `AMR` R package provides robust tools for analysing AMR
data, including convenient antimicrobial selector functions like
[`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`betalactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md).
In this post, we will explore how to use the `tidymodels` framework to
predict resistance patterns in the `example_isolates` dataset in two
examples.
This post contains the following examples:
1. Using Antimicrobial Selectors
2. Predicting ESBL Presence Using Raw MICs
3. Predicting AMR Over Time
## Example 1: Using Antimicrobial Selectors
By leveraging the power of `tidymodels` and the `AMR` package, well
build a reproducible machine learning workflow to predict the Gramstain
of the microorganism to two important antibiotic classes:
aminoglycosides and beta-lactams.
### **Objective**
Our goal is to build a predictive model using the `tidymodels` framework
to determine the Gramstain of the microorganism based on microbial data.
We will:
1. Preprocess data using the selector functions
[`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`betalactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md).
2. Define a logistic regression model for prediction.
3. Use a structured `tidymodels` workflow to preprocess, train, and
evaluate the model.
### **Data Preparation**
We begin by loading the required libraries and preparing the
`example_isolates` dataset from the `AMR` package.
``` r
# Load required libraries
library(AMR) # For AMR data analysis
library(tidymodels) # For machine learning workflows, and data manipulation (dplyr, tidyr, ...)
```
Prepare the data:
``` r
# Your data could look like this:
example_isolates
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
# Select relevant columns for prediction
data <- example_isolates %>%
# select AB results dynamically
select(mo, aminoglycosides(), betalactams()) %>%
# replace NAs with NI (not-interpretable)
mutate(across(where(is.sir),
~replace_na(.x, "NI")),
# make factors of SIR columns
across(where(is.sir),
as.integer),
# get Gramstain of microorganisms
mo = as.factor(mo_gramstain(mo))) %>%
# drop NAs - the ones without a Gramstain (fungi, etc.)
drop_na()
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `betalactams()` using columns 'PEN' (benzylpenicillin), 'OXA'
#> (oxacillin), 'FLC' (flucloxacillin), 'AMX' (amoxicillin), 'AMC'
#> (amoxicillin/clavulanic acid), 'AMP' (ampicillin), 'TZP'
#> (piperacillin/tazobactam), 'CZO' (cefazolin), 'FEP' (cefepime), 'CXM'
#> (cefuroxime), 'FOX' (cefoxitin), 'CTX' (cefotaxime), 'CAZ' (ceftazidime),
#> 'CRO' (ceftriaxone), 'IPM' (imipenem), and 'MEM' (meropenem)
```
**Explanation:**
- [`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`betalactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
dynamically select columns for antimicrobials in these classes.
- `drop_na()` ensures the model receives complete cases for training.
### **Defining the Workflow**
We now define the `tidymodels` workflow, which consists of three steps:
preprocessing, model specification, and fitting.
#### 1. Preprocessing with a Recipe
We create a recipe to preprocess the data for modelling.
``` r
# Define the recipe for data preprocessing
resistance_recipe <- recipe(mo ~ ., data = data) %>%
step_corr(c(aminoglycosides(), betalactams()), threshold = 0.9)
resistance_recipe
#>
#> ── Recipe ──────────────────────────────────────────────────────────────────────
#>
#> ── Inputs
#> Number of variables by role
#> outcome: 1
#> predictor: 20
#>
#> ── Operations
#> • Correlation filter on: c(aminoglycosides(), betalactams())
```
For a recipe that includes at least one preprocessing operation, like we
have with `step_corr()`, the necessary parameters can be estimated from
a training set using `prep()`:
``` r
prep(resistance_recipe)
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `betalactams()` using columns 'PEN' (benzylpenicillin), 'OXA'
#> (oxacillin), 'FLC' (flucloxacillin), 'AMX' (amoxicillin), 'AMC'
#> (amoxicillin/clavulanic acid), 'AMP' (ampicillin), 'TZP'
#> (piperacillin/tazobactam), 'CZO' (cefazolin), 'FEP' (cefepime), 'CXM'
#> (cefuroxime), 'FOX' (cefoxitin), 'CTX' (cefotaxime), 'CAZ' (ceftazidime),
#> 'CRO' (ceftriaxone), 'IPM' (imipenem), and 'MEM' (meropenem)
#>
#> ── Recipe ──────────────────────────────────────────────────────────────────────
#>
#> ── Inputs
#> Number of variables by role
#> outcome: 1
#> predictor: 20
#>
#> ── Training information
#> Training data contained 1968 data points and no incomplete rows.
#>
#> ── Operations
#> • Correlation filter on: AMX CTX | Trained
```
**Explanation:**
- `recipe(mo ~ ., data = data)` will take the `mo` column as outcome and
all other columns as predictors.
- `step_corr()` removes predictors (i.e., antibiotic columns) that have
a higher correlation than 90%.
Notice how the recipe contains just the antimicrobial selector
functions - no need to define the columns specifically. In the
preparation (retrieved with `prep()`) we can see that the columns or
variables AMX and CTX were removed as they correlate too much with
existing, other variables.
#### 2. Specifying the Model
We define a logistic regression model since resistance prediction is a
binary classification task.
``` r
# Specify a logistic regression model
logistic_model <- logistic_reg() %>%
set_engine("glm") # Use the Generalised Linear Model engine
logistic_model
#> Logistic Regression Model Specification (classification)
#>
#> Computational engine: glm
```
**Explanation:**
- `logistic_reg()` sets up a logistic regression model.
- `set_engine("glm")` specifies the use of Rs built-in GLM engine.
#### 3. Building the Workflow
We bundle the recipe and model together into a `workflow`, which
organises the entire modelling process.
``` r
# Combine the recipe and model into a workflow
resistance_workflow <- workflow() %>%
add_recipe(resistance_recipe) %>% # Add the preprocessing recipe
add_model(logistic_model) # Add the logistic regression model
resistance_workflow
#> ══ Workflow ════════════════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: logistic_reg()
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 1 Recipe Step
#>
#> • step_corr()
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#> Logistic Regression Model Specification (classification)
#>
#> Computational engine: glm
```
### **Training and Evaluating the Model**
To train the model, we split the data into training and testing sets.
Then, we fit the workflow on the training set and evaluate its
performance.
``` r
# Split data into training and testing sets
set.seed(123) # For reproducibility
data_split <- initial_split(data, prop = 0.8) # 80% training, 20% testing
training_data <- training(data_split) # Training set
testing_data <- testing(data_split) # Testing set
# Fit the workflow to the training data
fitted_workflow <- resistance_workflow %>%
fit(training_data) # Train the model
```
**Explanation:**
- `initial_split()` splits the data into training and testing sets.
- `fit()` trains the workflow on the training set.
Notice how in `fit()`, the antimicrobial selector functions are
internally called again. For training, these functions are called since
they are stored in the recipe.
Next, we evaluate the model on the testing data.
``` r
# Make predictions on the testing set
predictions <- fitted_workflow %>%
predict(testing_data) # Generate predictions
probabilities <- fitted_workflow %>%
predict(testing_data, type = "prob") # Generate probabilities
predictions <- predictions %>%
bind_cols(probabilities) %>%
bind_cols(testing_data) # Combine with true labels
predictions
#> # A tibble: 394 × 24
#> .pred_class `.pred_Gram-negative` `.pred_Gram-positive` mo GEN TOB
#> <fct> <dbl> <dbl> <fct> <int> <int>
#> 1 Gram-positive 1.07e- 1 8.93 e- 1 Gram-p… 5 5
#> 2 Gram-positive 3.17e- 8 1.000e+ 0 Gram-p… 5 1
#> 3 Gram-negative 9.99e- 1 1.42 e- 3 Gram-n… 5 5
#> 4 Gram-positive 2.22e-16 1 e+ 0 Gram-p… 5 5
#> 5 Gram-negative 9.46e- 1 5.42 e- 2 Gram-n… 5 5
#> 6 Gram-positive 1.07e- 1 8.93 e- 1 Gram-p… 5 5
#> 7 Gram-positive 2.22e-16 1 e+ 0 Gram-p… 1 5
#> 8 Gram-positive 2.22e-16 1 e+ 0 Gram-p… 4 4
#> 9 Gram-negative 1 e+ 0 2.22 e-16 Gram-n… 1 1
#> 10 Gram-positive 6.05e-11 1.000e+ 0 Gram-p… 4 4
#> # 384 more rows
#> # 18 more variables: AMK <int>, KAN <int>, PEN <int>, OXA <int>, FLC <int>,
#> # AMX <int>, AMC <int>, AMP <int>, TZP <int>, CZO <int>, FEP <int>,
#> # CXM <int>, FOX <int>, CTX <int>, CAZ <int>, CRO <int>, IPM <int>, MEM <int>
# Evaluate model performance
metrics <- predictions %>%
metrics(truth = mo, estimate = .pred_class) # Calculate performance metrics
metrics
#> # A tibble: 2 × 3
#> .metric .estimator .estimate
#> <chr> <chr> <dbl>
#> 1 accuracy binary 0.995
#> 2 kap binary 0.989
# To assess some other model properties, you can make our own `metrics()` function
our_metrics <- metric_set(accuracy, kap, ppv, npv) # add Positive Predictive Value and Negative Predictive Value
metrics2 <- predictions %>%
our_metrics(truth = mo, estimate = .pred_class) # run again on our `our_metrics()` function
metrics2
#> # A tibble: 4 × 3
#> .metric .estimator .estimate
#> <chr> <chr> <dbl>
#> 1 accuracy binary 0.995
#> 2 kap binary 0.989
#> 3 ppv binary 0.987
#> 4 npv binary 1
```
**Explanation:**
- [`predict()`](https://rdrr.io/r/stats/predict.html) generates
predictions on the testing set.
- `metrics()` computes evaluation metrics like accuracy and kappa.
It appears we can predict the Gram stain with a 99.5% accuracy based on
AMR results of only aminoglycosides and beta-lactam antibiotics. The ROC
curve looks like this:
``` r
predictions %>%
roc_curve(mo, `.pred_Gram-negative`) %>%
autoplot()
```
![](AMR_with_tidymodels_files/figure-html/unnamed-chunk-8-1.png)
### **Conclusion**
In this post, we demonstrated how to build a machine learning pipeline
with the `tidymodels` framework and the `AMR` package. By combining
selector functions like
[`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`betalactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
with `tidymodels`, we efficiently prepared data, trained a model, and
evaluated its performance.
This workflow is extensible to other antimicrobial classes and
resistance patterns, empowering users to analyse AMR data systematically
and reproducibly.
------------------------------------------------------------------------
## Example 2: Predicting ESBL Presence Using Raw MICs
In this second example, we demonstrate how to use `<mic>` columns
directly in `tidymodels` workflows using AMR-specific recipe steps. This
includes a transformation to `log2` scale using `step_mic_log2()`, which
prepares MIC values for use in classification models.
This approach and idea formed the basis for the publication [DOI:
10.3389/fmicb.2025.1582703](https://doi.org/10.3389/fmicb.2025.1582703)
to model the presence of extended-spectrum beta-lactamases (ESBL).
> NOTE: THIS EXAMPLE WILL BE AVAILABLE IN A NEXT VERSION (#TODO)
>
> The new AMR package version will contain new tidymodels selectors such
> as `step_mic_log2()`.
------------------------------------------------------------------------
## Example 2: Predicting AMR Over Time
In this third example, we aim to predict antimicrobial resistance (AMR)
trends over time using `tidymodels`. We will model resistance to three
antibiotics (amoxicillin `AMX`, amoxicillin-clavulanic acid `AMC`, and
ciprofloxacin `CIP`), based on historical data grouped by year and
hospital ward.
### **Objective**
Our goal is to:
1. Prepare the dataset by aggregating resistance data over time.
2. Define a regression model to predict AMR trends.
3. Use `tidymodels` to preprocess, train, and evaluate the model.
### **Data Preparation**
We start by transforming the `example_isolates` dataset into a
structured time-series format.
``` r
# Load required libraries
library(AMR)
library(tidymodels)
# Transform dataset
data_time <- example_isolates %>%
top_n_microorganisms(n = 10) %>% # Filter on the top #10 species
mutate(year = as.integer(format(date, "%Y")), # Extract year from date
gramstain = mo_gramstain(mo)) %>% # Get taxonomic names
group_by(year, gramstain) %>%
summarise(across(c(AMX, AMC, CIP),
function(x) resistance(x, minimum = 0),
.names = "res_{.col}"),
.groups = "drop") %>%
filter(!is.na(res_AMX) & !is.na(res_AMC) & !is.na(res_CIP)) # Drop missing values
#> Using column 'mo' as input for `col_mo`.
data_time
#> # A tibble: 32 × 5
#> year gramstain res_AMX res_AMC res_CIP
#> <int> <chr> <dbl> <dbl> <dbl>
#> 1 2002 Gram-negative 1 0.105 0.0606
#> 2 2002 Gram-positive 0.838 0.182 0.162
#> 3 2003 Gram-negative 1 0.0714 0
#> 4 2003 Gram-positive 0.714 0.244 0.154
#> 5 2004 Gram-negative 0.464 0.0938 0
#> 6 2004 Gram-positive 0.849 0.299 0.244
#> 7 2005 Gram-negative 0.412 0.132 0.0588
#> 8 2005 Gram-positive 0.882 0.382 0.154
#> 9 2006 Gram-negative 0.379 0 0.1
#> 10 2006 Gram-positive 0.778 0.333 0.353
#> # 22 more rows
```
**Explanation:**
- `mo_name(mo)`: Converts microbial codes into proper species names.
- [`resistance()`](https://amr-for-r.org/reference/proportion.md):
Converts AMR results into numeric values (proportion of resistant
isolates).
- `group_by(year, ward, species)`: Aggregates resistance rates by year
and ward.
### **Defining the Workflow**
We now define the modelling workflow, which consists of a preprocessing
step, a model specification, and the fitting process.
#### 1. Preprocessing with a Recipe
``` r
# Define the recipe
resistance_recipe_time <- recipe(res_AMX ~ year + gramstain, data = data_time) %>%
step_dummy(gramstain, one_hot = TRUE) %>% # Convert categorical to numerical
step_normalize(year) %>% # Normalise year for better model performance
step_nzv(all_predictors()) # Remove near-zero variance predictors
resistance_recipe_time
#>
#> ── Recipe ──────────────────────────────────────────────────────────────────────
#>
#> ── Inputs
#> Number of variables by role
#> outcome: 1
#> predictor: 2
#>
#> ── Operations
#> • Dummy variables from: gramstain
#> • Centering and scaling for: year
#> • Sparse, unbalanced variable filter on: all_predictors()
```
**Explanation:**
- `step_dummy()`: Encodes categorical variables (`ward`, `species`) as
numerical indicators.
- `step_normalize()`: Normalises the `year` variable.
- `step_nzv()`: Removes near-zero variance predictors.
#### 2. Specifying the Model
We use a linear regression model to predict resistance trends.
``` r
# Define the linear regression model
lm_model <- linear_reg() %>%
set_engine("lm") # Use linear regression
lm_model
#> Linear Regression Model Specification (regression)
#>
#> Computational engine: lm
```
**Explanation:**
- `linear_reg()`: Defines a linear regression model.
- `set_engine("lm")`: Uses Rs built-in linear regression engine.
#### 3. Building the Workflow
We combine the preprocessing recipe and model into a workflow.
``` r
# Create workflow
resistance_workflow_time <- workflow() %>%
add_recipe(resistance_recipe_time) %>%
add_model(lm_model)
resistance_workflow_time
#> ══ Workflow ════════════════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: linear_reg()
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 3 Recipe Steps
#>
#> • step_dummy()
#> • step_normalize()
#> • step_nzv()
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#> Linear Regression Model Specification (regression)
#>
#> Computational engine: lm
```
### **Training and Evaluating the Model**
We split the data into training and testing sets, fit the model, and
evaluate performance.
``` r
# Split the data
set.seed(123)
data_split_time <- initial_split(data_time, prop = 0.8)
train_time <- training(data_split_time)
test_time <- testing(data_split_time)
# Train the model
fitted_workflow_time <- resistance_workflow_time %>%
fit(train_time)
# Make predictions
predictions_time <- fitted_workflow_time %>%
predict(test_time) %>%
bind_cols(test_time)
# Evaluate model
metrics_time <- predictions_time %>%
metrics(truth = res_AMX, estimate = .pred)
metrics_time
#> # A tibble: 3 × 3
#> .metric .estimator .estimate
#> <chr> <chr> <dbl>
#> 1 rmse standard 0.0774
#> 2 rsq standard 0.711
#> 3 mae standard 0.0704
```
**Explanation:**
- `initial_split()`: Splits data into training and testing sets.
- `fit()`: Trains the workflow.
- [`predict()`](https://rdrr.io/r/stats/predict.html): Generates
resistance predictions.
- `metrics()`: Evaluates model performance.
### **Visualising Predictions**
We plot resistance trends over time for amoxicillin.
``` r
library(ggplot2)
# Plot actual vs predicted resistance over time
ggplot(predictions_time, aes(x = year)) +
geom_point(aes(y = res_AMX, color = "Actual")) +
geom_line(aes(y = .pred, color = "Predicted")) +
labs(title = "Predicted vs Actual AMX Resistance Over Time",
x = "Year",
y = "Resistance Proportion") +
theme_minimal()
```
![](AMR_with_tidymodels_files/figure-html/unnamed-chunk-14-1.png)
Additionally, we can visualise resistance trends in `ggplot2` and
directly add linear models there:
``` r
ggplot(data_time, aes(x = year, y = res_AMX, color = gramstain)) +
geom_line() +
labs(title = "AMX Resistance Trends",
x = "Year",
y = "Resistance Proportion") +
# add a linear model directly in ggplot2:
geom_smooth(method = "lm",
formula = y ~ x,
alpha = 0.25) +
theme_minimal()
```
![](AMR_with_tidymodels_files/figure-html/unnamed-chunk-15-1.png)
### **Conclusion**
In this example, we demonstrated how to analyze AMR trends over time
using `tidymodels`. By aggregating resistance rates by year and hospital
ward, we built a predictive model to track changes in resistance to
amoxicillin (`AMX`), amoxicillin-clavulanic acid (`AMC`), and
ciprofloxacin (`CIP`).
This method can be extended to other antibiotics and resistance
patterns, providing valuable insights into AMR dynamics in healthcare
settings.

View File

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

126
articles/EUCAST.md Normal file
View File

@@ -0,0 +1,126 @@
# Apply EUCAST rules
## Introduction
What are EUCAST rules? The European Committee on Antimicrobial
Susceptibility Testing (EUCAST) states [on their
website](https://www.eucast.org/expert_rules_and_expected_phenotypes):
> *EUCAST expert rules (see below) are a tabulated collection of expert
> knowledge on interpretive rules, expected resistant phenotypes and
> expected susceptible phenotypes which should be applied to
> antimicrobial susceptibility testing in order to reduce testing,
> reduce errors and make appropriate recommendations for reporting
> particular resistances.*
In Europe, a lot of medical microbiological laboratories already apply
these rules ([Brown *et al.*,
2015](https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008)).
Our package features their latest insights on expected resistant
phenotypes (v1.2, 2023).
## Examples
These rules can be used to discard improbable bug-drug combinations in
your data. For example, *Klebsiella* produces beta-lactamase that
prevents ampicillin (or amoxicillin) from working against it. In other
words, practically every strain of *Klebsiella* is resistant to
ampicillin.
Sometimes, laboratory data can still contain such strains with
*Klebsiella* being susceptible to ampicillin. This could be because an
antibiogram is available before an identification is available, and the
antibiogram is then not re-interpreted based on the identification. The
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
function resolves this, by applying the latest EUCAST Expected
Resistant Phenotypes guideline:
``` r
oops <- tibble::tibble(
mo = c(
"Klebsiella pneumoniae",
"Escherichia coli"
),
ampicillin = as.sir("S")
)
oops
#> # A tibble: 2 × 2
#> mo ampicillin
#> <chr> <sir>
#> 1 Klebsiella pneumoniae S
#> 2 Escherichia coli S
eucast_rules(oops, info = FALSE, overwrite = TRUE)
#> # A tibble: 2 × 2
#> mo ampicillin
#> <chr> <sir>
#> 1 Klebsiella pneumoniae R
#> 2 Escherichia coli S
```
A more convenient function is
[`mo_is_intrinsic_resistant()`](https://amr-for-r.org/reference/mo_property.md)
that uses the same guideline, but allows to check for one or more
specific microorganisms or antimicrobials:
``` r
mo_is_intrinsic_resistant(
c("Klebsiella pneumoniae", "Escherichia coli"),
"ampicillin"
)
#> [1] TRUE FALSE
mo_is_intrinsic_resistant(
"Klebsiella pneumoniae",
c("ampicillin", "kanamycin")
)
#> [1] TRUE FALSE
```
EUCAST rules can not only be used for correction, they can also be used
for filling in known resistance and susceptibility based on results of
other antimicrobials drugs. This process is called *interpretive
reading*, and is basically a form of imputation:
``` r
data <- tibble::tibble(
mo = c(
"Staphylococcus aureus",
"Enterococcus faecalis",
"Escherichia coli",
"Klebsiella pneumoniae",
"Pseudomonas aeruginosa"
),
VAN = "-", # Vancomycin
AMX = "-", # Amoxicillin
COL = "-", # Colistin
CAZ = "-", # Ceftazidime
CXM = "-", # Cefuroxime
PEN = "S", # Benzylenicillin
FOX = "S" # Cefoxitin
)
```
``` r
data
```
| mo | VAN | AMX | COL | CAZ | CXM | PEN | FOX |
|:-----------------------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| Staphylococcus aureus | \- | \- | \- | \- | \- | S | S |
| Enterococcus faecalis | \- | \- | \- | \- | \- | S | S |
| Escherichia coli | \- | \- | \- | \- | \- | S | S |
| Klebsiella pneumoniae | \- | \- | \- | \- | \- | S | S |
| Pseudomonas aeruginosa | \- | \- | \- | \- | \- | S | S |
``` r
eucast_rules(data, overwrite = TRUE)
```
| mo | VAN | AMX | COL | CAZ | CXM | PEN | FOX |
|:-----------------------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| Staphylococcus aureus | \- | S | R | R | S | S | S |
| Enterococcus faecalis | \- | \- | R | R | R | S | R |
| Escherichia coli | R | \- | \- | \- | \- | R | S |
| Klebsiella pneumoniae | R | R | \- | \- | \- | R | S |
| Pseudomonas aeruginosa | R | R | \- | \- | R | R | R |

View File

@@ -30,7 +30,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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,18 +210,18 @@ per drug explain the difference per microorganism.</p>
</h2>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/stats/biplot.html" class="external-link">biplot</a></span><span class="op">(</span><span class="va">pca_result</span><span class="op">)</span></span></code></pre></div>
<p><img src="PCA_files/figure-html/unnamed-chunk-5-1.png" width="750"></p>
<p><img src="PCA_files/figure-html/unnamed-chunk-5-1.png" class="r-plt" width="750"></p>
<p>But we cant see the explanation of the points. Perhaps this works
better with our new <code><a href="../reference/ggplot_pca.html">ggplot_pca()</a></code> function, that
automatically adds the right labels and even groups:</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/ggplot_pca.html">ggplot_pca</a></span><span class="op">(</span><span class="va">pca_result</span><span class="op">)</span></span></code></pre></div>
<p><img src="PCA_files/figure-html/unnamed-chunk-6-1.png" width="750"></p>
<p><img src="PCA_files/figure-html/unnamed-chunk-6-1.png" class="r-plt" width="750"></p>
<p>You can also print an ellipse per group, and edit the appearance:</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/ggplot_pca.html">ggplot_pca</a></span><span class="op">(</span><span class="va">pca_result</span>, ellipse <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span> <span class="op">+</span></span>
<span> <span class="fu">ggplot2</span><span class="fu">::</span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html" class="external-link">labs</a></span><span class="op">(</span>title <span class="op">=</span> <span class="st">"An AMR/PCA biplot!"</span><span class="op">)</span></span></code></pre></div>
<p><img src="PCA_files/figure-html/unnamed-chunk-7-1.png" width="750"></p>
<p><img src="PCA_files/figure-html/unnamed-chunk-7-1.png" class="r-plt" width="750"></p>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside>

157
articles/PCA.md Normal file
View File

@@ -0,0 +1,157 @@
# Conduct principal component analysis (PCA) for AMR
**NOTE: This page will be updated soon, as the pca() function is
currently being developed.**
## Introduction
## Transforming
For PCA, we need to transform our AMR data first. This is what the
`example_isolates` data set in this package looks like:
``` r
library(AMR)
library(dplyr)
glimpse(example_isolates)
#> Rows: 2,000
#> Columns: 46
#> $ date <date> 2002-01-02, 2002-01-03, 2002-01-07, 2002-01-07, 2002-01-13, 2…
#> $ patient <chr> "A77334", "A77334", "067927", "067927", "067927", "067927", "4…
#> $ age <dbl> 65, 65, 45, 45, 45, 45, 78, 78, 45, 79, 67, 67, 71, 71, 75, 50…
#> $ gender <chr> "F", "F", "F", "F", "F", "F", "M", "M", "F", "F", "M", "M", "M…
#> $ ward <chr> "Clinical", "Clinical", "ICU", "ICU", "ICU", "ICU", "Clinical"…
#> $ mo <mo> "B_ESCHR_COLI", "B_ESCHR_COLI", "B_STPHY_EPDR", "B_STPHY_EPDR",…
#> $ PEN <sir> R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, R, S,…
#> $ OXA <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ FLC <sir> NA, NA, R, R, R, R, S, S, R, S, S, S, NA, NA, NA, NA, NA, R, R…
#> $ AMX <sir> NA, NA, NA, NA, NA, NA, R, R, NA, NA, NA, NA, NA, NA, R, NA, N…
#> $ AMC <sir> I, I, NA, NA, NA, NA, S, S, NA, NA, S, S, I, I, R, I, I, NA, N…
#> $ AMP <sir> NA, NA, NA, NA, NA, NA, R, R, NA, NA, NA, NA, NA, NA, R, NA, N…
#> $ TZP <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ CZO <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, NA,…
#> $ FEP <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ CXM <sir> I, I, R, R, R, R, S, S, R, S, S, S, S, S, NA, S, S, R, R, S, S…
#> $ FOX <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, NA,…
#> $ CTX <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, S, S, NA, S, S…
#> $ CAZ <sir> NA, NA, R, R, R, R, R, R, R, R, R, R, NA, NA, NA, S, S, R, R, …
#> $ CRO <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, S, S, NA, S, S…
#> $ GEN <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ TOB <sir> NA, NA, NA, NA, NA, NA, S, S, NA, NA, NA, NA, S, S, NA, NA, NA…
#> $ AMK <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ KAN <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ TMP <sir> R, R, S, S, R, R, R, R, S, S, NA, NA, S, S, S, S, S, R, R, R, …
#> $ SXT <sir> R, R, S, S, NA, NA, NA, NA, S, S, NA, NA, S, S, S, S, S, NA, N…
#> $ NIT <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R,…
#> $ FOS <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ LNZ <sir> R, R, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, R, R, R, R, N…
#> $ CIP <sir> NA, NA, NA, NA, NA, NA, NA, NA, S, S, NA, NA, NA, NA, NA, S, S…
#> $ MFX <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ VAN <sir> R, R, S, S, S, S, S, S, S, S, NA, NA, R, R, R, R, R, S, S, S, …
#> $ TEC <sir> R, R, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, R, R, R, R, N…
#> $ TCY <sir> R, R, S, S, S, S, S, S, S, I, S, S, NA, NA, I, R, R, S, I, R, …
#> $ TGC <sir> NA, NA, S, S, S, S, S, S, S, NA, S, S, NA, NA, NA, R, R, S, NA…
#> $ DOX <sir> NA, NA, S, S, S, S, S, S, S, NA, S, S, NA, NA, NA, R, R, S, NA…
#> $ ERY <sir> R, R, R, R, R, R, S, S, R, S, S, S, R, R, R, R, R, R, R, R, S,…
#> $ CLI <sir> R, R, NA, NA, NA, R, NA, NA, NA, NA, NA, NA, R, R, R, R, R, NA…
#> $ AZM <sir> R, R, R, R, R, R, S, S, R, S, S, S, R, R, R, R, R, R, R, R, S,…
#> $ IPM <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, S, S, NA, S, S…
#> $ MEM <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ MTR <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ CHL <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ COL <sir> NA, NA, R, R, R, R, R, R, R, R, R, R, NA, NA, NA, R, R, R, R, …
#> $ MUP <sir> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ RIF <sir> R, R, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, R, R, R, R, R, N…
```
Now to transform this to a data set with only resistance percentages per
taxonomic order and genus:
``` r
resistance_data <- example_isolates %>%
group_by(
order = mo_order(mo), # group on anything, like order
genus = mo_genus(mo)
) %>% # and genus as we do here
summarise_if(is.sir, resistance) %>% # then get resistance of all drugs
select(
order, genus, AMC, CXM, CTX,
CAZ, GEN, TOB, TMP, SXT
) # and select only relevant columns
head(resistance_data)
#> # A tibble: 6 × 10
#> # Groups: order [5]
#> order genus AMC CXM CTX CAZ GEN TOB TMP SXT
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 (unknown order) (unknown ge… NA NA NA NA NA NA NA NA
#> 2 Actinomycetales Schaalia NA NA NA NA NA NA NA NA
#> 3 Bacteroidales Bacteroides NA NA NA NA NA NA NA NA
#> 4 Campylobacterales Campylobact… NA NA NA NA NA NA NA NA
#> 5 Caryophanales Gemella NA NA NA NA NA NA NA NA
#> 6 Caryophanales Listeria NA NA NA NA NA NA NA NA
```
## Perform principal component analysis
The new [`pca()`](https://amr-for-r.org/reference/pca.md) function will
automatically filter on rows that contain numeric values in all selected
variables, so we now only need to do:
``` r
pca_result <- pca(resistance_data)
#> Columns selected for PCA: "AMC", "CAZ", "CTX", "CXM", "GEN", "SXT",
#> "TMP", and "TOB". Total observations available: 7.
```
The result can be reviewed with the good old
[`summary()`](https://rdrr.io/r/base/summary.html) function:
``` r
summary(pca_result)
#> Groups (n=4, named as 'order'):
#> [1] "Caryophanales" "Enterobacterales" "Lactobacillales" "Pseudomonadales"
#> Importance of components:
#> PC1 PC2 PC3 PC4 PC5 PC6 PC7
#> Standard deviation 2.1539 1.6807 0.6138 0.33879 0.20808 0.03140 1.232e-16
#> Proportion of Variance 0.5799 0.3531 0.0471 0.01435 0.00541 0.00012 0.000e+00
#> Cumulative Proportion 0.5799 0.9330 0.9801 0.99446 0.99988 1.00000 1.000e+00
```
#> Groups (n=4, named as 'order'):
#> [1] "Caryophanales" "Enterobacterales" "Lactobacillales" "Pseudomonadales"
Good news. The first two components explain a total of 93.3% of the
variance (see the PC1 and PC2 values of the *Proportion of Variance*. We
can create a so-called biplot with the base R
[`biplot()`](https://rdrr.io/r/stats/biplot.html) function, to see which
antimicrobial resistance per drug explain the difference per
microorganism.
## Plotting the results
``` r
biplot(pca_result)
```
![](PCA_files/figure-html/unnamed-chunk-5-1.png)
But we cant see the explanation of the points. Perhaps this works
better with our new
[`ggplot_pca()`](https://amr-for-r.org/reference/ggplot_pca.md)
function, that automatically adds the right labels and even groups:
``` r
ggplot_pca(pca_result)
```
![](PCA_files/figure-html/unnamed-chunk-6-1.png)
You can also print an ellipse per group, and edit the appearance:
``` r
ggplot_pca(pca_result, ellipse = TRUE) +
ggplot2::labs(title = "An AMR/PCA biplot!")
```
![](PCA_files/figure-html/unnamed-chunk-7-1.png)

View File

@@ -30,7 +30,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -311,7 +311,7 @@ using the included <code><a href="../reference/ggplot_sir.html">ggplot_sir()</a>
<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">Country</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="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">Country</span>, <span class="va">AMP_ND2</span>, <span class="va">AMC_ED20</span>, <span class="va">CAZ_ED10</span>, <span class="va">CIP_ED5</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="fu"><a href="../reference/ggplot_sir.html">ggplot_sir</a></span><span class="op">(</span>translate_ab <span class="op">=</span> <span class="st">"ab"</span>, facet <span class="op">=</span> <span class="st">"Country"</span>, datalabels <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></code></pre></div>
<p><img src="WHONET_files/figure-html/unnamed-chunk-7-1.png" width="720"></p>
<p><img src="WHONET_files/figure-html/unnamed-chunk-7-1.png" class="r-plt" width="720"></p>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside>

137
articles/WHONET.md Normal file
View File

@@ -0,0 +1,137 @@
# Work with WHONET data
### Import of data
This tutorial assumes you already imported the WHONET data with e.g. the
[`readxl` package](https://readxl.tidyverse.org/). In RStudio, this can
be done using the menu button Import Dataset in the tab Environment.
Choose the option From Excel and select your exported file. Make sure
date fields are imported correctly.
An example syntax could look like this:
``` r
library(readxl)
data <- read_excel(path = "path/to/your/file.xlsx")
```
This package comes with an [example data set
`WHONET`](https://amr-for-r.org/reference/WHONET.html). We will use it
for this analysis.
### Preparation
First, load the relevant packages if you did not yet did this. I use the
tidyverse for all of my analyses. All of them. If you dont know it yet,
I suggest you read about it on their website:
<https://www.tidyverse.org/>.
``` r
library(dplyr) # part of tidyverse
library(ggplot2) # part of tidyverse
library(AMR) # this package
library(cleaner) # to create frequency tables
```
We will have to transform some variables to simplify and automate the
analysis:
- Microorganisms should be transformed to our own microorganism codes
(called an `mo`) using [our Catalogue of Life reference data
set](https://amr-for-r.org/reference/catalogue_of_life), which
contains all ~70,000 microorganisms from the taxonomic kingdoms
Bacteria, Fungi and Protozoa. We do the tranformation with
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md). This function
also recognises almost all WHONET abbreviations of microorganisms.
- Antimicrobial results or interpretations have to be clean and valid.
In other words, they should only contain values `"S"`, `"I"` or `"R"`.
That is exactly where the
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md) function is
for.
``` r
# transform variables
data <- WHONET %>%
# get microbial ID based on given organism
mutate(mo = as.mo(Organism)) %>%
# transform everything from "AMP_ND10" to "CIP_EE" to the new `sir` class
mutate_at(vars(AMP_ND10:CIP_EE), as.sir)
```
No errors or warnings, so all values are transformed succesfully.
We also created a package dedicated to data cleaning and checking,
called the `cleaner` package. Its
[`freq()`](https://msberends.github.io/cleaner/reference/freq.html)
function can be used to create frequency tables.
So lets check our data, with a couple of frequency tables:
``` r
# our newly created `mo` variable, put in the mo_name() function
data %>% freq(mo_name(mo), nmax = 10)
```
**Frequency table**
Class: character
Length: 500
Available: 500 (100%, NA: 0 = 0%)
Unique: 38
Shortest: 11
Longest: 40
| | Item | Count | Percent | Cum. Count | Cum. Percent |
|:----|:-----------------------------------------|------:|--------:|-----------:|-------------:|
| 1 | Escherichia coli | 245 | 49.0% | 245 | 49.0% |
| 2 | Coagulase-negative Staphylococcus (CoNS) | 74 | 14.8% | 319 | 63.8% |
| 3 | Staphylococcus epidermidis | 38 | 7.6% | 357 | 71.4% |
| 4 | Streptococcus pneumoniae | 31 | 6.2% | 388 | 77.6% |
| 5 | Staphylococcus hominis | 21 | 4.2% | 409 | 81.8% |
| 6 | Proteus mirabilis | 9 | 1.8% | 418 | 83.6% |
| 7 | Enterococcus faecium | 8 | 1.6% | 426 | 85.2% |
| 8 | Staphylococcus capitis urealyticus | 8 | 1.6% | 434 | 86.8% |
| 9 | Enterobacter cloacae | 5 | 1.0% | 439 | 87.8% |
| 10 | Enterococcus columbae | 4 | 0.8% | 443 | 88.6% |
(omitted 28 entries, n = 57 \[11.4%\])
``` r
# our transformed antibiotic columns
# amoxicillin/clavulanic acid (J01CR02) as an example
data %>% freq(AMC_ND2)
```
**Frequency table**
Class: factor \> ordered \> sir (numeric)
Length: 500
Levels: 5: S \< SDD \< I \< R \< NI
Available: 481 (96.2%, NA: 19 = 3.8%)
Unique: 3
Drug: Amoxicillin/clavulanic acid (AMC, J01CR02/QJ01CR02)
Drug group: Beta-lactams/penicillins
%SI: 78.59%
| | Item | Count | Percent | Cum. Count | Cum. Percent |
|:----|:-----|------:|--------:|-----------:|-------------:|
| 1 | S | 356 | 74.01% | 356 | 74.01% |
| 2 | R | 103 | 21.41% | 459 | 95.43% |
| 3 | I | 22 | 4.57% | 481 | 100.00% |
### A first glimpse at results
An easy `ggplot` will already give a lot of information, using the
included [`ggplot_sir()`](https://amr-for-r.org/reference/ggplot_sir.md)
function:
``` r
data %>%
group_by(Country) %>%
select(Country, AMP_ND2, AMC_ED20, CAZ_ED10, CIP_ED5) %>%
ggplot_sir(translate_ab = "ab", facet = "Country", datalabels = FALSE)
```
![](WHONET_files/figure-html/unnamed-chunk-7-1.png)

View File

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

252
articles/WISCA.md Normal file
View File

@@ -0,0 +1,252 @@
# Estimating Empirical Coverage with WISCA
> This explainer was largely written by our [AMR for R
> Assistant](https://chat.amr-for-r.org), a ChatGPT manually-trained
> model able to answer any question about the `AMR` package.
## Introduction
Clinical guidelines for empirical antimicrobial therapy require
*probabilistic reasoning*: what is the chance that a regimen will cover
the likely infecting organisms, before culture results are available?
This is the purpose of **WISCA**, or **Weighted-Incidence Syndromic
Combination Antibiogram**.
WISCA is a Bayesian approach that integrates:
- **Pathogen prevalence** (how often each species causes the syndrome),
- **Regimen susceptibility** (how often a regimen works *if* the
pathogen is known),
to estimate the **overall empirical coverage** of antimicrobial
regimens, with quantified uncertainty.
This vignette explains how WISCA works, why it is useful, and how to
apply it using the `AMR` package.
## Why traditional antibiograms fall short
A standard antibiogram gives you:
Species → Antibiotic → Susceptibility %
But clinicians dont know the species *a priori*. They need to choose a
regimen that covers the **likely pathogens**, without knowing which one
is present.
Traditional antibiograms calculate the susceptibility % as just the
number of resistant isolates divided by the total number of tested
isolates. Therefore, traditional antibiograms:
- Fragment information by organism,
- Do not weight by real-world prevalence,
- Do not account for combination therapy or sample size,
- Do not provide uncertainty.
## The idea of WISCA
WISCA asks:
> “What is the **probability** that this regimen **will cover** the
> pathogen, given the syndrome?”
This means combining two things:
- **Incidence** of each pathogen in the syndrome,
- **Susceptibility** of each pathogen to the regimen.
We can write this as:
$$\text{Coverage} = \sum\limits_{i}\left( \text{Incidence}_{i} \times \text{Susceptibility}_{i} \right)$$
For example, suppose:
- *E. coli* causes 60% of cases, and 90% of *E. coli* are susceptible to
a drug.
- *Klebsiella* causes 40% of cases, and 70% of *Klebsiella* are
susceptible.
Then:
$$\text{Coverage} = (0.6 \times 0.9) + (0.4 \times 0.7) = 0.82$$
But in real data, incidence and susceptibility are **estimated from
samples**, so they carry uncertainty. WISCA models this
**probabilistically**, using conjugate Bayesian distributions.
## The Bayesian engine behind WISCA
### Pathogen incidence
Let:
- $K$ be the number of pathogens,
- $\alpha = (1,1,\ldots,1)$ be a **Dirichlet** prior (uniform),
- $n = \left( n_{1},\ldots,n_{K} \right)$ be the observed counts per
species.
Then the posterior incidence is:
$$p \sim \text{Dirichlet}\left( \alpha_{1} + n_{1},\ldots,\alpha_{K} + n_{K} \right)$$
To simulate from this, we use:
$$x_{i} \sim \text{Gamma}\left( \alpha_{i} + n_{i},\ 1 \right),\quad p_{i} = \frac{x_{i}}{\sum\limits_{j = 1}^{K}x_{j}}$$
### Susceptibility
Each pathogenregimen pair has a prior and data:
- Prior: $\text{Beta}\left( \alpha_{0},\beta_{0} \right)$, with default
$\alpha_{0} = \beta_{0} = 1$
- Data: $S$ susceptible out of $N$ tested
The $S$ category could also include values SDD (susceptible,
dose-dependent) and I (intermediate \[CLSI\], or susceptible, increased
exposure \[EUCAST\]).
Then the posterior is:
$$\theta \sim \text{Beta}\left( \alpha_{0} + S,\ \beta_{0} + N - S \right)$$
### Final coverage estimate
Putting it together:
1. Simulate pathogen incidence: $\mathbf{p} \sim \text{Dirichlet}$
2. Simulate susceptibility:
$\theta_{i} \sim \text{Beta}\left( 1 + S_{i},\ 1 + R_{i} \right)$
3. Combine:
$$\text{Coverage} = \sum\limits_{i = 1}^{K}p_{i} \cdot \theta_{i}$$
Repeat this simulation (e.g. 1000×) and summarise:
- **Mean** = expected coverage
- **Quantiles** = credible interval
## Practical use in the `AMR` package
### Prepare data and simulate synthetic syndrome
``` r
library(AMR)
data <- example_isolates
# Structure of our data
data
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
# Add a fake syndrome column
data$syndrome <- ifelse(data$mo %like% "coli", "UTI", "No UTI")
```
### Basic WISCA antibiogram
``` r
wisca(data,
antimicrobials = c("AMC", "CIP", "GEN"))
```
| Amoxicillin/clavulanic acid | Ciprofloxacin | Gentamicin |
|:----------------------------|:-----------------|:-------------------|
| 73.7% (71.7-75.8%) | 77% (74.3-79.4%) | 72.8% (70.7-74.8%) |
### Use combination regimens
``` r
wisca(data,
antimicrobials = c("AMC", "AMC + CIP", "AMC + GEN"))
```
| Amoxicillin/clavulanic acid | Amoxicillin/clavulanic acid + Ciprofloxacin | Amoxicillin/clavulanic acid + Gentamicin |
|:----------------------------|:--------------------------------------------|:-----------------------------------------|
| 73.8% (71.8-75.7%) | 87.5% (85.9-89%) | 89.7% (88.2-91.1%) |
### Stratify by syndrome
``` r
wisca(data,
antimicrobials = c("AMC", "AMC + CIP", "AMC + GEN"),
syndromic_group = "syndrome")
```
| Syndromic Group | Amoxicillin/clavulanic acid | Amoxicillin/clavulanic acid + Ciprofloxacin | Amoxicillin/clavulanic acid + Gentamicin |
|:----------------|:----------------------------|:--------------------------------------------|:-----------------------------------------|
| No UTI | 70.1% (67.8-72.3%) | 85.2% (83.1-87.2%) | 87.1% (85.3-88.7%) |
| UTI | 80.9% (77.7-83.8%) | 88.2% (85.7-90.5%) | 90.9% (88.7-93%) |
The `AMR` package is available in 28 languages, which can all be used
for the [`wisca()`](https://amr-for-r.org/reference/antibiogram.md)
function too:
``` r
wisca(data,
antimicrobials = c("AMC", "AMC + CIP", "AMC + GEN"),
syndromic_group = gsub("UTI", "UCI", data$syndrome),
language = "Spanish")
```
| Grupo sindrómico | Amoxicilina/ácido clavulánico | Amoxicilina/ácido clavulánico + Ciprofloxacina | Amoxicilina/ácido clavulánico + Gentamicina |
|:-----------------|:------------------------------|:-----------------------------------------------|:--------------------------------------------|
| No UCI | 70% (67.8-72.4%) | 85.3% (83.3-87.2%) | 87% (85.3-88.8%) |
| UCI | 80.9% (77.7-83.9%) | 88.2% (85.5-90.6%) | 90.9% (88.7-93%) |
## Sensible defaults, which can be customised
- `simulations = 1000`: number of Monte Carlo draws
- `conf_interval = 0.95`: coverage interval width
- `combine_SI = TRUE`: count “I” and “SDD” as susceptible
## Limitations
- It assumes your data are representative
- No adjustment for patient-level covariates, although these could be
passed onto the `syndromic_group` argument
- WISCA does not model resistance over time, you might want to use
`tidymodels` for that, for which we [wrote a basic
introduction](https://amr-for-r.org/articles/AMR_with_tidymodels.html)
## Summary
WISCA enables:
- Empirical regimen comparison,
- Syndrome-specific coverage estimation,
- Fully probabilistic interpretation.
It is available in the `AMR` package via either:
``` r
wisca(...)
antibiogram(..., wisca = TRUE)
```
## Reference
Bielicki, JA, et al. (2016). *Selecting appropriate empirical antibiotic
regimens for paediatric bloodstream infections: application of a
Bayesian decision model to local and pooled antimicrobial resistance
surveillance data.* **J Antimicrob Chemother**. 71(3):794-802.
<https://doi.org/10.1093/jac/dkv397>

View File

@@ -30,7 +30,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -80,7 +80,7 @@
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.svg" class="logo" alt=""><h1>Download data sets for download / own use</h1>
<h4 data-toc-skip class="date">13 October 2025</h4>
<h4 data-toc-skip class="date">24 November 2025</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small>
<div class="d-none name"><code>datasets.Rmd</code></div>
@@ -417,14 +417,14 @@ all SNOMED codes as comma separated values.</p>
<h2 id="antimicrobials-antibiotic-and-antifungal-drugs">
<code>antimicrobials</code>: Antibiotic and Antifungal Drugs<a class="anchor" aria-label="anchor" href="#antimicrobials-antibiotic-and-antifungal-drugs"></a>
</h2>
<p>A data set with 496 rows and 14 columns, containing the following
<p>A data set with 498 rows and 14 columns, containing the following
column names:<br><em>ab</em>, <em>cid</em>, <em>name</em>, <em>group</em>, <em>atc</em>,
<em>atc_group1</em>, <em>atc_group2</em>, <em>abbreviations</em>,
<em>synonyms</em>, <em>oral_ddd</em>, <em>oral_units</em>,
<em>iv_ddd</em>, <em>iv_units</em>, and <em>loinc</em>.</p>
<p>This data set is in R available as <code>antimicrobials</code>, after
you load the <code>AMR</code> package.</p>
<p>It was last updated on 1 September 2025 14:56:55 UTC. Find more info
<p>It was last updated on 24 November 2025 10:24:02 UTC. Find more info
about the contents, (scientific) source, and structure of this <a href="https://amr-for-r.org/reference/antimicrobials.html">data set
here</a>.</p>
<p><strong>Direct download links:</strong></p>

561
articles/datasets.md Normal file
View File

@@ -0,0 +1,561 @@
# Download data sets for download / own use
All reference data (about microorganisms, antimicrobials, SIR
interpretation, EUCAST rules, etc.) in this `AMR` package are reliable,
up-to-date and freely available. We continually export our data sets to
formats for use in R, MS Excel, Apache Feather, Apache Parquet, SPSS,
and Stata. We also provide tab-separated text files that are
machine-readable and suitable for input in any software program, such as
laboratory information systems.
> If you are working in Python, be sure to use our [AMR for
> Python](https://amr-for-r.org/articles/AMR_for_Python.html) package.
> It allows all relevant AMR data sets to be natively available in
> Python.
## `microorganisms`: Full Microbial Taxonomy
A data set with 78 679 rows and 26 columns, containing the following
column names:
*mo*, *fullname*, *status*, *kingdom*, *phylum*, *class*, *order*,
*family*, *genus*, *species*, *subspecies*, *rank*, *ref*,
*oxygen_tolerance*, *source*, *lpsn*, *lpsn_parent*, *lpsn_renamed_to*,
*mycobank*, *mycobank_parent*, *mycobank_renamed_to*, *gbif*,
*gbif_parent*, *gbif_renamed_to*, *prevalence*, and *snomed*.
This data set is in R available as `microorganisms`, after you load the
`AMR` package.
It was last updated on 18 September 2025 12:58:34 UTC. Find more info
about the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/microorganisms.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.rds)
(1.8 MB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.txt)
(17.7 MB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.xlsx)
(8.8 MB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.feather)
(8.4 MB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.parquet)
(3.8 MB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.sav)
(28.4 MB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.dta)
(89.5 MB)
**NOTE: The exported files for SPSS and Stata contain only the first 50
SNOMED codes per record, as their file size would otherwise exceed 100
MB; the file size limit of GitHub.** Their file structures and
compression techniques are very inefficient. Advice? Use R instead. Its
free and much better in many ways.
The tab-separated text file and Microsoft Excel workbook both contain
all SNOMED codes as comma separated values.
**Example content**
Included (sub)species per taxonomic kingdom:
| Kingdom | Number of (sub)species |
|:-----------------:|:----------------------:|
| (unknown kingdom) | 1 |
| Animalia | 1 628 |
| Archaea | 1 419 |
| Bacteria | 39 249 |
| Chromista | 178 |
| Fungi | 28 137 |
First 6 rows when filtering on genus *Escherichia*:
| mo | fullname | status | kingdom | phylum | class | order | family | genus | species | subspecies | rank | ref | oxygen_tolerance | source | lpsn | lpsn_parent | lpsn_renamed_to | mycobank | mycobank_parent | mycobank_renamed_to | gbif | gbif_parent | gbif_renamed_to | prevalence | snomed |
|:-----------------:|:--------------------------:|:--------:|:--------:|:--------------:|:-------------------:|:----------------:|:------------------:|:-----------:|:--------------:|:----------:|:----------:|:-----------------------:|:---------------------------:|:------:|:------:|:-----------:|:---------------:|:--------:|:---------------:|:-------------------:|:--------:|:-----------:|:---------------:|:----------:|:-----------------------------------------:|
| B_ESCHR | Escherichia | accepted | Bacteria | Pseudomonadota | Gammaproteobacteria | Enterobacterales | Enterobacteriaceae | Escherichia | | | genus | Castellani et al., 1919 | facultative anaerobe | LPSN | 515602 | 482 | | | | | | 11158430 | | 1 | 407310004, 407251000, 407281008, … |
| B_ESCHR_ADCR | Escherichia adecarboxylata | synonym | Bacteria | Pseudomonadota | Gammaproteobacteria | Enterobacterales | Enterobacteriaceae | Escherichia | adecarboxylata | | species | Leclerc, 1962 | likely facultative anaerobe | LPSN | 776052 | 515602 | 777447 | | | | | | | 1 | |
| B_ESCHR_ALBR | Escherichia albertii | accepted | Bacteria | Pseudomonadota | Gammaproteobacteria | Enterobacterales | Enterobacteriaceae | Escherichia | albertii | | species | Huys et al., 2003 | facultative anaerobe | LPSN | 776053 | 515602 | | | | | 5427575 | | | 1 | 419388003 |
| B_ESCHR_BLTT | Escherichia blattae | synonym | Bacteria | Pseudomonadota | Gammaproteobacteria | Enterobacterales | Enterobacteriaceae | Escherichia | blattae | | species | Burgess et al., 1973 | likely facultative anaerobe | LPSN | 776056 | 515602 | 788468 | | | | | | | 1 | |
| B_ESCHR_COLI | Escherichia coli | accepted | Bacteria | Pseudomonadota | Gammaproteobacteria | Enterobacterales | Enterobacteriaceae | Escherichia | coli | | species | Castellani et al., 1919 | facultative anaerobe | LPSN | 776057 | 515602 | | | | | 11286021 | | | 1 | 1095001000112106, 715307006, 737528008, … |
| B_ESCHR_COLI_COLI | Escherichia coli coli | accepted | Bacteria | Pseudomonadota | Gammaproteobacteria | Enterobacterales | Enterobacteriaceae | Escherichia | coli | coli | subspecies | | | GBIF | | 776057 | | | | | 12233256 | 11286021 | | 1 | |
------------------------------------------------------------------------
## `antimicrobials`: Antibiotic and Antifungal Drugs
A data set with 498 rows and 14 columns, containing the following column
names:
*ab*, *cid*, *name*, *group*, *atc*, *atc_group1*, *atc_group2*,
*abbreviations*, *synonyms*, *oral_ddd*, *oral_units*, *iv_ddd*,
*iv_units*, and *loinc*.
This data set is in R available as `antimicrobials`, after you load the
`AMR` package.
It was last updated on 24 November 2025 10:24:02 UTC. Find more info
about the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/antimicrobials.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antimicrobials.rds)
(45 kB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antimicrobials.txt)
(0.1 MB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antimicrobials.xlsx)
(78 kB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antimicrobials.feather)
(0.1 MB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antimicrobials.parquet)
(0.1 MB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antimicrobials.sav)
(0.4 MB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antimicrobials.dta)
(10 kB)
The tab-separated text, Microsoft Excel, SPSS, and Stata files all
contain the ATC codes, common abbreviations, trade names and LOINC codes
as comma separated values.
**Example content**
| ab | cid | name | group | atc | atc_group1 | atc_group2 | abbreviations | synonyms | oral_ddd | oral_units | iv_ddd | iv_units | loinc |
|:---:|:--------:|:---------------------------:|:------------------------:|:------------------------------:|:-------------------------------------------:|:------------------------------------------------------------:|:-------------------:|:-------------------------------------------------------:|:--------:|:----------:|:------:|:--------:|:------------------------------:|
| AMK | 37768 | Amikacin | Aminoglycosides | D06AX12, J01GB06, QD06AX12, … | Aminoglycoside antibacterials | Other aminoglycosides | ak, ami, amik, … | amikacillin, amikacina, amikacine, … | | | 1.0 | g | 101493-5, 11-7, 12-5, … |
| AMX | 33613 | Amoxicillin | Beta-lactams/penicillins | J01CA04, QG51AA03, QJ01CA04 | Beta-lactam antibacterials, penicillins | Penicillins with extended spectrum | ac, amox, amoxic, … | acuotricina, alfamox, alfida, … | 1.5 | g | 3.0 | g | 101498-4, 15-8, 16-6, … |
| AMC | 23665637 | Amoxicillin/clavulanic acid | Beta-lactams/penicillins | J01CR02, QJ01CR02 | Beta-lactam antibacterials, penicillins | Combinations of penicillins, incl. beta-lactamase inhibitors | a/c, amcl, aml, … | amocla, amoclan, amoclav, … | 1.5 | g | 3.0 | g | |
| AMP | 6249 | Ampicillin | Beta-lactams/penicillins | J01CA01, QJ01CA01, QJ51CA01, … | Beta-lactam antibacterials, penicillins | Penicillins with extended spectrum | am, amp, amp100, … | adobacillin, alpen, amblosin, … | 2.0 | g | 6.0 | g | 101477-8, 101478-6, 18864-9, … |
| AZM | 447043 | Azithromycin | Macrolides/lincosamides | J01FA10, QJ01FA10, QS01AA26, … | Macrolides, lincosamides and streptogramins | Macrolides | az, azi, azit, … | aritromicina, aruzilina, azasite, … | 0.3 | g | 0.5 | g | 100043-9, 16420-2, 16421-0, … |
| PEN | 5904 | Benzylpenicillin | Beta-lactams/penicillins | J01CE01, QJ01CE01, QJ51CE01, … | Combinations of antibacterials | Combinations of antibacterials | bepe, pen, peni, … | bencilpenicilina, benzopenicillin, benzylpenicilline, … | | | 3.6 | g | |
------------------------------------------------------------------------
## `clinical_breakpoints`: Interpretation from MIC values & disk diameters to SIR
A data set with 40 217 rows and 14 columns, containing the following
column names:
*guideline*, *type*, *host*, *method*, *site*, *mo*, *rank_index*, *ab*,
*ref_tbl*, *disk_dose*, *breakpoint_S*, *breakpoint_R*, *uti*, and
*is_SDD*.
This data set is in R available as `clinical_breakpoints`, after you
load the `AMR` package.
It was last updated on 20 April 2025 10:55:31 UTC. Find more info about
the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/clinical_breakpoints.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/clinical_breakpoints.rds)
(88 kB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/clinical_breakpoints.txt)
(3.7 MB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/clinical_breakpoints.xlsx)
(2.4 MB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/clinical_breakpoints.feather)
(1.8 MB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/clinical_breakpoints.parquet)
(0.1 MB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/clinical_breakpoints.sav)
(6.6 MB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/clinical_breakpoints.dta)
(11.1 MB)
**Example content**
| guideline | type | host | method | site | mo | mo_name | rank_index | ab | ab_name | ref_tbl | disk_dose | breakpoint_S | breakpoint_R | uti | is_SDD |
|:-----------:|:-----:|:-----:|:------:|:----:|:-------------:|:--------------------------:|:----------:|:---:|:-----------------------------:|:---------------:|:--------------:|:------------:|:------------:|:-----:|:------:|
| EUCAST 2025 | human | human | DISK | | B_ACHRMB_XYLS | Achromobacter xylosoxidans | 2 | MEM | Meropenem | A. xylosoxidans | 10 mcg | 26.000 | 20.000 | FALSE | FALSE |
| EUCAST 2025 | human | human | MIC | | B_ACHRMB_XYLS | Achromobacter xylosoxidans | 2 | MEM | Meropenem | A. xylosoxidans | | 1.000 | 4.000 | FALSE | FALSE |
| EUCAST 2025 | human | human | DISK | | B_ACHRMB_XYLS | Achromobacter xylosoxidans | 2 | SXT | Trimethoprim/sulfamethoxazole | A. xylosoxidans | 1.25/23.75 mcg | 26.000 | 26.000 | FALSE | FALSE |
| EUCAST 2025 | human | human | MIC | | B_ACHRMB_XYLS | Achromobacter xylosoxidans | 2 | SXT | Trimethoprim/sulfamethoxazole | A. xylosoxidans | | 0.125 | 0.125 | FALSE | FALSE |
| EUCAST 2025 | human | human | DISK | | B_ACHRMB_XYLS | Achromobacter xylosoxidans | 2 | TZP | Piperacillin/tazobactam | A. xylosoxidans | 30/6 mcg | 26.000 | 26.000 | FALSE | FALSE |
| EUCAST 2025 | human | human | MIC | | B_ACHRMB_XYLS | Achromobacter xylosoxidans | 2 | TZP | Piperacillin/tazobactam | A. xylosoxidans | | 4.000 | 4.000 | FALSE | FALSE |
------------------------------------------------------------------------
## `microorganisms.groups`: Species Groups and Microbiological Complexes
A data set with 534 rows and 4 columns, containing the following column
names:
*mo_group*, *mo*, *mo_group_name*, and *mo_name*.
This data set is in R available as `microorganisms.groups`, after you
load the `AMR` package.
It was last updated on 26 March 2025 16:19:17 UTC. Find more info about
the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/microorganisms.groups.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.groups.rds)
(6 kB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.groups.txt)
(50 kB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.groups.xlsx)
(20 kB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.groups.feather)
(19 kB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.groups.parquet)
(13 kB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.groups.sav)
(65 kB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.groups.dta)
(83 kB)
**Example content**
| mo_group | mo | mo_group_name | mo_name |
|:--------------:|:------------:|:-------------------------------:|:---------------------------:|
| B_ACNTB_BMNN-C | B_ACNTB_BMNN | Acinetobacter baumannii complex | Acinetobacter baumannii |
| B_ACNTB_BMNN-C | B_ACNTB_CLCC | Acinetobacter baumannii complex | Acinetobacter calcoaceticus |
| B_ACNTB_BMNN-C | B_ACNTB_LCTC | Acinetobacter baumannii complex | Acinetobacter dijkshoorniae |
| B_ACNTB_BMNN-C | B_ACNTB_NSCM | Acinetobacter baumannii complex | Acinetobacter nosocomialis |
| B_ACNTB_BMNN-C | B_ACNTB_PITT | Acinetobacter baumannii complex | Acinetobacter pittii |
| B_ACNTB_BMNN-C | B_ACNTB_SFRT | Acinetobacter baumannii complex | Acinetobacter seifertii |
------------------------------------------------------------------------
## `intrinsic_resistant`: Intrinsic Bacterial Resistance
A data set with 271 905 rows and 2 columns, containing the following
column names:
*mo* and *ab*.
This data set is in R available as `intrinsic_resistant`, after you load
the `AMR` package.
It was last updated on 28 March 2025 10:17:49 UTC. Find more info about
the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/intrinsic_resistant.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/intrinsic_resistant.rds)
(0.1 MB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/intrinsic_resistant.txt)
(10.1 MB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/intrinsic_resistant.xlsx)
(2.9 MB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/intrinsic_resistant.feather)
(2.3 MB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/intrinsic_resistant.parquet)
(0.3 MB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/intrinsic_resistant.sav)
(14.8 MB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/intrinsic_resistant.dta)
(22.6 MB)
**Example content**
Example rows when filtering on *Enterobacter cloacae*:
| microorganism | antibiotic |
|:--------------------:|:---------------------------:|
| Enterobacter cloacae | Acetylmidecamycin |
| Enterobacter cloacae | Acetylspiramycin |
| Enterobacter cloacae | Amoxicillin |
| Enterobacter cloacae | Amoxicillin/clavulanic acid |
| Enterobacter cloacae | Ampicillin |
| Enterobacter cloacae | Ampicillin/sulbactam |
| Enterobacter cloacae | Avoparcin |
| Enterobacter cloacae | Azithromycin |
| Enterobacter cloacae | Benzylpenicillin |
| Enterobacter cloacae | Bleomycin |
| Enterobacter cloacae | Cadazolid |
| Enterobacter cloacae | Cefadroxil |
| Enterobacter cloacae | Cefalexin |
| Enterobacter cloacae | Cefalotin |
| Enterobacter cloacae | Cefazolin |
| Enterobacter cloacae | Cefoxitin |
| Enterobacter cloacae | Clarithromycin |
| Enterobacter cloacae | Clindamycin |
| Enterobacter cloacae | Cycloserine |
| Enterobacter cloacae | Dalbavancin |
| Enterobacter cloacae | Dirithromycin |
| Enterobacter cloacae | Erythromycin |
| Enterobacter cloacae | Flurithromycin |
| Enterobacter cloacae | Fusidic acid |
| Enterobacter cloacae | Gamithromycin |
| Enterobacter cloacae | Josamycin |
| Enterobacter cloacae | Kitasamycin |
| Enterobacter cloacae | Lincomycin |
| Enterobacter cloacae | Linezolid |
| Enterobacter cloacae | Meleumycin |
| Enterobacter cloacae | Midecamycin |
| Enterobacter cloacae | Miocamycin |
| Enterobacter cloacae | Nafithromycin |
| Enterobacter cloacae | Norvancomycin |
| Enterobacter cloacae | Oleandomycin |
| Enterobacter cloacae | Oritavancin |
| Enterobacter cloacae | Pirlimycin |
| Enterobacter cloacae | Pristinamycin |
| Enterobacter cloacae | Quinupristin/dalfopristin |
| Enterobacter cloacae | Ramoplanin |
| Enterobacter cloacae | Rifampicin |
| Enterobacter cloacae | Rokitamycin |
| Enterobacter cloacae | Roxithromycin |
| Enterobacter cloacae | Solithromycin |
| Enterobacter cloacae | Spiramycin |
| Enterobacter cloacae | Tedizolid |
| Enterobacter cloacae | Teicoplanin |
| Enterobacter cloacae | Telavancin |
| Enterobacter cloacae | Telithromycin |
| Enterobacter cloacae | Thiacetazone |
| Enterobacter cloacae | Tildipirosin |
| Enterobacter cloacae | Tilmicosin |
| Enterobacter cloacae | Troleandomycin |
| Enterobacter cloacae | Tulathromycin |
| Enterobacter cloacae | Tylosin |
| Enterobacter cloacae | Tylvalosin |
| Enterobacter cloacae | Vancomycin |
------------------------------------------------------------------------
## `dosage`: Dosage Guidelines from EUCAST
A data set with 759 rows and 9 columns, containing the following column
names:
*ab*, *name*, *type*, *dose*, *dose_times*, *administration*, *notes*,
*original_txt*, and *eucast_version*.
This data set is in R available as `dosage`, after you load the `AMR`
package.
It was last updated on 20 April 2025 10:55:31 UTC. Find more info about
the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/dosage.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/dosage.rds)
(4 kB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/dosage.txt)
(66 kB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/dosage.xlsx)
(37 kB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/dosage.feather)
(28 kB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/dosage.parquet)
(9 kB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/dosage.sav)
(97 kB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/dosage.dta)
(0.2 MB)
**Example content**
| ab | name | type | dose | dose_times | administration | notes | original_txt | eucast_version |
|:---:|:-----------:|:-----------------:|:-----------:|:----------:|:--------------:|:-----:|:------------------:|:--------------:|
| AMK | Amikacin | standard_dosage | 25-30 mg/kg | 1 | iv | | 25-30 mg/kg x 1 iv | 15 |
| AMX | Amoxicillin | high_dosage | 2 g | 6 | iv | | 2 g x 6 iv | 15 |
| AMX | Amoxicillin | standard_dosage | 1 g | 3 | iv | | 1 g x 3-4 iv | 15 |
| AMX | Amoxicillin | high_dosage | 0.75-1 g | 3 | oral | | 0.75-1 g x 3 oral | 15 |
| AMX | Amoxicillin | standard_dosage | 0.5 g | 3 | oral | | 0.5 g x 3 oral | 15 |
| AMX | Amoxicillin | uncomplicated_uti | 0.5 g | 3 | oral | | 0.5 g x 3 oral | 15 |
------------------------------------------------------------------------
## `example_isolates`: Example Data for Practice
A data set with 2 000 rows and 46 columns, containing the following
column names:
*date*, *patient*, *age*, *gender*, *ward*, *mo*, *PEN*, *OXA*, *FLC*,
*AMX*, *AMC*, *AMP*, *TZP*, *CZO*, *FEP*, *CXM*, *FOX*, *CTX*, *CAZ*,
*CRO*, *GEN*, *TOB*, *AMK*, *KAN*, *TMP*, *SXT*, *NIT*, *FOS*, *LNZ*,
*CIP*, *MFX*, *VAN*, *TEC*, *TCY*, *TGC*, *DOX*, *ERY*, *CLI*, *AZM*,
*IPM*, *MEM*, *MTR*, *CHL*, *COL*, *MUP*, and *RIF*.
This data set is in R available as `example_isolates`, after you load
the `AMR` package.
It was last updated on 15 June 2024 13:33:49 UTC. Find more info about
the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/example_isolates.html).
**Example content**
| date | patient | age | gender | ward | mo | PEN | OXA | FLC | AMX | AMC | AMP | TZP | CZO | FEP | CXM | FOX | CTX | CAZ | CRO | GEN | TOB | AMK | KAN | TMP | SXT | NIT | FOS | LNZ | CIP | MFX | VAN | TEC | TCY | TGC | DOX | ERY | CLI | AZM | IPM | MEM | MTR | CHL | COL | MUP | RIF |
|:----------:|:-------:|:---:|:------:|:--------:|:------------:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| 2002-01-02 | A77334 | 65 | F | Clinical | B_ESCHR_COLI | R | | | | I | | | | | I | | | | | | | | | R | R | | | R | | | R | R | R | | | R | R | R | | | | | | | R |
| 2002-01-03 | A77334 | 65 | F | Clinical | B_ESCHR_COLI | R | | | | I | | | | | I | | | | | | | | | R | R | | | R | | | R | R | R | | | R | R | R | | | | | | | R |
| 2002-01-07 | 067927 | 45 | F | ICU | B_STPHY_EPDR | R | | R | | | | | | | R | | | R | | | | | | S | S | | | | | | S | | S | S | S | R | | R | | | | | R | | |
| 2002-01-07 | 067927 | 45 | F | ICU | B_STPHY_EPDR | R | | R | | | | | | | R | | | R | | | | | | S | S | | | | | | S | | S | S | S | R | | R | | | | | R | | |
| 2002-01-13 | 067927 | 45 | F | ICU | B_STPHY_EPDR | R | | R | | | | | | | R | | | R | | | | | | R | | | | | | | S | | S | S | S | R | | R | | | | | R | | |
| 2002-01-13 | 067927 | 45 | F | ICU | B_STPHY_EPDR | R | | R | | | | | | | R | | | R | | | | | | R | | | | | | | S | | S | S | S | R | R | R | | | | | R | | |
------------------------------------------------------------------------
## `example_isolates_unclean`: Example Data for Practice
A data set with 3 000 rows and 8 columns, containing the following
column names:
*patient_id*, *hospital*, *date*, *bacteria*, *AMX*, *AMC*, *CIP*, and
*GEN*.
This data set is in R available as `example_isolates_unclean`, after you
load the `AMR` package.
It was last updated on 27 August 2022 18:49:37 UTC. Find more info about
the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/example_isolates_unclean.html).
**Example content**
| patient_id | hospital | date | bacteria | AMX | AMC | CIP | GEN |
|:----------:|:--------:|:----------:|:-------------:|:---:|:---:|:---:|:---:|
| J3 | A | 2012-11-21 | E. coli | R | I | S | S |
| R7 | A | 2018-04-03 | K. pneumoniae | R | I | S | S |
| P3 | A | 2014-09-19 | E. coli | R | S | S | S |
| P10 | A | 2015-12-10 | E. coli | S | I | S | S |
| B7 | A | 2015-03-02 | E. coli | S | S | S | S |
| W3 | A | 2018-03-31 | S. aureus | R | S | R | S |
------------------------------------------------------------------------
## `microorganisms.codes`: Common Laboratory Codes
A data set with 6 036 rows and 2 columns, containing the following
column names:
*code* and *mo*.
This data set is in R available as `microorganisms.codes`, after you
load the `AMR` package.
It was last updated on 4 May 2025 16:50:25 UTC. Find more info about the
contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/microorganisms.codes.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.codes.rds)
(27 kB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.codes.txt)
(0.1 MB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.codes.xlsx)
(98 kB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.codes.feather)
(0.1 MB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.codes.parquet)
(68 kB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.codes.sav)
(0.2 MB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/microorganisms.codes.dta)
(0.2 MB)
**Example content**
| code | mo |
|:----:|:------------:|
| 1011 | B_GRAMP |
| 1012 | B_GRAMP |
| 1013 | B_GRAMN |
| 1014 | B_GRAMN |
| 1015 | F_YEAST |
| 103 | B_ESCHR_COLI |
------------------------------------------------------------------------
## `antivirals`: Antiviral Drugs
A data set with 120 rows and 11 columns, containing the following column
names:
*av*, *name*, *atc*, *cid*, *atc_group*, *synonyms*, *oral_ddd*,
*oral_units*, *iv_ddd*, *iv_units*, and *loinc*.
This data set is in R available as `antivirals`, after you load the
`AMR` package.
It was last updated on 20 October 2023 12:51:48 UTC. Find more info
about the contents, (scientific) source, and structure of this [data set
here](https://amr-for-r.org/reference/antimicrobials.html).
**Direct download links:**
- Download as [original R Data Structure (RDS)
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antivirals.rds)
(6 kB)
- Download as [tab-separated text
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antivirals.txt)
(17 kB)
- Download as [Microsoft Excel
workbook](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antivirals.xlsx)
(16 kB)
- Download as [Apache Feather
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antivirals.feather)
(16 kB)
- Download as [Apache Parquet
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antivirals.parquet)
(13 kB)
- Download as [IBM SPSS Statistics data
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antivirals.sav)
(32 kB)
- Download as [Stata DTA
file](https://github.com/msberends/AMR/raw/main/data-raw/datasets/antivirals.dta)
(78 kB)
The tab-separated text, Microsoft Excel, SPSS, and Stata files all
contain the trade names and LOINC codes as comma separated values.
**Example content**
| av | name | atc | cid | atc_group | synonyms | oral_ddd | oral_units | iv_ddd | iv_units | loinc |
|:---:|:------------------:|:-------:|:---------:|:------------------------------------------------------------------:|:-----------------------------------------------------:|:--------:|:----------:|:------:|:--------:|:----------------------------:|
| ABA | Abacavir | J05AF06 | 441300 | Nucleoside and nucleotide reverse transcriptase inhibitors | abacavir sulfate, avacavir, ziagen | 0.6 | g | | | 29113-8, 30273-7, 30287-7, … |
| ACI | Aciclovir | J05AB01 | 135398513 | Nucleosides and nucleotides excl. reverse transcriptase inhibitors | acicloftal, aciclovier, aciclovirum, … | 4.0 | g | 4 | g | |
| ADD | Adefovir dipivoxil | J05AF08 | 60871 | Nucleoside and nucleotide reverse transcriptase inhibitors | adefovir di, adefovir di ester, adefovir dipivoxyl, … | 10.0 | mg | | | |
| AME | Amenamevir | J05AX26 | 11397521 | Other antivirals | amenalief | 0.4 | g | | | |
| AMP | Amprenavir | J05AE05 | 65016 | Protease inhibitors | agenerase, carbamate, prozei | 1.2 | g | | | 29114-6, 30296-8, 30297-6, … |
| ASU | Asunaprevir | J05AP06 | 16076883 | Antivirals for treatment of HCV infections | sunvepra, sunvepratrade | 0.2 | g | | | |

View File

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

16
articles/index.md Normal file
View File

@@ -0,0 +1,16 @@
# Articles
### All vignettes
- [AMR for Python](https://amr-for-r.org/articles/AMR_for_Python.md):
- [AMR with
tidymodels](https://amr-for-r.org/articles/AMR_with_tidymodels.md):
- [Conduct AMR data analysis](https://amr-for-r.org/articles/AMR.md):
- [Download data sets for download / own
use](https://amr-for-r.org/articles/datasets.md):
- [Apply EUCAST rules](https://amr-for-r.org/articles/EUCAST.md):
- [Conduct principal component analysis (PCA) for
AMR](https://amr-for-r.org/articles/PCA.md):
- [Work with WHONET data](https://amr-for-r.org/articles/WHONET.md):
- [Estimating Empirical Coverage with
WISCA](https://amr-for-r.org/articles/WISCA.md):

View File

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

106
authors.md Normal file
View File

@@ -0,0 +1,106 @@
# Authors and Citation
## Authors
- **Matthijs S. Berends**. Author, maintainer.
[](https://orcid.org/0000-0001-7620-1800)
- **Dennis Souverein**. Author, contributor.
[](https://orcid.org/0000-0003-0455-0336)
- **Erwin E. A. Hassing**. Author, contributor.
- **Aislinn Cook**. Contributor.
[](https://orcid.org/0000-0002-9189-7815)
- **Andrew P. Norgan**. Contributor.
[](https://orcid.org/0000-0002-2955-2066)
- **Anita Williams**. Contributor.
[](https://orcid.org/0000-0002-5295-8451)
- **Annick Lenglet**. Contributor.
[](https://orcid.org/0000-0003-2013-8405)
- **Anthony Underwood**. Contributor.
[](https://orcid.org/0000-0002-8547-4277)
- **Anton Mymrikov**. Contributor.
- **Bart C. Meijer**. Contributor.
- **Christian F. Luz**. Contributor.
[](https://orcid.org/0000-0001-5809-5995)
- **Dmytro Mykhailenko**. Contributor.
- **Eric H. L. C. M. Hazenberg**. Contributor.
- **Gwen Knight**. Contributor.
[](https://orcid.org/0000-0002-7263-9896)
- **Jane Hawkey**. Contributor.
[](https://orcid.org/0000-0001-9661-5293)
- **Jason Stull**. Contributor.
[](https://orcid.org/0000-0002-9028-8153)
- **Javier Sanchez**. Contributor.
[](https://orcid.org/0000-0003-2605-8094)
- **Jonas Salm**. Contributor.
- **Judith M. Fonville**. Contributor.
- **Kathryn Holt**. Contributor.
[](https://orcid.org/0000-0003-3949-2471)
- **Larisse Bolton**. Contributor.
[](https://orcid.org/0000-0001-7879-2173)
- **Matthew Saab**. Contributor.
[](https://orcid.org/0009-0008-6626-7919)
- **Natacha Couto**. Contributor.
[](https://orcid.org/0000-0002-9152-5464)
- **Peter Dutey-Magni**. Contributor.
[](https://orcid.org/0000-0002-8942-9836)
- **Rogier P. Schade**. Contributor.
[](https://orcid.org/0000-0002-9487-4467)
- **Sofia Ny**. Contributor. [](https://orcid.org/0000-0002-2017-1363)
- **Alex W. Friedrich**. Thesis advisor.
[](https://orcid.org/0000-0003-4881-038X)
- **Bhanu N. M. Sinha**. Thesis advisor.
[](https://orcid.org/0000-0003-1634-0010)
- **Casper J. Albers**. Thesis advisor.
[](https://orcid.org/0000-0002-9213-6743)
- **Corinna Glasner**. Thesis advisor.
[](https://orcid.org/0000-0003-1241-1328)
## Citation
Source:
[`inst/CITATION`](https://github.com/msberends/AMR/blob/main/inst/CITATION)
Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C
(2022). “AMR: An R Package for Working with Antimicrobial Resistance
Data.” *Journal of Statistical Software*, **104**(3), 131.
[doi:10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03).
@Article{,
title = {{AMR}: An {R} Package for Working with Antimicrobial Resistance Data},
author = {Matthijs S. Berends and Christian F. Luz and Alexander W. Friedrich and Bhanu N. M. Sinha and Casper J. Albers and Corinna Glasner},
journal = {Journal of Statistical Software},
year = {2022},
volume = {104},
number = {3},
pages = {1--31},
doi = {10.18637/jss.v104.i03},
}

File diff suppressed because one or more lines are too long

View File

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

467
index.md Normal file
View File

@@ -0,0 +1,467 @@
# The `AMR` Package for R
- Provides an **all-in-one solution** for antimicrobial resistance (AMR)
data analysis in a One Health approach
- Peer-reviewed, used in over 175 countries, available in 28 languages
- Generates **antibiograms** - traditional, combined, syndromic, and
even WISCA
- Provides the **full microbiological taxonomy** of ~79 000 distinct
species and extensive info of ~620 antimicrobial drugs
- Applies **CLSI 2011-2025** and **EUCAST 2011-2025** clinical and
veterinary breakpoints, and ECOFFs, for MIC and disk zone
interpretation
- Corrects for duplicate isolates, **calculates** and **predicts** AMR
per antimicrobial class
- Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC**,
**SNOMED CT**, and **NCBI**
- 100% free of costs and dependencies, highly suitable for places with
**limited resources**
> Now available for Python too! [Click
> here](https://amr-for-r.org/articles/AMR_for_Python.md) to read more.
[amr-for-r.org](https://amr-for-r.org/)
[doi.org/10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)
[![](./endorsement_clsi_eucast.jpg)](https://amr-for-r.org/reference/clinical_breakpoints.html#response-from-clsi-and-eucast)
------------------------------------------------------------------------
## Introduction
The `AMR` package is a peer-reviewed, [free and open-source](#copyright)
R package with [zero
dependencies](https://en.wikipedia.org/wiki/Dependency_hell) to simplify
the analysis and prediction of Antimicrobial Resistance (AMR) and to
work with microbial and antimicrobial data and properties, by using
evidence-based methods. **Our aim is to provide a standard** for clean
and reproducible AMR data analysis, that can therefore empower
epidemiological analyses to continuously enable surveillance and
treatment evaluation in any setting. We are a team of [many different
researchers](https://amr-for-r.org/authors.md) from around the globe to
make this a successful and durable project!
This work was published in the Journal of Statistical Software (Volume
104(3); [DOI
10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)) and
formed the basis of two PhD theses ([DOI
10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131) and
[DOI 10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)).
After installing this package, R knows [**~79 000 distinct microbial
species**](https://amr-for-r.org/reference/microorganisms.md) (updated
June 2024) and all [**~620 antimicrobial and antiviral
drugs**](https://amr-for-r.org/reference/antimicrobials.md) by name and
code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED
CT), and knows all about valid SIR and MIC values. The integral clinical
breakpoint guidelines from CLSI 2011-2025 and EUCAST 2011-2025 are
included, even with epidemiological cut-off (ECOFF) values. It supports
and can read any data format, including WHONET data. This package works
on Windows, macOS and Linux with all versions of R since R-3.0 (April
2013). **It was designed to work in any setting, including those with
very limited resources**. It was created for both routine data analysis
and academic research at the Faculty of Medical Sciences of the
[University of Groningen](https://www.rug.nl) and the [University
Medical Center Groningen](https://www.umcg.nl).
### Used in over 175 countries, available in 28 languages
[![](./countries.png)](https://amr-for-r.org/countries_large.png)
Since its first public release in early 2018, this R package has been
used in almost all countries in the world. Click the map to enlarge and
to see the country names.
With the help of contributors from all corners of the world, the `AMR`
package is available in ![](lang_en.svg) English, ![](lang_ar.svg)
Arabic, ![](lang_bn.svg) Bengali, ![](lang_zh.svg) Chinese,
![](lang_cs.svg) Czech, ![](lang_da.svg) Danish, ![](lang_nl.svg) Dutch,
![](lang_fi.svg) Finnish, ![](lang_fr.svg) French, ![](lang_de.svg)
German, ![](lang_el.svg) Greek, ![](lang_hi.svg) Hindi, ![](lang_id.svg)
Indonesian, ![](lang_it.svg) Italian, ![](lang_ja.svg) Japanese,
![](lang_ko.svg) Korean, ![](lang_no.svg) Norwegian, ![](lang_pl.svg)
Polish, ![](lang_pt.svg) Portuguese, ![](lang_ro.svg) Romanian,
![](lang_ru.svg) Russian, ![](lang_es.svg) Spanish, ![](lang_sw.svg)
Swahili, ![](lang_sv.svg) Swedish, ![](lang_tr.svg) Turkish,
![](lang_uk.svg) Ukrainian, ![](lang_ur.svg) Urdu, and ![](lang_vi.svg)
Vietnamese. Antimicrobial drug (group) names and colloquial
microorganism names are provided in these languages.
## Practical examples
### Filtering and selecting data
One of the most powerful functions of this package, aside from
calculating and plotting AMR, is selecting and filtering based on
antimicrobial columns. This can be done using the so-called
[antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.html),
which work in base R, `dplyr` and `data.table`.
``` r
# AMR works great with dplyr, but it's not required or neccesary
library(AMR)
library(dplyr, warn.conflicts = FALSE)
example_isolates %>%
mutate(bacteria = mo_fullname()) %>%
# filtering functions for microorganisms:
filter(mo_is_gram_negative(),
mo_is_intrinsic_resistant(ab = "cefotax")) %>%
# antimicrobial selectors:
select(bacteria,
aminoglycosides(),
carbapenems())
#> Using column 'mo' as input for `mo_fullname()`
#> Using column 'mo' as input for `mo_is_gram_negative()`
#> Using column 'mo' as input for `mo_is_intrinsic_resistant()`
#> Determining intrinsic resistance based on 'EUCAST Expected Resistant
#> Phenotypes' v1.2 (2023). This note will be shown once per session.
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
#> # A tibble: 35 × 7
#> bacteria GEN TOB AMK KAN IPM MEM
#> <chr> <sir> <sir> <sir> <sir> <sir> <sir>
#> 1 Pseudomonas aeruginosa I S NA R S NA
#> 2 Pseudomonas aeruginosa I S NA R S NA
#> 3 Pseudomonas aeruginosa I S NA R S NA
#> 4 Pseudomonas aeruginosa S S S R NA S
#> 5 Pseudomonas aeruginosa S S S R S S
#> 6 Pseudomonas aeruginosa S S S R S S
#> 7 Stenotrophomonas maltophilia R R R R R R
#> 8 Pseudomonas aeruginosa S S S R NA S
#> 9 Pseudomonas aeruginosa S S S R NA S
#> 10 Pseudomonas aeruginosa S S S R S S
#> # 25 more rows
```
With only having defined a row filter on Gram-negative bacteria with
intrinsic resistance to cefotaxime
([`mo_is_gram_negative()`](https://amr-for-r.org/reference/mo_property.md)
and
[`mo_is_intrinsic_resistant()`](https://amr-for-r.org/reference/mo_property.md))
and a column selection on two antibiotic groups
([`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`carbapenems()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)),
the reference data about [all
microorganisms](https://amr-for-r.org/reference/microorganisms.md) and
[all antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
in the `AMR` package make sure you get what you meant.
### Generating antibiograms
The `AMR` package supports generating traditional, combined, syndromic,
and even weighted-incidence syndromic combination antibiograms (WISCA).
If used inside [R Markdown](https://rmarkdown.rstudio.com) or
[Quarto](https://quarto.org), the table will be printed in the right
output format automatically (such as markdown, LaTeX, HTML, etc.).
``` r
antibiogram(example_isolates,
antimicrobials = c(aminoglycosides(), carbapenems()))
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
```
| Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
|:-----------------|:---------------------|:--------------------|:---------------------|:----------------|:---------------------|:--------------------|
| CoNS | 0% (0-8%,N=43) | 86% (82-90%,N=309) | 52% (37-67%,N=48) | 0% (0-8%,N=43) | 52% (37-67%,N=48) | 22% (12-35%,N=55) |
| *E. coli* | 100% (98-100%,N=171) | 98% (96-99%,N=460) | 100% (99-100%,N=422) | NA | 100% (99-100%,N=418) | 97% (96-99%,N=462) |
| *E. faecalis* | 0% (0-9%,N=39) | 0% (0-9%,N=39) | 100% (91-100%,N=38) | 0% (0-9%,N=39) | NA | 0% (0-9%,N=39) |
| *K. pneumoniae* | NA | 90% (79-96%,N=58) | 100% (93-100%,N=51) | NA | 100% (93-100%,N=53) | 90% (79-96%,N=58) |
| *P. aeruginosa* | NA | 100% (88-100%,N=30) | NA | 0% (0-12%,N=30) | NA | 100% (88-100%,N=30) |
| *P. mirabilis* | NA | 94% (80-99%,N=34) | 94% (79-99%,N=32) | NA | NA | 94% (80-99%,N=34) |
| *S. aureus* | NA | 99% (97-100%,N=233) | NA | NA | NA | 98% (92-100%,N=86) |
| *S. epidermidis* | 0% (0-8%,N=44) | 79% (71-85%,N=163) | NA | 0% (0-8%,N=44) | NA | 51% (40-61%,N=89) |
| *S. hominis* | NA | 92% (84-97%,N=80) | NA | NA | NA | 85% (74-93%,N=62) |
| *S. pneumoniae* | 0% (0-3%,N=117) | 0% (0-3%,N=117) | NA | 0% (0-3%,N=117) | NA | 0% (0-3%,N=117) |
In combination antibiograms, it is clear that combined antimicrobials
yield higher empiric coverage:
``` r
antibiogram(example_isolates,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
mo_transform = "gramstain")
```
| Pathogen | Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|:--------------|:------------------------|:-------------------------------------|:-------------------------------------|
| Gram-negative | 88% (85-91%,N=641) | 99% (97-99%,N=691) | 98% (97-99%,N=693) |
| Gram-positive | 86% (82-89%,N=345) | 98% (96-98%,N=1044) | 95% (93-97%,N=550) |
Like many other functions in this package,
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md) comes
with support for 28 languages that are often detected automatically
based on system language:
``` r
antibiogram(example_isolates,
antimicrobials = c("cipro", "tobra", "genta"), # any arbitrary name or code will work
mo_transform = "gramstain",
ab_transform = "name",
language = "uk") # Ukrainian
```
| Збудник | Гентаміцин | Тобраміцин | Ципрофлоксацин |
|:--------------|:--------------------|:-------------------|:-------------------|
| Грамнегативні | 96% (95-98%,N=684) | 96% (94-97%,N=686) | 91% (88-93%,N=684) |
| Грампозитивні | 63% (60-66%,N=1170) | 34% (31-38%,N=665) | 77% (74-80%,N=724) |
### Interpreting and plotting MIC and SIR values
The `AMR` package allows interpretation of MIC and disk diffusion values
based on CLSI and EUCAST. Moreover, the `ggplot2` package is extended
with new scale functions, to allow plotting of log2-distributed MIC
values and SIR values.
``` r
library(ggplot2)
library(AMR)
# generate some random values
some_mic_values <- random_mic(size = 100)
some_groups <- sample(LETTERS[1:5], 20, replace = TRUE)
interpretation <- as.sir(some_mic_values,
guideline = "EUCAST 2024",
mo = "E. coli", # or any code or name resembling a known species
ab = "Cipro") # or any code or name resembling an antibiotic
# create the plot
ggplot(data.frame(mic = some_mic_values,
group = some_groups,
sir = interpretation),
aes(x = group, y = mic, colour = sir)) +
theme_minimal() +
geom_boxplot(fill = NA, colour = "grey30") +
geom_jitter(width = 0.25) +
# NEW scale function: plot MIC values to x, y, colour or fill
scale_y_mic() +
# NEW scale function: write out S/I/R in any of the 20 supported languages
# and set colourblind-friendly colours
scale_colour_sir()
```
[![](./plot_readme.png)](https://amr-for-r.org/reference/plotting.md "Plotting Helpers for AMR Data Analysis")
### Calculating resistance per group
For a manual approach, you can use the `resistance` or
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
function:
``` r
example_isolates %>%
# group by ward:
group_by(ward) %>%
# calculate AMR using resistance() for gentamicin and tobramycin
# and get their 95% confidence intervals using sir_confidence_interval():
summarise(across(c(GEN, TOB),
list(total_R = resistance,
conf_int = function(x) sir_confidence_interval(x, collapse = "-"))))
#> # A tibble: 3 × 5
#> ward GEN_total_R GEN_conf_int TOB_total_R TOB_conf_int
#> <chr> <dbl> <chr> <dbl> <chr>
#> 1 Clinical 0.229 0.205-0.254 0.315 0.284-0.347
#> 2 ICU 0.290 0.253-0.33 0.400 0.353-0.449
#> 3 Outpatient 0.2 0.131-0.285 0.368 0.254-0.493
```
Or use [antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.html)
to select a series of antibiotic columns:
``` r
library(AMR)
library(dplyr)
out <- example_isolates %>%
# group by ward:
group_by(ward) %>%
# calculate AMR using resistance(), over all aminoglycosides and polymyxins:
summarise(across(c(aminoglycosides(), polymyxins()),
resistance))
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `polymyxins()` using column 'COL' (colistin)
#> Warning: There was 1 warning in `summarise()`.
#> In argument: `across(c(aminoglycosides(), polymyxins()), resistance)`.
#> In group 3: `ward = "Outpatient"`.
#> Caused by warning:
#> ! Introducing NA: only 23 results available for KAN in group: ward =
#> "Outpatient" (`minimum` = 30).
out
#> # A tibble: 3 × 6
#> ward GEN TOB AMK KAN COL
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
``` r
# transform the antibiotic columns to names:
out %>% set_ab_names()
#> # A tibble: 3 × 6
#> ward gentamicin tobramycin amikacin kanamycin colistin
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
``` r
# transform the antibiotic column to ATC codes:
out %>% set_ab_names(property = "atc")
#> # A tibble: 3 × 6
#> ward J01GB03 J01GB01 J01GB06 J01GB04 J01XB01
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
## What else can you do with this package?
This package was intended as a comprehensive toolbox for integrated AMR
data analysis. This package can be used for:
- Reference for the taxonomy of microorganisms, since the package
contains all microbial (sub)species from the List of Prokaryotic names
with Standing in Nomenclature ([LPSN](https://lpsn.dsmz.de)) and the
Global Biodiversity Information Facility
([GBIF](https://www.gbif.org))
([manual](https://amr-for-r.org/reference/mo_property.md))
- Interpreting raw MIC and disk diffusion values, based on any CLSI or
EUCAST guideline ([manual](https://amr-for-r.org/reference/as.sir.md))
- Retrieving antimicrobial drug names, doses and forms of administration
from clinical health care records
([manual](https://amr-for-r.org/reference/ab_from_text.md))
- Determining first isolates to be used for AMR data analysis
([manual](https://amr-for-r.org/reference/first_isolate.md))
- Calculating antimicrobial resistance
([tutorial](https://amr-for-r.org/articles/AMR.md))
- Determining multi-drug resistance (MDR) / multi-drug resistant
organisms (MDRO) ([tutorial](https://amr-for-r.org/reference/mdro.md))
- Calculating (empirical) susceptibility of both mono therapy and
combination therapies
([tutorial](https://amr-for-r.org/articles/AMR.md))
- Apply AMR functions in predictive modelling
([tutorial](https://amr-for-r.org/articles/AMR_with_tidymodels.md))
- Getting properties for any microorganism (like Gram stain, species,
genus or family)
([manual](https://amr-for-r.org/reference/mo_property.md))
- Getting properties for any antimicrobial (like name, code of
EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)
([manual](https://amr-for-r.org/reference/ab_property.md))
- Plotting antimicrobial resistance
([tutorial](https://amr-for-r.org/articles/AMR.md))
- Applying EUCAST expert rules
([manual](https://amr-for-r.org/reference/eucast_rules.md))
- Getting SNOMED codes of a microorganism, or getting properties of a
microorganism based on a SNOMED code
([manual](https://amr-for-r.org/reference/mo_property.md))
- Getting LOINC codes of an antibiotic, or getting properties of an
antibiotic based on a LOINC code
([manual](https://amr-for-r.org/reference/ab_property.md))
- Machine reading the EUCAST and CLSI guidelines from 2011-2021 to
translate MIC values and disk diffusion diameters to SIR
([link](https://amr-for-r.org/articles/datasets.md))
- Principal component analysis for AMR
([tutorial](https://amr-for-r.org/articles/PCA.md))
## Get this package
### Latest official version
[![CRAN](https://www.r-pkg.org/badges/version-ago/AMR)](https://cran.r-project.org/package=AMR)
[![CRANlogs](https://cranlogs.r-pkg.org/badges/grand-total/AMR)](https://cran.r-project.org/package=AMR)
This package is available [here on the official R network
(CRAN)](https://cran.r-project.org/package=AMR). Install this package in
R from CRAN by using the command:
``` r
install.packages("AMR")
```
It will be downloaded and installed automatically. For RStudio, click on
the menu *Tools* \> *Install Packages…* and then type in “AMR” and press
Install.
**Note:** Not all functions on this website may be available in this
latest release. To use all functions and data sets mentioned on this
website, install the latest beta version.
### Latest beta version
[![check-old](https://github.com/msberends/AMR/actions/workflows/check-old-tinytest.yaml/badge.svg?branch=main)](https://github.com/msberends/AMR/actions/workflows/check-old-tinytest.yaml)
[![check-recent](https://github.com/msberends/AMR/actions/workflows/check-current-testthat.yaml/badge.svg?branch=main)](https://github.com/msberends/AMR/actions/workflows/check-current-testthat.yaml)
[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
[![Codecov](https://codecov.io/gh/msberends/AMR/branch/main/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=main)
Please read our [Developer Guideline
here](https://github.com/msberends/AMR/wiki/Developer-Guideline).
To install the latest and unpublished beta version:
``` r
install.packages("AMR", repos = "beta.amr-for-r.org")
# if this does not work, try to install directly from GitHub using the 'remotes' package:
remotes::install_github("msberends/AMR")
```
## Get started
To find out how to conduct AMR data analysis, please [continue reading
here to get started](https://amr-for-r.org/articles/AMR.md) or click a
link in the [How to menu](https://amr-for-r.org/articles/).
## Partners
The initial development of this package was part of, related to, or made
possible by the following non-profit organisations and initiatives:
[![](./logo_rug.svg)](https://www.rug.nl "University of Groningen")
[![](./logo_umcg.svg)](https://www.umcg.nl "University Medical Center Groningen")
[![](./logo_certe.svg)](https://www.certe.nl "Certe Medical Diagnostics and Advice Foundation")
[![](./logo_eh1h.png)](https://www.deutschland-nederland.eu "EurHealth-1-Health")
[![](./logo_interreg.png)](https://www.deutschland-nederland.eu "INTERREG")
## Copyright
This R package is free, open-source software and licensed under the [GNU
General Public License v2.0
(GPL-2)](https://amr-for-r.org/LICENSE-text.md). In a nutshell, this
means that this package:
- May be used for commercial purposes
- May be used for private purposes
- May **not** be used for patent purposes
- May be modified, although:
- Modifications **must** be released under the same license when
distributing the package
- Changes made to the code **must** be documented
- May be distributed, although:
- Source code **must** be made available when the package is
distributed
- A copy of the license and copyright notice **must** be included with
the package.
- Comes with a LIMITATION of liability
- Comes with NO warranty

View File

@@ -11,4 +11,6 @@ document.addEventListener("DOMContentLoaded", function () {
macros: macros,
fleqn: false
});
}}});
}
}
});

View File

@@ -26,7 +26,7 @@ const setTheme = theme => {
}
}
function bsSetupThemeToggle () {
function bsSetupThemeToggle() {
'use strict'
const showActiveTheme = (theme, focus = false) => {

960
llms.txt Normal file
View File

@@ -0,0 +1,960 @@
# The `AMR` Package for R
- Provides an **all-in-one solution** for antimicrobial resistance (AMR)
data analysis in a One Health approach
- Peer-reviewed, used in over 175 countries, available in 28 languages
- Generates **antibiograms** - traditional, combined, syndromic, and
even WISCA
- Provides the **full microbiological taxonomy** of ~79 000 distinct
species and extensive info of ~620 antimicrobial drugs
- Applies **CLSI 2011-2025** and **EUCAST 2011-2025** clinical and
veterinary breakpoints, and ECOFFs, for MIC and disk zone
interpretation
- Corrects for duplicate isolates, **calculates** and **predicts** AMR
per antimicrobial class
- Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC**,
**SNOMED CT**, and **NCBI**
- 100% free of costs and dependencies, highly suitable for places with
**limited resources**
> Now available for Python too! [Click
> here](https://amr-for-r.org/articles/AMR_for_Python.md) to read more.
[amr-for-r.org](https://amr-for-r.org/)
[doi.org/10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)
[![](./endorsement_clsi_eucast.jpg)](https://amr-for-r.org/reference/clinical_breakpoints.html#response-from-clsi-and-eucast)
------------------------------------------------------------------------
## Introduction
The `AMR` package is a peer-reviewed, [free and open-source](#copyright)
R package with [zero
dependencies](https://en.wikipedia.org/wiki/Dependency_hell) to simplify
the analysis and prediction of Antimicrobial Resistance (AMR) and to
work with microbial and antimicrobial data and properties, by using
evidence-based methods. **Our aim is to provide a standard** for clean
and reproducible AMR data analysis, that can therefore empower
epidemiological analyses to continuously enable surveillance and
treatment evaluation in any setting. We are a team of [many different
researchers](https://amr-for-r.org/authors.md) from around the globe to
make this a successful and durable project!
This work was published in the Journal of Statistical Software (Volume
104(3); [DOI
10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)) and
formed the basis of two PhD theses ([DOI
10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131) and
[DOI 10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)).
After installing this package, R knows [**~79 000 distinct microbial
species**](https://amr-for-r.org/reference/microorganisms.md) (updated
June 2024) and all [**~620 antimicrobial and antiviral
drugs**](https://amr-for-r.org/reference/antimicrobials.md) by name and
code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED
CT), and knows all about valid SIR and MIC values. The integral clinical
breakpoint guidelines from CLSI 2011-2025 and EUCAST 2011-2025 are
included, even with epidemiological cut-off (ECOFF) values. It supports
and can read any data format, including WHONET data. This package works
on Windows, macOS and Linux with all versions of R since R-3.0 (April
2013). **It was designed to work in any setting, including those with
very limited resources**. It was created for both routine data analysis
and academic research at the Faculty of Medical Sciences of the
[University of Groningen](https://www.rug.nl) and the [University
Medical Center Groningen](https://www.umcg.nl).
### Used in over 175 countries, available in 28 languages
[![](./countries.png)](https://amr-for-r.org/countries_large.png)
Since its first public release in early 2018, this R package has been
used in almost all countries in the world. Click the map to enlarge and
to see the country names.
With the help of contributors from all corners of the world, the `AMR`
package is available in ![](lang_en.svg) English, ![](lang_ar.svg)
Arabic, ![](lang_bn.svg) Bengali, ![](lang_zh.svg) Chinese,
![](lang_cs.svg) Czech, ![](lang_da.svg) Danish, ![](lang_nl.svg) Dutch,
![](lang_fi.svg) Finnish, ![](lang_fr.svg) French, ![](lang_de.svg)
German, ![](lang_el.svg) Greek, ![](lang_hi.svg) Hindi, ![](lang_id.svg)
Indonesian, ![](lang_it.svg) Italian, ![](lang_ja.svg) Japanese,
![](lang_ko.svg) Korean, ![](lang_no.svg) Norwegian, ![](lang_pl.svg)
Polish, ![](lang_pt.svg) Portuguese, ![](lang_ro.svg) Romanian,
![](lang_ru.svg) Russian, ![](lang_es.svg) Spanish, ![](lang_sw.svg)
Swahili, ![](lang_sv.svg) Swedish, ![](lang_tr.svg) Turkish,
![](lang_uk.svg) Ukrainian, ![](lang_ur.svg) Urdu, and ![](lang_vi.svg)
Vietnamese. Antimicrobial drug (group) names and colloquial
microorganism names are provided in these languages.
## Practical examples
### Filtering and selecting data
One of the most powerful functions of this package, aside from
calculating and plotting AMR, is selecting and filtering based on
antimicrobial columns. This can be done using the so-called
[antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.html),
which work in base R, `dplyr` and `data.table`.
``` r
# AMR works great with dplyr, but it's not required or neccesary
library(AMR)
library(dplyr, warn.conflicts = FALSE)
example_isolates %>%
mutate(bacteria = mo_fullname()) %>%
# filtering functions for microorganisms:
filter(mo_is_gram_negative(),
mo_is_intrinsic_resistant(ab = "cefotax")) %>%
# antimicrobial selectors:
select(bacteria,
aminoglycosides(),
carbapenems())
#> Using column 'mo' as input for `mo_fullname()`
#> Using column 'mo' as input for `mo_is_gram_negative()`
#> Using column 'mo' as input for `mo_is_intrinsic_resistant()`
#> Determining intrinsic resistance based on 'EUCAST Expected Resistant
#> Phenotypes' v1.2 (2023). This note will be shown once per session.
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
#> # A tibble: 35 × 7
#> bacteria GEN TOB AMK KAN IPM MEM
#> <chr> <sir> <sir> <sir> <sir> <sir> <sir>
#> 1 Pseudomonas aeruginosa I S NA R S NA
#> 2 Pseudomonas aeruginosa I S NA R S NA
#> 3 Pseudomonas aeruginosa I S NA R S NA
#> 4 Pseudomonas aeruginosa S S S R NA S
#> 5 Pseudomonas aeruginosa S S S R S S
#> 6 Pseudomonas aeruginosa S S S R S S
#> 7 Stenotrophomonas maltophilia R R R R R R
#> 8 Pseudomonas aeruginosa S S S R NA S
#> 9 Pseudomonas aeruginosa S S S R NA S
#> 10 Pseudomonas aeruginosa S S S R S S
#> # 25 more rows
```
With only having defined a row filter on Gram-negative bacteria with
intrinsic resistance to cefotaxime
([`mo_is_gram_negative()`](https://amr-for-r.org/reference/mo_property.md)
and
[`mo_is_intrinsic_resistant()`](https://amr-for-r.org/reference/mo_property.md))
and a column selection on two antibiotic groups
([`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`carbapenems()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)),
the reference data about [all
microorganisms](https://amr-for-r.org/reference/microorganisms.md) and
[all antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
in the `AMR` package make sure you get what you meant.
### Generating antibiograms
The `AMR` package supports generating traditional, combined, syndromic,
and even weighted-incidence syndromic combination antibiograms (WISCA).
If used inside [R Markdown](https://rmarkdown.rstudio.com) or
[Quarto](https://quarto.org), the table will be printed in the right
output format automatically (such as markdown, LaTeX, HTML, etc.).
``` r
antibiogram(example_isolates,
antimicrobials = c(aminoglycosides(), carbapenems()))
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
```
| Pathogen | Amikacin | Gentamicin | Imipenem | Kanamycin | Meropenem | Tobramycin |
|:-----------------|:---------------------|:--------------------|:---------------------|:----------------|:---------------------|:--------------------|
| CoNS | 0% (0-8%,N=43) | 86% (82-90%,N=309) | 52% (37-67%,N=48) | 0% (0-8%,N=43) | 52% (37-67%,N=48) | 22% (12-35%,N=55) |
| *E. coli* | 100% (98-100%,N=171) | 98% (96-99%,N=460) | 100% (99-100%,N=422) | NA | 100% (99-100%,N=418) | 97% (96-99%,N=462) |
| *E. faecalis* | 0% (0-9%,N=39) | 0% (0-9%,N=39) | 100% (91-100%,N=38) | 0% (0-9%,N=39) | NA | 0% (0-9%,N=39) |
| *K. pneumoniae* | NA | 90% (79-96%,N=58) | 100% (93-100%,N=51) | NA | 100% (93-100%,N=53) | 90% (79-96%,N=58) |
| *P. aeruginosa* | NA | 100% (88-100%,N=30) | NA | 0% (0-12%,N=30) | NA | 100% (88-100%,N=30) |
| *P. mirabilis* | NA | 94% (80-99%,N=34) | 94% (79-99%,N=32) | NA | NA | 94% (80-99%,N=34) |
| *S. aureus* | NA | 99% (97-100%,N=233) | NA | NA | NA | 98% (92-100%,N=86) |
| *S. epidermidis* | 0% (0-8%,N=44) | 79% (71-85%,N=163) | NA | 0% (0-8%,N=44) | NA | 51% (40-61%,N=89) |
| *S. hominis* | NA | 92% (84-97%,N=80) | NA | NA | NA | 85% (74-93%,N=62) |
| *S. pneumoniae* | 0% (0-3%,N=117) | 0% (0-3%,N=117) | NA | 0% (0-3%,N=117) | NA | 0% (0-3%,N=117) |
In combination antibiograms, it is clear that combined antimicrobials
yield higher empiric coverage:
``` r
antibiogram(example_isolates,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
mo_transform = "gramstain")
```
| Pathogen | Piperacillin/tazobactam | Piperacillin/tazobactam + Gentamicin | Piperacillin/tazobactam + Tobramycin |
|:--------------|:------------------------|:-------------------------------------|:-------------------------------------|
| Gram-negative | 88% (85-91%,N=641) | 99% (97-99%,N=691) | 98% (97-99%,N=693) |
| Gram-positive | 86% (82-89%,N=345) | 98% (96-98%,N=1044) | 95% (93-97%,N=550) |
Like many other functions in this package,
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md) comes
with support for 28 languages that are often detected automatically
based on system language:
``` r
antibiogram(example_isolates,
antimicrobials = c("cipro", "tobra", "genta"), # any arbitrary name or code will work
mo_transform = "gramstain",
ab_transform = "name",
language = "uk") # Ukrainian
```
| Збудник | Гентаміцин | Тобраміцин | Ципрофлоксацин |
|:--------------|:--------------------|:-------------------|:-------------------|
| Грамнегативні | 96% (95-98%,N=684) | 96% (94-97%,N=686) | 91% (88-93%,N=684) |
| Грампозитивні | 63% (60-66%,N=1170) | 34% (31-38%,N=665) | 77% (74-80%,N=724) |
### Interpreting and plotting MIC and SIR values
The `AMR` package allows interpretation of MIC and disk diffusion values
based on CLSI and EUCAST. Moreover, the `ggplot2` package is extended
with new scale functions, to allow plotting of log2-distributed MIC
values and SIR values.
``` r
library(ggplot2)
library(AMR)
# generate some random values
some_mic_values <- random_mic(size = 100)
some_groups <- sample(LETTERS[1:5], 20, replace = TRUE)
interpretation <- as.sir(some_mic_values,
guideline = "EUCAST 2024",
mo = "E. coli", # or any code or name resembling a known species
ab = "Cipro") # or any code or name resembling an antibiotic
# create the plot
ggplot(data.frame(mic = some_mic_values,
group = some_groups,
sir = interpretation),
aes(x = group, y = mic, colour = sir)) +
theme_minimal() +
geom_boxplot(fill = NA, colour = "grey30") +
geom_jitter(width = 0.25) +
# NEW scale function: plot MIC values to x, y, colour or fill
scale_y_mic() +
# NEW scale function: write out S/I/R in any of the 20 supported languages
# and set colourblind-friendly colours
scale_colour_sir()
```
[![](./plot_readme.png)](https://amr-for-r.org/reference/plotting.md "Plotting Helpers for AMR Data Analysis")
### Calculating resistance per group
For a manual approach, you can use the `resistance` or
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
function:
``` r
example_isolates %>%
# group by ward:
group_by(ward) %>%
# calculate AMR using resistance() for gentamicin and tobramycin
# and get their 95% confidence intervals using sir_confidence_interval():
summarise(across(c(GEN, TOB),
list(total_R = resistance,
conf_int = function(x) sir_confidence_interval(x, collapse = "-"))))
#> # A tibble: 3 × 5
#> ward GEN_total_R GEN_conf_int TOB_total_R TOB_conf_int
#> <chr> <dbl> <chr> <dbl> <chr>
#> 1 Clinical 0.229 0.205-0.254 0.315 0.284-0.347
#> 2 ICU 0.290 0.253-0.33 0.400 0.353-0.449
#> 3 Outpatient 0.2 0.131-0.285 0.368 0.254-0.493
```
Or use [antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.html)
to select a series of antibiotic columns:
``` r
library(AMR)
library(dplyr)
out <- example_isolates %>%
# group by ward:
group_by(ward) %>%
# calculate AMR using resistance(), over all aminoglycosides and polymyxins:
summarise(across(c(aminoglycosides(), polymyxins()),
resistance))
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `polymyxins()` using column 'COL' (colistin)
#> Warning: There was 1 warning in `summarise()`.
#> In argument: `across(c(aminoglycosides(), polymyxins()), resistance)`.
#> In group 3: `ward = "Outpatient"`.
#> Caused by warning:
#> ! Introducing NA: only 23 results available for KAN in group: ward =
#> "Outpatient" (`minimum` = 30).
out
#> # A tibble: 3 × 6
#> ward GEN TOB AMK KAN COL
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
``` r
# transform the antibiotic columns to names:
out %>% set_ab_names()
#> # A tibble: 3 × 6
#> ward gentamicin tobramycin amikacin kanamycin colistin
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
``` r
# transform the antibiotic column to ATC codes:
out %>% set_ab_names(property = "atc")
#> # A tibble: 3 × 6
#> ward J01GB03 J01GB01 J01GB06 J01GB04 J01XB01
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Clinical 0.229 0.315 0.626 1 0.780
#> 2 ICU 0.290 0.400 0.662 1 0.857
#> 3 Outpatient 0.2 0.368 0.605 NA 0.889
```
## What else can you do with this package?
This package was intended as a comprehensive toolbox for integrated AMR
data analysis. This package can be used for:
- Reference for the taxonomy of microorganisms, since the package
contains all microbial (sub)species from the List of Prokaryotic names
with Standing in Nomenclature ([LPSN](https://lpsn.dsmz.de)) and the
Global Biodiversity Information Facility
([GBIF](https://www.gbif.org))
([manual](https://amr-for-r.org/reference/mo_property.md))
- Interpreting raw MIC and disk diffusion values, based on any CLSI or
EUCAST guideline ([manual](https://amr-for-r.org/reference/as.sir.md))
- Retrieving antimicrobial drug names, doses and forms of administration
from clinical health care records
([manual](https://amr-for-r.org/reference/ab_from_text.md))
- Determining first isolates to be used for AMR data analysis
([manual](https://amr-for-r.org/reference/first_isolate.md))
- Calculating antimicrobial resistance
([tutorial](https://amr-for-r.org/articles/AMR.md))
- Determining multi-drug resistance (MDR) / multi-drug resistant
organisms (MDRO) ([tutorial](https://amr-for-r.org/reference/mdro.md))
- Calculating (empirical) susceptibility of both mono therapy and
combination therapies
([tutorial](https://amr-for-r.org/articles/AMR.md))
- Apply AMR functions in predictive modelling
([tutorial](https://amr-for-r.org/articles/AMR_with_tidymodels.md))
- Getting properties for any microorganism (like Gram stain, species,
genus or family)
([manual](https://amr-for-r.org/reference/mo_property.md))
- Getting properties for any antimicrobial (like name, code of
EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)
([manual](https://amr-for-r.org/reference/ab_property.md))
- Plotting antimicrobial resistance
([tutorial](https://amr-for-r.org/articles/AMR.md))
- Applying EUCAST expert rules
([manual](https://amr-for-r.org/reference/eucast_rules.md))
- Getting SNOMED codes of a microorganism, or getting properties of a
microorganism based on a SNOMED code
([manual](https://amr-for-r.org/reference/mo_property.md))
- Getting LOINC codes of an antibiotic, or getting properties of an
antibiotic based on a LOINC code
([manual](https://amr-for-r.org/reference/ab_property.md))
- Machine reading the EUCAST and CLSI guidelines from 2011-2021 to
translate MIC values and disk diffusion diameters to SIR
([link](https://amr-for-r.org/articles/datasets.md))
- Principal component analysis for AMR
([tutorial](https://amr-for-r.org/articles/PCA.md))
## Get this package
### Latest official version
[![CRAN](https://www.r-pkg.org/badges/version-ago/AMR)](https://cran.r-project.org/package=AMR)
[![CRANlogs](https://cranlogs.r-pkg.org/badges/grand-total/AMR)](https://cran.r-project.org/package=AMR)
This package is available [here on the official R network
(CRAN)](https://cran.r-project.org/package=AMR). Install this package in
R from CRAN by using the command:
``` r
install.packages("AMR")
```
It will be downloaded and installed automatically. For RStudio, click on
the menu *Tools* \> *Install Packages…* and then type in “AMR” and press
Install.
**Note:** Not all functions on this website may be available in this
latest release. To use all functions and data sets mentioned on this
website, install the latest beta version.
### Latest beta version
[![check-old](https://github.com/msberends/AMR/actions/workflows/check-old-tinytest.yaml/badge.svg?branch=main)](https://github.com/msberends/AMR/actions/workflows/check-old-tinytest.yaml)
[![check-recent](https://github.com/msberends/AMR/actions/workflows/check-current-testthat.yaml/badge.svg?branch=main)](https://github.com/msberends/AMR/actions/workflows/check-current-testthat.yaml)
[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
[![Codecov](https://codecov.io/gh/msberends/AMR/branch/main/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=main)
Please read our [Developer Guideline
here](https://github.com/msberends/AMR/wiki/Developer-Guideline).
To install the latest and unpublished beta version:
``` r
install.packages("AMR", repos = "beta.amr-for-r.org")
# if this does not work, try to install directly from GitHub using the 'remotes' package:
remotes::install_github("msberends/AMR")
```
## Get started
To find out how to conduct AMR data analysis, please [continue reading
here to get started](https://amr-for-r.org/articles/AMR.md) or click a
link in the [How to menu](https://amr-for-r.org/articles/).
## Partners
The initial development of this package was part of, related to, or made
possible by the following non-profit organisations and initiatives:
[![](./logo_rug.svg)](https://www.rug.nl "University of Groningen")
[![](./logo_umcg.svg)](https://www.umcg.nl "University Medical Center Groningen")
[![](./logo_certe.svg)](https://www.certe.nl "Certe Medical Diagnostics and Advice Foundation")
[![](./logo_eh1h.png)](https://www.deutschland-nederland.eu "EurHealth-1-Health")
[![](./logo_interreg.png)](https://www.deutschland-nederland.eu "INTERREG")
## Copyright
This R package is free, open-source software and licensed under the [GNU
General Public License v2.0
(GPL-2)](https://amr-for-r.org/LICENSE-text.md). In a nutshell, this
means that this package:
- May be used for commercial purposes
- May be used for private purposes
- May **not** be used for patent purposes
- May be modified, although:
- Modifications **must** be released under the same license when
distributing the package
- Changes made to the code **must** be documented
- May be distributed, although:
- Source code **must** be made available when the package is
distributed
- A copy of the license and copyright notice **must** be included with
the package.
- Comes with a LIMITATION of liability
- Comes with NO warranty
# Package index
## Introduction to the package
Please find the introduction to (and some general information about) our
package here.
- [`AMR-package`](https://amr-for-r.org/reference/AMR.md)
[`AMR`](https://amr-for-r.org/reference/AMR.md) :
The `AMR` Package
## Preparing data: microorganisms
These functions are meant to get taxonomically valid properties of
microorganisms from any input, but also properties derived from
taxonomy, such as the Gram stain
([`mo_gramstain()`](https://amr-for-r.org/reference/mo_property.md)) ,
or [`mo_is_yeast()`](https://amr-for-r.org/reference/mo_property.md).
Use [`mo_source()`](https://amr-for-r.org/reference/mo_source.md) to
teach this package how to translate your own codes to valid
microorganisms, and use
[`add_custom_microorganisms()`](https://amr-for-r.org/reference/add_custom_microorganisms.md)
to add your own custom microorganisms to this package.
- [`as.mo()`](https://amr-for-r.org/reference/as.mo.md)
[`is.mo()`](https://amr-for-r.org/reference/as.mo.md)
[`mo_uncertainties()`](https://amr-for-r.org/reference/as.mo.md)
[`mo_renamed()`](https://amr-for-r.org/reference/as.mo.md)
[`mo_failures()`](https://amr-for-r.org/reference/as.mo.md)
[`mo_reset_session()`](https://amr-for-r.org/reference/as.mo.md)
[`mo_cleaning_regex()`](https://amr-for-r.org/reference/as.mo.md) :
Transform Arbitrary Input to Valid Microbial Taxonomy
- [`mo_name()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_fullname()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_shortname()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_subspecies()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_species()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_genus()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_family()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_order()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_class()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_phylum()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_kingdom()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_domain()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_type()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_status()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_pathogenicity()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_gramstain()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_is_gram_negative()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_is_gram_positive()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_is_yeast()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_is_intrinsic_resistant()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_oxygen_tolerance()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_is_anaerobic()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_snomed()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_ref()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_authors()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_year()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_lpsn()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_mycobank()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_gbif()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_rank()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_taxonomy()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_synonyms()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_current()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_group_members()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_info()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_url()`](https://amr-for-r.org/reference/mo_property.md)
[`mo_property()`](https://amr-for-r.org/reference/mo_property.md) :
Get Properties of a Microorganism
- [`add_custom_microorganisms()`](https://amr-for-r.org/reference/add_custom_microorganisms.md)
[`clear_custom_microorganisms()`](https://amr-for-r.org/reference/add_custom_microorganisms.md)
: Add Custom Microorganisms
- [`set_mo_source()`](https://amr-for-r.org/reference/mo_source.md)
[`get_mo_source()`](https://amr-for-r.org/reference/mo_source.md) :
User-Defined Reference Data Set for Microorganisms
## Preparing data: antimicrobials
Use these functions to get valid properties of antimicrobials from any
input or to clean your input. You can even retrieve drug names and doses
from clinical text records, using
[`ab_from_text()`](https://amr-for-r.org/reference/ab_from_text.md).
- [`as.ab()`](https://amr-for-r.org/reference/as.ab.md)
[`is.ab()`](https://amr-for-r.org/reference/as.ab.md)
[`ab_reset_session()`](https://amr-for-r.org/reference/as.ab.md) :
Transform Input to an Antibiotic ID
- [`ab_name()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_cid()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_synonyms()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_tradenames()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_group()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_atc()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_atc_group1()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_atc_group2()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_loinc()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_ddd()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_ddd_units()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_info()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_url()`](https://amr-for-r.org/reference/ab_property.md)
[`ab_property()`](https://amr-for-r.org/reference/ab_property.md)
[`set_ab_names()`](https://amr-for-r.org/reference/ab_property.md) :
Get Properties of an Antibiotic
- [`ab_from_text()`](https://amr-for-r.org/reference/ab_from_text.md) :
Retrieve Antimicrobial Drug Names and Doses from Clinical Text
- [`atc_online_property()`](https://amr-for-r.org/reference/atc_online.md)
[`atc_online_groups()`](https://amr-for-r.org/reference/atc_online.md)
[`atc_online_ddd()`](https://amr-for-r.org/reference/atc_online.md)
[`atc_online_ddd_units()`](https://amr-for-r.org/reference/atc_online.md)
: Get ATC Properties from WHOCC Website
- [`add_custom_antimicrobials()`](https://amr-for-r.org/reference/add_custom_antimicrobials.md)
[`clear_custom_antimicrobials()`](https://amr-for-r.org/reference/add_custom_antimicrobials.md)
: Add Custom Antimicrobials
## Preparing data: antimicrobial results
With [`as.mic()`](https://amr-for-r.org/reference/as.mic.md) and
[`as.disk()`](https://amr-for-r.org/reference/as.disk.md) you can
transform your raw input to valid MIC or disk diffusion values. Use
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md) for cleaning raw
data to let it only contain “R”, “I” and “S”, or to interpret MIC or
disk diffusion values as SIR based on the lastest EUCAST and CLSI
guidelines. Afterwards, you can extend antibiotic interpretations by
applying [EUCAST
rules](https://www.eucast.org/expert_rules_and_intrinsic_resistance/)
with
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md).
- [`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
[`NA_sir_`](https://amr-for-r.org/reference/as.sir.md)
[`is.sir()`](https://amr-for-r.org/reference/as.sir.md)
[`is_sir_eligible()`](https://amr-for-r.org/reference/as.sir.md)
[`sir_interpretation_history()`](https://amr-for-r.org/reference/as.sir.md)
: Interpret MIC and Disk Diffusion as SIR, or Clean Existing SIR Data
- [`as.mic()`](https://amr-for-r.org/reference/as.mic.md)
[`is.mic()`](https://amr-for-r.org/reference/as.mic.md)
[`NA_mic_`](https://amr-for-r.org/reference/as.mic.md)
[`rescale_mic()`](https://amr-for-r.org/reference/as.mic.md)
[`mic_p50()`](https://amr-for-r.org/reference/as.mic.md)
[`mic_p90()`](https://amr-for-r.org/reference/as.mic.md)
[`droplevels(`*`<mic>`*`)`](https://amr-for-r.org/reference/as.mic.md)
: Transform Input to Minimum Inhibitory Concentrations (MIC)
- [`as.disk()`](https://amr-for-r.org/reference/as.disk.md)
[`NA_disk_`](https://amr-for-r.org/reference/as.disk.md)
[`is.disk()`](https://amr-for-r.org/reference/as.disk.md) : Transform
Input to Disk Diffusion Diameters
- [`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
[`eucast_dosage()`](https://amr-for-r.org/reference/eucast_rules.md) :
Apply EUCAST Rules
- [`custom_eucast_rules()`](https://amr-for-r.org/reference/custom_eucast_rules.md)
: Define Custom EUCAST Rules
## Analysing data
Use these function for the analysis part. You can use
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md) or
[`resistance()`](https://amr-for-r.org/reference/proportion.md) on any
antibiotic column. With
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md), you
can generate a traditional, combined, syndromic, or weighted-incidence
syndromic combination antibiogram (WISCA). This function also comes with
support for R Markdown and Quarto. Be sure to first select the isolates
that are appropiate for analysis, by using
[`first_isolate()`](https://amr-for-r.org/reference/first_isolate.md) or
[`is_new_episode()`](https://amr-for-r.org/reference/get_episode.md).
You can also filter your data on certain resistance in certain
antibiotic classes
([`carbapenems()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)),
or determine multi-drug resistant microorganisms (MDRO,
[`mdro()`](https://amr-for-r.org/reference/mdro.md)).
- [`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
[`wisca()`](https://amr-for-r.org/reference/antibiogram.md)
[`retrieve_wisca_parameters()`](https://amr-for-r.org/reference/antibiogram.md)
[`plot(`*`<antibiogram>`*`)`](https://amr-for-r.org/reference/antibiogram.md)
[`autoplot(`*`<antibiogram>`*`)`](https://amr-for-r.org/reference/antibiogram.md)
[`knit_print(`*`<antibiogram>`*`)`](https://amr-for-r.org/reference/antibiogram.md)
: Generate Traditional, Combination, Syndromic, or WISCA Antibiograms
- [`resistance()`](https://amr-for-r.org/reference/proportion.md)
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
[`sir_confidence_interval()`](https://amr-for-r.org/reference/proportion.md)
[`proportion_R()`](https://amr-for-r.org/reference/proportion.md)
[`proportion_IR()`](https://amr-for-r.org/reference/proportion.md)
[`proportion_I()`](https://amr-for-r.org/reference/proportion.md)
[`proportion_SI()`](https://amr-for-r.org/reference/proportion.md)
[`proportion_S()`](https://amr-for-r.org/reference/proportion.md)
[`proportion_df()`](https://amr-for-r.org/reference/proportion.md)
[`sir_df()`](https://amr-for-r.org/reference/proportion.md) :
Calculate Antimicrobial Resistance
- [`count_resistant()`](https://amr-for-r.org/reference/count.md)
[`count_susceptible()`](https://amr-for-r.org/reference/count.md)
[`count_S()`](https://amr-for-r.org/reference/count.md)
[`count_SI()`](https://amr-for-r.org/reference/count.md)
[`count_I()`](https://amr-for-r.org/reference/count.md)
[`count_IR()`](https://amr-for-r.org/reference/count.md)
[`count_R()`](https://amr-for-r.org/reference/count.md)
[`count_all()`](https://amr-for-r.org/reference/count.md)
[`n_sir()`](https://amr-for-r.org/reference/count.md)
[`count_df()`](https://amr-for-r.org/reference/count.md) : Count
Available Isolates
- [`get_episode()`](https://amr-for-r.org/reference/get_episode.md)
[`is_new_episode()`](https://amr-for-r.org/reference/get_episode.md) :
Determine Clinical or Epidemic Episodes
- [`first_isolate()`](https://amr-for-r.org/reference/first_isolate.md)
[`filter_first_isolate()`](https://amr-for-r.org/reference/first_isolate.md)
: Determine First Isolates
- [`key_antimicrobials()`](https://amr-for-r.org/reference/key_antimicrobials.md)
[`all_antimicrobials()`](https://amr-for-r.org/reference/key_antimicrobials.md)
[`antimicrobials_equal()`](https://amr-for-r.org/reference/key_antimicrobials.md)
: (Key) Antimicrobials for First Weighted Isolates
- [`mdro()`](https://amr-for-r.org/reference/mdro.md)
[`brmo()`](https://amr-for-r.org/reference/mdro.md)
[`mrgn()`](https://amr-for-r.org/reference/mdro.md)
[`mdr_tb()`](https://amr-for-r.org/reference/mdro.md)
[`mdr_cmi2012()`](https://amr-for-r.org/reference/mdro.md)
[`eucast_exceptional_phenotypes()`](https://amr-for-r.org/reference/mdro.md)
: Determine Multidrug-Resistant Organisms (MDRO)
- [`custom_mdro_guideline()`](https://amr-for-r.org/reference/custom_mdro_guideline.md)
[`c(`*`<custom_mdro_guideline>`*`)`](https://amr-for-r.org/reference/custom_mdro_guideline.md)
: Define Custom MDRO Guideline
- [`bug_drug_combinations()`](https://amr-for-r.org/reference/bug_drug_combinations.md)
[`format(`*`<bug_drug_combinations>`*`)`](https://amr-for-r.org/reference/bug_drug_combinations.md)
: Determine Bug-Drug Combinations
- [`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`aminopenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`antifungals()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`antimycobacterials()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`betalactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`betalactams_with_inhibitor()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`carbapenems()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`cephalosporins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`cephalosporins_1st()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`cephalosporins_2nd()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`cephalosporins_3rd()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`cephalosporins_4th()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`cephalosporins_5th()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`fluoroquinolones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`glycopeptides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`isoxazolylpenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`lincosamides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`lipoglycopeptides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`macrolides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`monobactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`nitrofurans()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`oxazolidinones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`penicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`phenicols()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`polymyxins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`quinolones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`rifamycins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`streptogramins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`sulfonamides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`tetracyclines()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`trimethoprims()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`ureidopenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`amr_class()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`amr_selector()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`administrable_per_os()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`administrable_iv()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
[`not_intrinsic_resistant()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
: Antimicrobial Selectors
- [`top_n_microorganisms()`](https://amr-for-r.org/reference/top_n_microorganisms.md)
:
Filter Top *n* Microorganisms
- [`mean_amr_distance()`](https://amr-for-r.org/reference/mean_amr_distance.md)
[`amr_distance_from_row()`](https://amr-for-r.org/reference/mean_amr_distance.md)
: Calculate the Mean AMR Distance
- [`resistance_predict()`](https://amr-for-r.org/reference/resistance_predict.md)
[`sir_predict()`](https://amr-for-r.org/reference/resistance_predict.md)
[`plot(`*`<resistance_predict>`*`)`](https://amr-for-r.org/reference/resistance_predict.md)
[`ggplot_sir_predict()`](https://amr-for-r.org/reference/resistance_predict.md)
[`autoplot(`*`<resistance_predict>`*`)`](https://amr-for-r.org/reference/resistance_predict.md)
: Predict Antimicrobial Resistance
- [`guess_ab_col()`](https://amr-for-r.org/reference/guess_ab_col.md) :
Guess Antibiotic Column
## Plotting data
Use these functions for the plotting part. The `scale_*_mic()` functions
extend the ggplot2 package to allow plotting of MIC values, even within
a manually set range. If using
[`plot()`](https://amr-for-r.org/reference/plot.md) (base R) or
[`autoplot()`](https://ggplot2.tidyverse.org/reference/autoplot.html)
(ggplot2) on MIC values or disk diffusion values, the user can set the
interpretation guideline to give the bars the right SIR colours. The
[`ggplot_sir()`](https://amr-for-r.org/reference/ggplot_sir.md) function
is a short wrapper for users not much accustomed to ggplot2 yet. The
[`ggplot_pca()`](https://amr-for-r.org/reference/ggplot_pca.md) function
is a specific function to plot so-called biplots for PCA (principal
component analysis).
- [`scale_x_mic()`](https://amr-for-r.org/reference/plot.md)
[`scale_y_mic()`](https://amr-for-r.org/reference/plot.md)
[`scale_colour_mic()`](https://amr-for-r.org/reference/plot.md)
[`scale_fill_mic()`](https://amr-for-r.org/reference/plot.md)
[`scale_x_sir()`](https://amr-for-r.org/reference/plot.md)
[`scale_colour_sir()`](https://amr-for-r.org/reference/plot.md)
[`scale_fill_sir()`](https://amr-for-r.org/reference/plot.md)
[`plot(`*`<mic>`*`)`](https://amr-for-r.org/reference/plot.md)
[`autoplot(`*`<mic>`*`)`](https://amr-for-r.org/reference/plot.md)
[`plot(`*`<disk>`*`)`](https://amr-for-r.org/reference/plot.md)
[`autoplot(`*`<disk>`*`)`](https://amr-for-r.org/reference/plot.md)
[`plot(`*`<sir>`*`)`](https://amr-for-r.org/reference/plot.md)
[`autoplot(`*`<sir>`*`)`](https://amr-for-r.org/reference/plot.md)
[`facet_sir()`](https://amr-for-r.org/reference/plot.md)
[`scale_y_percent()`](https://amr-for-r.org/reference/plot.md)
[`scale_sir_colours()`](https://amr-for-r.org/reference/plot.md)
[`theme_sir()`](https://amr-for-r.org/reference/plot.md)
[`labels_sir_count()`](https://amr-for-r.org/reference/plot.md) :
Plotting Helpers for AMR Data Analysis
- [`ggplot_sir()`](https://amr-for-r.org/reference/ggplot_sir.md)
[`geom_sir()`](https://amr-for-r.org/reference/ggplot_sir.md) :
AMR Plots with `ggplot2`
- [`ggplot_pca()`](https://amr-for-r.org/reference/ggplot_pca.md) :
PCA Biplot with `ggplot2`
## AMR-specific options
The AMR package is customisable, by providing settings that can be set
per user or per team. For example, the default interpretation guideline
can be changed from EUCAST to CLSI, or a supported language can be set
for the whole team (system-language independent) for antibiotic names in
a foreign language.
- [`AMR-options`](https://amr-for-r.org/reference/AMR-options.md) :
Options for the AMR package
## Other: antiviral drugs
This package also provides extensive support for antiviral agents, even
though it is not the primary scope of this package. Working with data
containing information about antiviral drugs was never easier. Use these
functions to get valid properties of antiviral drugs from any input or
to clean your input. You can even retrieve drug names and doses from
clinical text records, using
[`av_from_text()`](https://amr-for-r.org/reference/av_from_text.md).
- [`as.av()`](https://amr-for-r.org/reference/as.av.md)
[`is.av()`](https://amr-for-r.org/reference/as.av.md) : Transform
Input to an Antiviral Drug ID
- [`av_name()`](https://amr-for-r.org/reference/av_property.md)
[`av_cid()`](https://amr-for-r.org/reference/av_property.md)
[`av_synonyms()`](https://amr-for-r.org/reference/av_property.md)
[`av_tradenames()`](https://amr-for-r.org/reference/av_property.md)
[`av_group()`](https://amr-for-r.org/reference/av_property.md)
[`av_atc()`](https://amr-for-r.org/reference/av_property.md)
[`av_loinc()`](https://amr-for-r.org/reference/av_property.md)
[`av_ddd()`](https://amr-for-r.org/reference/av_property.md)
[`av_ddd_units()`](https://amr-for-r.org/reference/av_property.md)
[`av_info()`](https://amr-for-r.org/reference/av_property.md)
[`av_url()`](https://amr-for-r.org/reference/av_property.md)
[`av_property()`](https://amr-for-r.org/reference/av_property.md) :
Get Properties of an Antiviral Drug
- [`av_from_text()`](https://amr-for-r.org/reference/av_from_text.md) :
Retrieve Antiviral Drug Names and Doses from Clinical Text
## Other: background information on included data
Some pages about our package and its external sources. Be sure to read
our [How Tos](https://amr-for-r.org/articles/index.md) for more
information about how to work with functions in this package.
- [`microorganisms`](https://amr-for-r.org/reference/microorganisms.md)
: Data Set with 78 679 Taxonomic Records of Microorganisms
- [`antimicrobials`](https://amr-for-r.org/reference/antimicrobials.md)
[`antibiotics`](https://amr-for-r.org/reference/antimicrobials.md)
[`antivirals`](https://amr-for-r.org/reference/antimicrobials.md) :
Data Sets with 618 Antimicrobial Drugs
- [`clinical_breakpoints`](https://amr-for-r.org/reference/clinical_breakpoints.md)
: Data Set with Clinical Breakpoints for SIR Interpretation
- [`example_isolates`](https://amr-for-r.org/reference/example_isolates.md)
: Data Set with 2 000 Example Isolates
- [`microorganisms.codes`](https://amr-for-r.org/reference/microorganisms.codes.md)
: Data Set with 6 036 Common Microorganism Codes
- [`microorganisms.groups`](https://amr-for-r.org/reference/microorganisms.groups.md)
: Data Set with 534 Microorganisms In Species Groups
- [`intrinsic_resistant`](https://amr-for-r.org/reference/intrinsic_resistant.md)
: Data Set Denoting Bacterial Intrinsic Resistance
- [`dosage`](https://amr-for-r.org/reference/dosage.md) : Data Set with
Treatment Dosages as Defined by EUCAST
- [`WHOCC`](https://amr-for-r.org/reference/WHOCC.md) : WHOCC: WHO
Collaborating Centre for Drug Statistics Methodology
- [`example_isolates_unclean`](https://amr-for-r.org/reference/example_isolates_unclean.md)
: Data Set with Unclean Data
- [`WHONET`](https://amr-for-r.org/reference/WHONET.md) : Data Set with
500 Isolates - WHONET Example
## Other: miscellaneous functions
These functions are mostly for internal use, but some of them may also
be suitable for your analysis. Especially the like function can be
useful: `if (x %like% y) {...}`.
- [`age_groups()`](https://amr-for-r.org/reference/age_groups.md) :
Split Ages into Age Groups
- [`age()`](https://amr-for-r.org/reference/age.md) : Age in Years of
Individuals
- [`export_ncbi_biosample()`](https://amr-for-r.org/reference/export_ncbi_biosample.md)
: Export Data Set as NCBI BioSample Antibiogram
- [`availability()`](https://amr-for-r.org/reference/availability.md) :
Check Availability of Columns
- [`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md)
[`set_AMR_locale()`](https://amr-for-r.org/reference/translate.md)
[`reset_AMR_locale()`](https://amr-for-r.org/reference/translate.md)
[`translate_AMR()`](https://amr-for-r.org/reference/translate.md) :
Translate Strings from the AMR Package
- [`italicise_taxonomy()`](https://amr-for-r.org/reference/italicise_taxonomy.md)
[`italicize_taxonomy()`](https://amr-for-r.org/reference/italicise_taxonomy.md)
: Italicise Taxonomic Families, Genera, Species, Subspecies
- [`inner_join_microorganisms()`](https://amr-for-r.org/reference/join.md)
[`left_join_microorganisms()`](https://amr-for-r.org/reference/join.md)
[`right_join_microorganisms()`](https://amr-for-r.org/reference/join.md)
[`full_join_microorganisms()`](https://amr-for-r.org/reference/join.md)
[`semi_join_microorganisms()`](https://amr-for-r.org/reference/join.md)
[`anti_join_microorganisms()`](https://amr-for-r.org/reference/join.md)
: Join microorganisms to a Data Set
- [`like()`](https://amr-for-r.org/reference/like.md)
[`` `%like%` ``](https://amr-for-r.org/reference/like.md)
[`` `%unlike%` ``](https://amr-for-r.org/reference/like.md)
[`` `%like_case%` ``](https://amr-for-r.org/reference/like.md)
[`` `%unlike_case%` ``](https://amr-for-r.org/reference/like.md) :
Vectorised Pattern Matching with Keyboard Shortcut
- [`mo_matching_score()`](https://amr-for-r.org/reference/mo_matching_score.md)
: Calculate the Matching Score for Microorganisms
- [`pca()`](https://amr-for-r.org/reference/pca.md) : Principal
Component Analysis (for AMR)
- [`random_mic()`](https://amr-for-r.org/reference/random.md)
[`random_disk()`](https://amr-for-r.org/reference/random.md)
[`random_sir()`](https://amr-for-r.org/reference/random.md) : Random
MIC Values/Disk Zones/SIR Generation
## Other: statistical tests
Some statistical tests or methods are not part of base R and were added
to this package for convenience.
- [`g.test()`](https://amr-for-r.org/reference/g.test.md) :
*G*-test for Count Data
- [`kurtosis()`](https://amr-for-r.org/reference/kurtosis.md) : Kurtosis
of the Sample
- [`skewness()`](https://amr-for-r.org/reference/skewness.md) : Skewness
of the Sample
## Other: deprecated functions/arguments/datasets
These objects are deprecated, meaning that they will still work but show
a warning that they will be removed in a future version.
- [`ab_class()`](https://amr-for-r.org/reference/AMR-deprecated.md)
[`ab_selector()`](https://amr-for-r.org/reference/AMR-deprecated.md) :
Deprecated Functions, Arguments, or Datasets
# Articles
### All vignettes
- [AMR for Python](https://amr-for-r.org/articles/AMR_for_Python.md):
- [AMR with
tidymodels](https://amr-for-r.org/articles/AMR_with_tidymodels.md):
- [Conduct AMR data analysis](https://amr-for-r.org/articles/AMR.md):
- [Download data sets for download / own
use](https://amr-for-r.org/articles/datasets.md):
- [Apply EUCAST rules](https://amr-for-r.org/articles/EUCAST.md):
- [Conduct principal component analysis (PCA) for
AMR](https://amr-for-r.org/articles/PCA.md):
- [Work with WHONET data](https://amr-for-r.org/articles/WHONET.md):
- [Estimating Empirical Coverage with
WISCA](https://amr-for-r.org/articles/WISCA.md):

View File

@@ -7,7 +7,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -49,10 +49,11 @@
</div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="3.0.1.9002" id="amr-3019002">AMR 3.0.1.9002<a class="anchor" aria-label="anchor" href="#amr-3019002"></a></h2>
<h2 class="pkg-version" data-toc-text="3.0.1.9003" id="amr-3019003">AMR 3.0.1.9003<a class="anchor" aria-label="anchor" href="#amr-3019003"></a></h2>
<div class="section level4">
<h4 id="changed-3-0-1-9002">Changed<a class="anchor" aria-label="anchor" href="#changed-3-0-1-9002"></a></h4>
<h4 id="changed-3-0-1-9003">Changed<a class="anchor" aria-label="anchor" href="#changed-3-0-1-9003"></a></h4>
<ul><li>Fixed a bug in <code><a href="../reference/antibiogram.html">antibiogram()</a></code> for when no antimicrobials are set</li>
<li>Added taniborbactam (<code>TAN</code>) and cefepime/taniborbactam (<code>FTA</code>) to the <code>antimicrobials</code> data set</li>
</ul></div>
</div>
<div class="section level2">

490
news/index.md Normal file
View File

@@ -0,0 +1,490 @@
# Changelog
## AMR 3.0.1.9003
#### Changed
- Fixed a bug in
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md) for
when no antimicrobials are set
- Added taniborbactam (`TAN`) and cefepime/taniborbactam (`FTA`) to the
`antimicrobials` data set
## AMR 3.0.1
CRAN release: 2025-09-20
This is a bugfix release following the release of v3.0.0 in June 2025.
#### Changed
- Fixed bugs introduced by `ggplot2` v4.0.0
([\#236](https://github.com/msberends/AMR/issues/236))
- MIC scale functions (such as
[`scale_y_mic()`](https://amr-for-r.org/reference/plot.md)) will now
be applied automatically when plotting values of class `mic`
- SIR scale functions (such as
[`scale_x_sir()`](https://amr-for-r.org/reference/plot.md)) will now
be applied automatically when plotting values of class `sir`
- Fixed a bug in
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md) for
when no antimicrobials are set
- Fixed a bug in
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md) to
allow column names containing the `+` character
([\#222](https://github.com/msberends/AMR/issues/222))
- Fixed a bug in [`as.ab()`](https://amr-for-r.org/reference/as.ab.md)
for antimicrobial codes with a number in it if they are preceded by a
space
- Fixed a bug in
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
for using specific custom rules
- Fixed a bug in [`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
to allow any tidyselect language
([\#220](https://github.com/msberends/AMR/issues/220))
- Fixed a bug in [`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
to pick right breakpoint when `uti = FALSE`
([\#216](https://github.com/msberends/AMR/issues/216))
- Fixed a bug in
[`ggplot_sir()`](https://amr-for-r.org/reference/ggplot_sir.md) when
using `combine_SI = FALSE`
([\#213](https://github.com/msberends/AMR/issues/213))
- Fixed a bug in [`mdro()`](https://amr-for-r.org/reference/mdro.md) to
make sure all genes specified in arguments are acknowledged
- Fixed a bug the `antimicrobials` data set to remove statins
([\#229](https://github.com/msberends/AMR/issues/229))
- Fixed a bug the `microorganisms` data set for MycoBank IDs and
synonyms ([\#233](https://github.com/msberends/AMR/issues/233))
- Fixed ATC J01CR05 to map to piperacillin/tazobactam rather than
piperacillin/sulbactam
([\#230](https://github.com/msberends/AMR/issues/230))
- Fixed skimmers (`skimr` package) of class `ab`, `sir`, and `disk`
([\#234](https://github.com/msberends/AMR/issues/234))
- Fixed all plotting to contain a separate colour for SDD (susceptible
dose-dependent) ([\#223](https://github.com/msberends/AMR/issues/223))
- Fixed some specific Dutch translations for antimicrobials
- Added a warning to
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md) if input
resembles antiviral codes or names
([\#232](https://github.com/msberends/AMR/issues/232))
- Added all reasons in verbose output of
[`mdro()`](https://amr-for-r.org/reference/mdro.md)
([\#227](https://github.com/msberends/AMR/issues/227))
- Added `names` to
[`age_groups()`](https://amr-for-r.org/reference/age_groups.md) so
that custom names can be given
([\#215](https://github.com/msberends/AMR/issues/215))
- Added note to [`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
to make it explicit when higher-level taxonomic breakpoints are used
([\#218](https://github.com/msberends/AMR/issues/218))
- Added antibiotic codes from the Comprehensive Antibiotic Resistance
Database (CARD) to the `antimicrobials` data set
([\#225](https://github.com/msberends/AMR/issues/225))
- Updated Fosfomycin to be of antibiotic class Phosphonics
([\#225](https://github.com/msberends/AMR/issues/225))
- Updated [`random_mic()`](https://amr-for-r.org/reference/random.md)
and [`random_disk()`](https://amr-for-r.org/reference/random.md) to
set skewedness of the distribution and allow multiple microorganisms
## AMR 3.0.0
CRAN release: 2025-06-02
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
[University of Prince Edward Islands Atlantic Veterinary
College](https://www.upei.ca/avc), Canada. To celebrate this great
improvement of the package, we also updated the package logo to reflect
this change.
#### Breaking
- Dataset `antibiotics` has been renamed to `antimicrobials` as the data
set contains more than just antibiotics. Using `antibiotics` will
still work, but now returns a warning.
- Removed all functions and references that used the deprecated `rsi`
class, which were all replaced with their `sir` equivalents over two
years ago.
- Functions
[`resistance_predict()`](https://amr-for-r.org/reference/resistance_predict.md)
and
[`sir_predict()`](https://amr-for-r.org/reference/resistance_predict.md)
are now deprecated and will be removed in a future version. Use the
`tidymodels` framework instead, for which we [wrote a basic
introduction](https://amr-for-r.org/articles/AMR_with_tidymodels.html).
#### New
- **One Health implementation**
- Function [`as.sir()`](https://amr-for-r.org/reference/as.sir.md) now
has extensive support for veterinary breakpoints from CLSI. Use
`breakpoint_type = "animal"` and set the `host` argument to a
variable that contains animal species names.
- The `clinical_breakpoints` data set contains all these breakpoints,
and can be downloaded on our [download
page](https://amr-for-r.org/articles/datasets.html).
- The (new) `antimicrobials` data set contains all veterinary
antimicrobials, such as pradofloxacin and enrofloxacin. All WHOCC
codes for veterinary use have been added as well.
- [`ab_atc()`](https://amr-for-r.org/reference/ab_property.md) now
supports ATC codes of veterinary antimicrobials (that all start with
“Q”)
- [`ab_url()`](https://amr-for-r.org/reference/ab_property.md) now
supports retrieving the WHOCC url of their ATCvet pages
- **Support for WISCA antibiograms**
- The
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
function now supports creating true Weighted-Incidence Syndromic
Combination Antibiograms (WISCA), a powerful Bayesian method for
estimating regimen coverage probabilities using pathogen incidence
and antimicrobial susceptibility data. WISCA offers improved
precision for syndrome-specific treatment, even in datasets with
sparse data. A dedicated
[`wisca()`](https://amr-for-r.org/reference/antibiogram.md) function
is also available for easy usage.
- **More global coverage of languages**
- Added full support for 8 new languages: Arabic, Bengali, Hindi,
Indonesian, Korean, Swahili, Urdu, and Vietnamese. The `AMR` package
is now available in 28 languages.
- **Major update to fungal taxonomy and tools for mycologists**
- MycoBank has now been integrated as the primary taxonomic source for
fungi. The `microorganisms` data set has been enriched with new
columns (`mycobank`, `mycobank_parent`, and `mycobank_renamed_to`)
that provide detailed information for fungal species.
- A remarkable addition of over 20,000 new fungal records
- New function
[`mo_mycobank()`](https://amr-for-r.org/reference/mo_property.md) to
retrieve the MycoBank record number, analogous to existing functions
such as
[`mo_lpsn()`](https://amr-for-r.org/reference/mo_property.md) and
[`mo_gbif()`](https://amr-for-r.org/reference/mo_property.md).
- The [`as.mo()`](https://amr-for-r.org/reference/as.mo.md) function
and all `mo_*()` functions now include an `only_fungi` argument,
allowing users to restrict results solely to fungal species. This
ensures fungi are prioritised over bacteria during microorganism
identification. This can also be set globally with the new
`AMR_only_fungi` option.
- Also updated other kingdoms, welcoming a total of 2,149 new records
from 2023 and 927 from 2024.
- **Updated clinical breakpoints**
- Breakpoint of 2024 and 2025 of both CLSI and EUCAST are now
supported, by adding all of their over 10,000 new clinical
breakpoints to the `clinical_breakpoints` data set for usage in
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md). EUCAST 2025
is now the new default guideline for all MIC and disk diffusion
interpretations.
- Added all Expected Resistant Phenotypes from EUCAST (v1.2). The
default `rules` for
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
are now: `c("breakpoints", "expected_phenotypes")`.
- Updated the `intrinsic_resistant` data set, which is now based on
EUCAST Expected Resistant Phenotypes v1.2
- [`as.sir()`](https://amr-for-r.org/reference/as.sir.md) now brings
additional factor levels: “NI” for non-interpretable and “SDD” for
susceptible dose-dependent. Currently, the `clinical_breakpoints`
data set contains 24 breakpoints that can return the value “SDD”
instead of “I”.
- EUCAST interpretive rules (using
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md))
are now available for EUCAST 12 (2022), 13 (2023), 14 (2024), and 15
(2025).
- EUCAST dosage tables (`dosage` data set) are now available for
EUCAST 13 (2023), 14 (2024), and 15 (2025).
- **New advanced ggplot2 extensions for MIC and SIR plotting and
transforming**
- New function group `scale_*_mic()`, namely:
[`scale_x_mic()`](https://amr-for-r.org/reference/plot.md),
[`scale_y_mic()`](https://amr-for-r.org/reference/plot.md),
[`scale_colour_mic()`](https://amr-for-r.org/reference/plot.md) and
[`scale_fill_mic()`](https://amr-for-r.org/reference/plot.md). They
allow easy plotting of MIC values. They allow for manual range
definition and plotting missing intermediate log2 levels.
- New function group `scale_*_sir()`, namely:
[`scale_x_sir()`](https://amr-for-r.org/reference/plot.md),
[`scale_colour_sir()`](https://amr-for-r.org/reference/plot.md) and
[`scale_fill_sir()`](https://amr-for-r.org/reference/plot.md). They
allow to plot the `sir` class, and translates into the system
language at default. They also set colourblind-safe colours to the
plots.
- New function
[`rescale_mic()`](https://amr-for-r.org/reference/as.mic.md), which
allows users to rescale MIC values to a manually set range. This is
the powerhouse behind the `scale_*_mic()` functions, but it can be
used independently to, for instance, compare equality in MIC
distributions by rescaling them to the same range first.
- **Support for Python**
- While using R for the heavy lifting, [our AMR Python
Package](https://pypi.org/project/AMR/) was developed to run the AMR
R package natively in Python. The Python package will always have
the same version number as the R package, as it is built
automatically with every code change.
- **Support for `tidymodels`**
- All antimicrobial selectors (such as
[`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`betalactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md))
are now supported in `tidymodels` packages such as `recipe` and
`parsnip`. See for more info [our
tutorial](https://amr-for-r.org/articles/AMR_with_tidymodels.html)
on using these AMR functions for predictive modelling.
- **Other**
- New function
[`top_n_microorganisms()`](https://amr-for-r.org/reference/top_n_microorganisms.md)
to filter a data set to the top *n* of any taxonomic property, e.g.,
filter to the top 3 species, filter to any species in the top 5
genera, or filter to the top 3 species in each of the top 5 genera
- New function
[`mo_group_members()`](https://amr-for-r.org/reference/mo_property.md)
to retrieve the member microorganisms of a microorganism group. For
example, `mo_group_members("Strep group C")` returns a vector of all
microorganisms that belong to that group.
- New functions
[`mic_p50()`](https://amr-for-r.org/reference/as.mic.md) and
[`mic_p90()`](https://amr-for-r.org/reference/as.mic.md) to retrieve
the 50th and 90th percentile of MIC values.
#### Changed
- SIR interpretation
- Support for parallel computing to greatly improve speed using the
`parallel` package (part of base R). Use
`as.sir(your_data, parallel = TRUE)` to run SIR interpretation using
multiple cores.
- It is now possible to use column names for arguments `guideline`,
`ab`, `mo`, and `uti`:
`as.sir(..., ab = "column1", mo = "column2", uti = "column3")`. This
greatly improves the flexibility for users.
- Users can now set their own criteria (using regular expressions) as
to what should be considered S, I, R, SDD, and NI.
- To get quantitative values,
[`as.double()`](https://rdrr.io/r/base/double.html) on a `sir`
object will return 1 for S, 2 for SDD/I, and 3 for R (NI will become
`NA`). Other functions using `sir` classes (e.g.,
[`summary()`](https://rdrr.io/r/base/summary.html)) are updated to
reflect the change to contain NI and SDD.
- Following CLSI interpretation rules, values outside the
log2-dilution range will be rounded upwards to the nearest
log2-level before interpretation. Only if using a CLSI guideline.
- Combined MIC values (e.g., from CLSI) are now supported
- The argument `conserve_capped_values` in
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md) has been
replaced with `capped_mic_handling`, which allows greater
flexibility in handling capped MIC values (`<`, `<=`, `>`, `>=`).
The four available options (`"standard"`, `"strict"`, `"relaxed"`,
`"inverse"`) provide full control over whether these values should
be interpreted conservatively or ignored. Using
`conserve_capped_values` is now deprecated and returns a warning.
- Added argument `info` to silence all console messages
- [`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
function
- Argument `antibiotics` has been renamed to `antimicrobials`. Using
`antibiotics` will still work, but now returns a warning.
- Added argument `formatting_type` to set any of the 22 options for
the formatting of all cells. This defaults to `18` for non-WISCA
and `14` for WISCA, changing the output of antibiograms to cells
with more info.
- For this reason, `add_total_n` is now deprecated and `FALSE` at
default since the denominators are added to the cells dependent on
the `formatting_type` setting
- The `ab_transform` argument now defaults to `"name"`, displaying
antibiotic column names instead of codes
- Antimicrobial selectors (previously: *antibiotic selectors*)
- Antibiotic selectors are now called antimicrobial selectors
since their scope is broader than just antibiotics. All
documentation have been updated, and
[`ab_class()`](https://amr-for-r.org/reference/AMR-deprecated.md)
and
[`ab_selector()`](https://amr-for-r.org/reference/AMR-deprecated.md)
have been replaced with
[`amr_class()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`amr_selector()`](https://amr-for-r.org/reference/antimicrobial_selectors.md).
The old functions are now deprecated and will be removed in a future
version.
- Added selectors
[`isoxazolylpenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`monobactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`nitrofurans()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`phenicols()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`rifamycins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
and
[`sulfonamides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
- When using antimicrobial selectors that exclude non-treatable drugs
(such as gentamicin-high when using
[`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)),
the function now always returns a warning that these can be included
using `only_treatable = FALSE`
- Added a new argument `return_all` to all selectors, which defaults
to `TRUE` to include any match. With `FALSE`, the old behaviour,
only the first hit for each unique antimicrobial is returned.
- All selectors can now be run as a separate command to retrieve a
vector of all possible antimicrobials that the selector can select
- The selectors
[`lincosamides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
and
[`macrolides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
do not overlap anymore - each antibiotic is now classified as either
of these and not both
- Fixed selector
[`fluoroquinolones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
which now really only selects second-generation quinolones and up
(first-generation quinolones do not contain a fluorine group)
- `antimicrobials` data set
- Added agents used for screening, with an ID all ending with `-S`:
benzylpenicillin screening test (`PEN-S`), beta-lactamase screening
test (`BLA-S`), cefotaxime screening test (`CTX-S`), clindamycin
inducible screening test (`CLI-S`), nalidixic acid screening test
(`NAL-S`), norfloxacin screening test (`NOR-S`), oxacillin screening
test (`OXA-S`), pefloxacin screening test (`PEF-S`), and
tetracycline screening test (`TCY-S`). The ID of cefoxitin screening
was renamed from `FOX1` to `FOX-S`, while the old code remains to
work.
- For this reason, the antimicrobial selectors
[`cephalosporins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`cephalosporins_3rd()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`lincosamides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`isoxazolylpenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`quinolones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
[`fluoroquinolones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md),
and
[`tetracyclines()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
now contain the argument `only_treatable = TRUE` (similar to other
antimicrobial selectors that contain non-treatable drugs)
- Added amorolfine (`AMO`, D01AE16), an antimycotic, which is now also
part of the
[`antifungals()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
selector
- Added cefepime/enmetazobactam (`FPE`), a 4th gen cephalosporin
- Added tigemonam (`TNM`), a monobactam
- Added bleomycin (`BLM`), a glycopeptide
- Added efflux (`EFF`), to allow mapping to AMRFinderPlus
- Updated all ATC codes, trade names, and DDDs
- MICs
- Added as valid levels: 4096, 6 powers of 0.0625, and 5 powers of 192
(192, 384, 576, 768, 960)
- Fixed a bug in
[`as.mic()`](https://amr-for-r.org/reference/as.mic.md) that failed
translation of scientifically formatted numbers
- Added new argument `keep_operators` to
[`as.mic()`](https://amr-for-r.org/reference/as.mic.md). This can be
`"all"` (default), `"none"`, or `"edges"`. This argument is also
available in the new
[`rescale_mic()`](https://amr-for-r.org/reference/as.mic.md) and
`scale_*_mic()` functions.
- Comparisons of MIC values are now more strict. For example, `>32` is
higher than (and never equal to) `32`. Thus,
`as.mic(">32") == as.mic(32)` now returns `FALSE`, and
`as.mic(">32") > as.mic(32)` now returns `TRUE`.
- Sorting of MIC values (using
[`sort()`](https://rdrr.io/r/base/sort.html)) was fixed in the same
manner; `<0.001` now gets sorted before `0.001`, and `>0.001` gets
sorted after `0.001`.
- Intermediate log2 levels used for MIC plotting are now more common
values instead of following a strict dilution range
- [`is.mic()`](https://amr-for-r.org/reference/as.mic.md) now returns
a vector of `TRUE`/`FALSE` if the input is a `data.frame`, just like
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
- [`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
now has an argument `overwrite` (default: `FALSE`) to indicate whether
non-`NA` values should be overwritten
- Disks of 0 to 5 mm are now allowed, the newly allowed range for disk
diffusion ([`as.disk()`](https://amr-for-r.org/reference/as.disk.md))
is now between 0 and 50 mm
- Updated
[`italicise_taxonomy()`](https://amr-for-r.org/reference/italicise_taxonomy.md)
to support HTML output
- [`custom_eucast_rules()`](https://amr-for-r.org/reference/custom_eucast_rules.md)
now supports multiple antimicrobials and antimicrobial groups to be
affected by a single rule
- [`mo_info()`](https://amr-for-r.org/reference/mo_property.md) now
contains an extra element `rank` and `group_members` (with the
contents of the new
[`mo_group_members()`](https://amr-for-r.org/reference/mo_property.md)
function)
- Updated all ATC codes from WHOCC
- Updated all antimicrobial DDDs from WHOCC
- Fix for using a manual value for `mo_transform` in
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
- Fixed a bug for when
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md)
returns an empty data set
- Argument `only_sir_columns` now defaults to `TRUE` if any column of a
data set contains a class sir (functions
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md),
[`key_antimicrobials()`](https://amr-for-r.org/reference/key_antimicrobials.md),
[`mdro()`](https://amr-for-r.org/reference/mdro.md), etc.)
- Added Sensititre codes for animals, antimicrobials and microorganisms
- Fix for mapping high level antimicrobials in
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md) (amphotericin
B-high, gentamicin-high, kanamycin-high, streptomycin-high,
tobramycin-high)
- Improved overall algorithm of
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md) for better
performance and accuracy, including the new function
`as_reset_session()` to remove earlier coercions.
- Improved overall algorithm of
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) for better
performance and accuracy, specifically:
- More weight is given to genus and species combinations in cases
where the subspecies is miswritten, so that the result will be the
correct genus and species
- Genera from the World Health Organizations (WHO) Priority Pathogen
List now have the highest prevalence
- Fixed a bug for
[`sir_confidence_interval()`](https://amr-for-r.org/reference/proportion.md)
when there are no isolates available
- Updated the prevalence calculation to include genera from the World
Health Organizations (WHO) Priority Pathogen List
- Improved algorithm of
[`first_isolate()`](https://amr-for-r.org/reference/first_isolate.md)
when using the phenotype-based method, to prioritise records with the
highest availability of SIR values
- [`scale_y_percent()`](https://amr-for-r.org/reference/plot.md) can now
cope with ranges outside the 0-100% range
- MDRO determination (using
[`mdro()`](https://amr-for-r.org/reference/mdro.md))
- The Verbose Mode (`verbose = TRUE`) now includes the guideline name
- Implemented the new Dutch national MDRO guideline (SRI-richtlijn
BRMO, Nov 2024)
- Added arguments `esbl`, `carbapenemase`, `mecA`, `mecC`, `vanA`,
`vanB` to denote column names or logical values indicating presence
of these genes (or production of their proteins)
- Added upport for antimicrobial selectors to use as as a custom rule
([`custom_mdro_guideline()`](https://amr-for-r.org/reference/custom_mdro_guideline.md))
- Added console colours support of `sir` class for Positron
#### Other
- New website domain: <https://amr-for-r.org>! The old domain will
remain to work.
- Added Dr. Larisse Bolton and Aislinn Cook as contributors for their
fantastic implementation of WISCA in a mathematically solid way
- Added Matthew Saab, Dr. Jordan Stull, and Prof. Javier Sanchez as
contributors for their tremendous input on veterinary breakpoints and
interpretations
- Added Prof. Kathryn Holt, Dr. Jane Hawkey, and Dr. Natacha Couto as
contributors for their many suggestions, ideas and bugfixes
- Greatly improved `vctrs` integration, a Tidyverse package working in
the background for many Tidyverse functions. For users, this means
that functions such as `dplyr`s
[`bind_rows()`](https://dplyr.tidyverse.org/reference/bind_rows.html),
[`rowwise()`](https://dplyr.tidyverse.org/reference/rowwise.html) and
[`c_across()`](https://dplyr.tidyverse.org/reference/c_across.html)
are now supported for e.g. columns of class `mic`. Despite this, this
`AMR` package is still zero-dependent on any other package, including
`dplyr` and `vctrs`.
- Greatly updated and expanded documentation
- Stopped support for SAS (`.xpt`) files, since their file structure and
extremely inefficient and requires more disk space than GitHub allows
in a single commit.
### Older Versions
This changelog only contains changes from AMR v3.0 (June 2025) and
later.
- For prior v2 versions, please see [our v2
archive](https://github.com/msberends/AMR/blob/v2.1.1/NEWS.md).
- For prior v1 versions, please see [our v1
archive](https://github.com/msberends/AMR/blob/v1.8.2/NEWS.md).

View File

@@ -1,6 +1,6 @@
/* http://gregfranko.com/blog/jquery-best-practices/ */
(function($) {
$(function() {
(function ($) {
$(function () {
$('nav.navbar').headroom();
@@ -30,14 +30,14 @@
/* Clipboard --------------------------*/
function changeTooltipMessage(element, msg) {
var tooltipOriginalTitle=element.getAttribute('data-bs-original-title');
var tooltipOriginalTitle = element.getAttribute('data-bs-original-title');
element.setAttribute('data-bs-original-title', msg);
$(element).tooltip('show');
element.setAttribute('data-bs-original-title', tooltipOriginalTitle);
}
if(ClipboardJS.isSupported()) {
$(document).ready(function() {
if (ClipboardJS.isSupported()) {
$(document).ready(function () {
var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' title='Copy to clipboard' aria-label='Copy to clipboard' data-toggle='tooltip' data-placement='left' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy'></i></button>";
$("div.sourceCode").addClass("hasCopyButton");
@@ -46,22 +46,22 @@
$(copyButton).prependTo(".hasCopyButton");
// Initialize tooltips:
$('.btn-copy-ex').tooltip({container: 'body'});
$('.btn-copy-ex').tooltip({ container: 'body' });
// Initialize clipboard:
var clipboard = new ClipboardJS('[data-clipboard-copy]', {
text: function(trigger) {
text: function (trigger) {
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
}
});
clipboard.on('success', function(e) {
clipboard.on('success', function (e) {
changeTooltipMessage(e.trigger, 'Copied!');
e.clearSelection();
});
clipboard.on('error', function(e) {
changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
clipboard.on('error', function (e) {
changeTooltipMessage(e.trigger, 'Press Ctrl+C or Command+C to copy');
});
});
@@ -84,7 +84,7 @@
/* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */
// Initialise search index on focus
var fuse;
$("#search-input").focus(async function(e) {
$("#search-input").focus(async function (e) {
if (fuse) {
return;
}
@@ -113,7 +113,7 @@
minLength: 2,
};
var q;
async function searchFuse(query, callback) {
async function searchFuse(query, callback) {
await fuse;
var items;
@@ -126,11 +126,11 @@ async function searchFuse(query, callback) {
.filter((x) => x.score <= 0.75)
.map((x) => x.item);
if (items.length === 0) {
items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}];
items = [{ dir: "Sorry 😿", previous_headings: "", title: "No results found.", what: "No results found.", path: window.location.href }];
}
}
callback(items);
}
}
$("#search-input").autocomplete(options, [
{
name: "content",
@@ -147,13 +147,13 @@ async function searchFuse(query, callback) {
},
},
},
]).on('autocomplete:selected', function(event, s) {
]).on('autocomplete:selected', function (event, s) {
window.location.href = s.path + "?q=" + q + "#" + s.id;
});
});
})(window.jQuery || window.$)
document.addEventListener('keydown', function(event) {
document.addEventListener('keydown', function (event) {
// Check if the pressed key is '/'
if (event.key === '/') {
event.preventDefault(); // Prevent any default action associated with the '/' key

View File

@@ -1,5 +1,5 @@
pandoc: 3.1.11
pkgdown: 2.1.3
pkgdown: 2.2.0
pkgdown_sha: ~
articles:
AMR_for_Python: AMR_for_Python.html
@@ -10,7 +10,7 @@ articles:
PCA: PCA.html
WHONET: WHONET.html
WISCA: WISCA.html
last_built: 2025-10-13T20:18Z
last_built: 2025-11-24T10:38Z
urls:
reference: https://amr-for-r.org/reference
article: https://amr-for-r.org/articles

View File

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

@@ -0,0 +1,15 @@
# Deprecated Functions, Arguments, or Datasets
These objects are so-called
'[Deprecated](https://rdrr.io/r/base/Deprecated.html)'. **They will be
removed in a future version of this package.** Using these will give a
warning with the name of the alternative object it has been replaced by
(if there is one).
## Usage
``` r
ab_class(...)
ab_selector(...)
```

View File

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

153
reference/AMR-options.md Normal file
View File

@@ -0,0 +1,153 @@
# Options for the AMR package
This is an overview of all the package-specific
[`options()`](https://rdrr.io/r/base/options.html) you can set in the
`AMR` package.
## Options
- `AMR_antibiogram_formatting_type`
A [numeric](https://rdrr.io/r/base/numeric.html) (1-22) to use in
[`antibiogram()`](https://amr-for-r.org/reference/antibiogram.md), to
indicate which formatting type to use.
- `AMR_breakpoint_type`
A [character](https://rdrr.io/r/base/character.html) to use in
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md), to indicate
which breakpoint type to use. This must be either "ECOFF", "animal",
or "human".
- `AMR_capped_mic_handling`
A [character](https://rdrr.io/r/base/character.html) to use in
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md), to indicate
how capped MIC values (`<`, `<=`, `>`, `>=`) should be interpreted.
Must be one of `"standard"`, `"strict"`, `"relaxed"`, or `"inverse"` -
the default is `"standard"`.
- `AMR_cleaning_regex`
A [regular expression](https://rdrr.io/r/base/regex.html)
(case-insensitive) to use in
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) and all
[`mo_*`](https://amr-for-r.org/reference/mo_property.md) functions, to
clean the user input. The default is the outcome of
[`mo_cleaning_regex()`](https://amr-for-r.org/reference/as.mo.md),
which removes texts between brackets and texts such as "species" and
"serovar".
- `AMR_custom_ab`
A file location to an RDS file, to use custom antimicrobial drugs with
this package. This is explained in
[`add_custom_antimicrobials()`](https://amr-for-r.org/reference/add_custom_antimicrobials.md).
- `AMR_custom_mo`
A file location to an RDS file, to use custom microorganisms with this
package. This is explained in
[`add_custom_microorganisms()`](https://amr-for-r.org/reference/add_custom_microorganisms.md).
- `AMR_eucastrules`
A [character](https://rdrr.io/r/base/character.html) to set the
default types of rules for
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
function, must be one or more of: `"breakpoints"`, `"expert"`,
`"other"`, `"custom"`, `"all"`, and defaults to
`c("breakpoints", "expert")`.
- `AMR_guideline`
A [character](https://rdrr.io/r/base/character.html) to set the
default guideline for interpreting MIC values and disk diffusion
diameters with
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md). Can be only
the guideline name (e.g., `"CLSI"`) or the name with a year (e.g.
`"CLSI 2019"`). The default to the latest implemented EUCAST
guideline, currently `"EUCAST 2025"`. Supported guideline are
currently EUCAST (2011-2025) and CLSI (2011-2025).
- `AMR_ignore_pattern`
A [regular expression](https://rdrr.io/r/base/regex.html) to ignore
(i.e., make `NA`) any match given in
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) and all
[`mo_*`](https://amr-for-r.org/reference/mo_property.md) functions.
- `AMR_include_PKPD`
A [logical](https://rdrr.io/r/base/logical.html) to use in
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md), to indicate
that PK/PD clinical breakpoints must be applied as a last resort - the
default is `TRUE`.
- `AMR_substitute_missing_r_breakpoint`
A [logical](https://rdrr.io/r/base/logical.html) to use in
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md), to indicate
that missing R breakpoints must be substituted with `"R"` - the
default is `FALSE`.
- `AMR_include_screening`
A [logical](https://rdrr.io/r/base/logical.html) to use in
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md), to indicate
that clinical breakpoints for screening are allowed - the default is
`FALSE`.
- `AMR_keep_synonyms`
A [logical](https://rdrr.io/r/base/logical.html) to use in
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) and all
[`mo_*`](https://amr-for-r.org/reference/mo_property.md) functions, to
indicate if old, previously valid taxonomic names must be preserved
and not be corrected to currently accepted names. The default is
`FALSE`.
- `AMR_locale`
A [character](https://rdrr.io/r/base/character.html) to set the
language for the `AMR` package, can be one of these supported language
names or [ISO 639-1 codes](https://en.wikipedia.org/wiki/ISO_639-1):
English (en), Arabic (ar), Bengali (bn), Chinese (zh), Czech (cs),
Danish (da), Dutch (nl), Finnish (fi), French (fr), German (de), Greek
(el), Hindi (hi), Indonesian (id), Italian (it), Japanese (ja), Korean
(ko), Norwegian (no), Polish (pl), Portuguese (pt), Romanian (ro),
Russian (ru), Spanish (es), Swahili (sw), Swedish (sv), Turkish (tr),
Ukrainian (uk), Urdu (ur), or Vietnamese (vi). The default is the
current system language (if supported, English otherwise).
- `AMR_mo_source`
A file location for a manual code list to be used in
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md) and all
[`mo_*`](https://amr-for-r.org/reference/mo_property.md) functions.
This is explained in
[`set_mo_source()`](https://amr-for-r.org/reference/mo_source.md).
## Saving Settings Between Sessions
Settings in R are not saved globally and are thus lost when R is exited.
You can save your options to your own `.Rprofile` file, which is a
user-specific file. You can edit it using:
utils::file.edit("~/.Rprofile")
In this file, you can set options such as...
options(AMR_locale = "pt")
options(AMR_include_PKPD = TRUE)
...to add Portuguese language support of antimicrobials, and allow PK/PD
rules when interpreting MIC values with
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md).
### Share Options Within Team
For a more global approach, e.g. within a (data) team, save an options
file to a remote file location, such as a shared network drive, and have
each user read in this file automatically at start-up. This would work
in this way:
1. Save a plain text file to e.g. "X:/team_folder/R_options.R" and fill
it with preferred settings.
2. For each user, open the `.Rprofile` file using
`utils::file.edit("~/.Rprofile")` and put in there:
source("X:/team_folder/R_options.R")
3. Reload R/RStudio and check the settings with
[`getOption()`](https://rdrr.io/r/base/options.html), e.g.
`getOption("AMR_locale")` if you have set that value.
Now the team settings are configured in only one place, and can be
maintained there.

View File

@@ -21,7 +21,7 @@ The AMR package is available in English, Arabic, Bengali, Chinese, Czech, Danish
<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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">

184
reference/AMR.md Normal file
View File

@@ -0,0 +1,184 @@
# The `AMR` Package
Welcome to the `AMR` package.
The `AMR` package is a peer-reviewed, [free and
open-source](https://amr-for-r.org/#copyright) R package with [zero
dependencies](https://en.wikipedia.org/wiki/Dependency_hell) to simplify
the analysis and prediction of Antimicrobial Resistance (AMR) and to
work with microbial and antimicrobial data and properties, by using
evidence-based methods. **Our aim is to provide a standard** for clean
and reproducible AMR data analysis, that can therefore empower
epidemiological analyses to continuously enable surveillance and
treatment evaluation in any setting. We are a team of [many different
researchers](https://amr-for-r.org/authors.html) from around the globe
to make this a successful and durable project!
This work was published in the Journal of Statistical Software (Volume
104(3);
[doi:10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03) ) and
formed the basis of two PhD theses
([doi:10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131)
and
[doi:10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)
).
After installing this package, R knows [**~79 000 distinct microbial
species**](https://amr-for-r.org/reference/microorganisms.html) (updated
June 2024) and all [**~620 antimicrobial and antiviral
drugs**](https://amr-for-r.org/reference/antimicrobials.html) by name
and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED
CT), and knows all about valid SIR and MIC values. The integral clinical
breakpoint guidelines from CLSI 2011-2025 and EUCAST 2011-2025 are
included, even with epidemiological cut-off (ECOFF) values. It supports
and can read any data format, including WHONET data. This package works
on Windows, macOS and Linux with all versions of R since R-3.0 (April
2013). **It was designed to work in any setting, including those with
very limited resources**. It was created for both routine data analysis
and academic research at the Faculty of Medical Sciences of the
[University of Groningen](https://www.rug.nl) and the [University
Medical Center Groningen](https://www.umcg.nl).
The `AMR` package is available in English, Arabic, Bengali, Chinese,
Czech, Danish, Dutch, Finnish, French, German, Greek, Hindi, Indonesian,
Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Romanian,
Russian, Spanish, Swahili, Swedish, Turkish, Ukrainian, Urdu, and
Vietnamese. Antimicrobial drug (group) names and colloquial
microorganism names are provided in these languages.
## Source
To cite AMR in publications use:
Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C
(2022). "AMR: An R Package for Working with Antimicrobial Resistance
Data." *Journal of Statistical Software*, *104*(3), 1-31.
[doi:10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)
A BibTeX entry for LaTeX users is:
@Article{,
title = {{AMR}: An {R} Package for Working with Antimicrobial Resistance Data},
author = {Matthijs S. Berends and Christian F. Luz and Alexander W. Friedrich and Bhanu N. M. Sinha and Casper J. Albers and Corinna Glasner},
journal = {Journal of Statistical Software},
year = {2022},
volume = {104},
number = {3},
pages = {1--31},
doi = {10.18637/jss.v104.i03},
}
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
Useful links:
- <https://amr-for-r.org>
- <https://github.com/msberends/AMR>
- Report bugs at <https://github.com/msberends/AMR/issues>
## Author
**Maintainer**: Matthijs S. Berends <m.s.berends@umcg.nl>
([ORCID](https://orcid.org/0000-0001-7620-1800))
Authors:
- Dennis Souverein ([ORCID](https://orcid.org/0000-0003-0455-0336))
\[contributor\]
- Erwin E. A. Hassing \[contributor\]
Other contributors:
- Aislinn Cook ([ORCID](https://orcid.org/0000-0002-9189-7815))
\[contributor\]
- Andrew P. Norgan ([ORCID](https://orcid.org/0000-0002-2955-2066))
\[contributor\]
- Anita Williams ([ORCID](https://orcid.org/0000-0002-5295-8451))
\[contributor\]
- Annick Lenglet ([ORCID](https://orcid.org/0000-0003-2013-8405))
\[contributor\]
- Anthony Underwood ([ORCID](https://orcid.org/0000-0002-8547-4277))
\[contributor\]
- Anton Mymrikov \[contributor\]
- Bart C. Meijer \[contributor\]
- Christian F. Luz ([ORCID](https://orcid.org/0000-0001-5809-5995))
\[contributor\]
- Dmytro Mykhailenko \[contributor\]
- Eric H. L. C. M. Hazenberg \[contributor\]
- Gwen Knight ([ORCID](https://orcid.org/0000-0002-7263-9896))
\[contributor\]
- Jane Hawkey ([ORCID](https://orcid.org/0000-0001-9661-5293))
\[contributor\]
- Jason Stull ([ORCID](https://orcid.org/0000-0002-9028-8153))
\[contributor\]
- Javier Sanchez ([ORCID](https://orcid.org/0000-0003-2605-8094))
\[contributor\]
- Jonas Salm \[contributor\]
- Judith M. Fonville \[contributor\]
- Kathryn Holt ([ORCID](https://orcid.org/0000-0003-3949-2471))
\[contributor\]
- Larisse Bolton ([ORCID](https://orcid.org/0000-0001-7879-2173))
\[contributor\]
- Matthew Saab ([ORCID](https://orcid.org/0009-0008-6626-7919))
\[contributor\]
- Natacha Couto ([ORCID](https://orcid.org/0000-0002-9152-5464))
\[contributor\]
- Peter Dutey-Magni ([ORCID](https://orcid.org/0000-0002-8942-9836))
\[contributor\]
- Rogier P. Schade ([ORCID](https://orcid.org/0000-0002-9487-4467))
\[contributor\]
- Sofia Ny ([ORCID](https://orcid.org/0000-0002-2017-1363))
\[contributor\]
- Alex W. Friedrich ([ORCID](https://orcid.org/0000-0003-4881-038X))
\[thesis advisor\]
- Bhanu N. M. Sinha ([ORCID](https://orcid.org/0000-0003-1634-0010))
\[thesis advisor\]
- Casper J. Albers ([ORCID](https://orcid.org/0000-0002-9213-6743))
\[thesis advisor\]
- Corinna Glasner ([ORCID](https://orcid.org/0000-0003-1241-1328))
\[thesis advisor\]

View File

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

45
reference/WHOCC.md Normal file
View File

@@ -0,0 +1,45 @@
# WHOCC: WHO Collaborating Centre for Drug Statistics Methodology
All antimicrobial drugs and their official names, ATC codes, ATC groups
and defined daily dose (DDD) are included in this package, using the WHO
Collaborating Centre for Drug Statistics Methodology.
## WHOCC
This package contains **all ~550 antibiotic, antimycotic and antiviral
drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC
groups and Defined Daily Dose (DDD) from the World Health Organization
Collaborating Centre for Drug Statistics Methodology (WHOCC,
<https://atcddd.fhi.no>) and the Pharmaceuticals Community Register of
the European Commission
(<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>).
These have become the gold standard for international drug utilisation
monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health
and funded by the Norwegian government. The European Commission is the
executive of the European Union and promotes its general interest.
**NOTE: The WHOCC copyright does not allow use for commercial purposes,
unlike any other info from this package.** See
<https://atcddd.fhi.no/copyright_disclaimer/.>
## Examples
``` r
as.ab("meropenem")
#> Class 'ab'
#> [1] MEM
ab_name("J01DH02")
#> [1] "Meropenem"
ab_tradenames("flucloxacillin")
#> [1] "bactopen" "cloxacap" "cloxacillinhydrate"
#> [4] "cloxypen" "floxacillin" "floxacillinanhydrous"
#> [7] "floxapen" "floxapensalt" "fluclomix"
#> [10] "flucloxacilina" "flucloxacilline" "flucloxacillinum"
#> [13] "flucloxin" "fluorochloroxacillin" "galfloxin"
#> [16] "latocillin" "orbeninhydrate" "rimaflox"
#> [19] "staphobristol" "zoxin"
```

View File

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

151
reference/WHONET.md Normal file
View File

@@ -0,0 +1,151 @@
# Data Set with 500 Isolates - WHONET Example
This example data set has the exact same structure as an export file
from WHONET. Such files can be used with this package, as this example
data set shows. The antimicrobial results are from our
[example_isolates](https://amr-for-r.org/reference/example_isolates.md)
data set. All patient names were created using online surname generators
and are only in place for practice purposes.
## Usage
``` r
WHONET
```
## Format
A [tibble](https://tibble.tidyverse.org/reference/tibble.html) with 500
observations and 53 variables:
- `Identification number`
ID of the sample
- `Specimen number`
ID of the specimen
- `Organism`
Name of the microorganism. Before analysis, you should transform this
to a valid microbial class, using
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md).
- `Country`
Country of origin
- `Laboratory`
Name of laboratory
- `Last name`
Fictitious last name of patient
- `First name`
Fictitious initial of patient
- `Sex`
Fictitious gender of patient
- `Age`
Fictitious age of patient
- `Age category`
Age group, can also be looked up using
[`age_groups()`](https://amr-for-r.org/reference/age_groups.md)
- `Date of admission`
[Date](https://rdrr.io/r/base/Dates.html) of hospital admission
- `Specimen date`
[Date](https://rdrr.io/r/base/Dates.html) when specimen was received
at laboratory
- `Specimen type`
Specimen type or group
- `Specimen type (Numeric)`
Translation of `"Specimen type"`
- `Reason`
Reason of request with Differential Diagnosis
- `Isolate number`
ID of isolate
- `Organism type`
Type of microorganism, can also be looked up using
[`mo_type()`](https://amr-for-r.org/reference/mo_property.md)
- `Serotype`
Serotype of microorganism
- `Beta-lactamase`
Microorganism produces beta-lactamase?
- `ESBL`
Microorganism produces extended spectrum beta-lactamase?
- `Carbapenemase`
Microorganism produces carbapenemase?
- `MRSA screening test`
Microorganism is possible MRSA?
- `Inducible clindamycin resistance`
Clindamycin can be induced?
- `Comment`
Other comments
- `Date of data entry`
[Date](https://rdrr.io/r/base/Dates.html) this data was entered in
WHONET
- `AMP_ND10:CIP_EE`
28 different antimicrobials. You can lookup the abbreviations in the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set, or use e.g.
[`ab_name("AMP")`](https://amr-for-r.org/reference/ab_property.md) to
get the official name immediately. Before analysis, you should
transform this to a valid antimicrobial class, using
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md).
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## Examples
``` r
WHONET
#> # A tibble: 500 × 53
#> `Identification number` `Specimen number` Organism Country Laboratory
#> <chr> <int> <chr> <chr> <chr>
#> 1 fe41d7bafa 1748 SPN Belgium National …
#> 2 91f175ec37 1767 eco The Netherlands National …
#> 3 cc4015056e 1343 eco The Netherlands National …
#> 4 e864b692f5 1894 MAP Denmark National …
#> 5 3d051fe345 1739 PVU Belgium National …
#> 6 c80762a08d 1846 103 The Netherlands National …
#> 7 8022d3727c 1628 103 Denmark National …
#> 8 f3dc5f553d 1493 eco The Netherlands National …
#> 9 15add38f6c 1847 eco France National …
#> 10 fd41248def 1458 eco Germany National …
#> # 490 more rows
#> # 48 more variables: `Last name` <chr>, `First name` <chr>, Sex <chr>,
#> # Age <dbl>, `Age category` <chr>, `Date of admission` <date>,
#> # `Specimen date` <date>, `Specimen type` <chr>,
#> # `Specimen type (Numeric)` <dbl>, Reason <chr>, `Isolate number` <int>,
#> # `Organism type` <chr>, Serotype <chr>, `Beta-lactamase` <lgl>, ESBL <lgl>,
#> # Carbapenemase <lgl>, `MRSA screening test` <lgl>, …
```

View File

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

192
reference/ab_from_text.md Normal file
View File

@@ -0,0 +1,192 @@
# Retrieve Antimicrobial Drug Names and Doses from Clinical Text
Use this function on e.g. clinical texts from health care records. It
returns a [list](https://rdrr.io/r/base/list.html) with all
antimicrobial drugs, doses and forms of administration found in the
texts.
## Usage
``` r
ab_from_text(text, type = c("drug", "dose", "administration"),
collapse = NULL, translate_ab = FALSE, thorough_search = NULL,
info = interactive(), ...)
```
## Arguments
- text:
Text to analyse.
- type:
Type of property to search for, either `"drug"`, `"dose"` or
`"administration"`, see *Examples*.
- collapse:
A [character](https://rdrr.io/r/base/character.html) to pass on to
`paste(, collapse = ...)` to only return one
[character](https://rdrr.io/r/base/character.html) per element of
`text`, see *Examples*.
- translate_ab:
If `type = "drug"`: a column name of the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set to translate the antibiotic abbreviations to, using
[`ab_property()`](https://amr-for-r.org/reference/ab_property.md). The
default is `FALSE`. Using `TRUE` is equal to using "name".
- thorough_search:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the input must be extensively searched for misspelling and other
faulty input values. Setting this to `TRUE` will take considerably
more time than when using `FALSE`. At default, it will turn `TRUE`
when all input elements contain a maximum of three words.
- info:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
progress bar should be printed - the default is `TRUE` only in
interactive mode.
- ...:
Arguments passed on to
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md).
## Value
A [list](https://rdrr.io/r/base/list.html), or a
[character](https://rdrr.io/r/base/character.html) if `collapse` is not
`NULL`
## Details
This function is also internally used by
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md), although it then
only searches for the first drug name and will throw a note if more drug
names could have been returned. Note: the
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md) function may use
very long regular expression to match brand names of antimicrobial
drugs. This may fail on some systems.
### Argument `type`
At default, the function will search for antimicrobial drug names. All
text elements will be searched for official names, ATC codes and brand
names. As it uses [`as.ab()`](https://amr-for-r.org/reference/as.ab.md)
internally, it will correct for misspelling.
With `type = "dose"` (or similar, like "dosing", "doses"), all text
elements will be searched for
[numeric](https://rdrr.io/r/base/numeric.html) values that are higher
than 100 and do not resemble years. The output will be
[numeric](https://rdrr.io/r/base/numeric.html). It supports any unit (g,
mg, IE, etc.) and multiple values in one clinical text, see *Examples*.
With `type = "administration"` (or abbreviations, like "admin", "adm"),
all text elements will be searched for a form of drug administration. It
supports the following forms (including common abbreviations): buccal,
implant, inhalation, instillation, intravenous, nasal, oral, parenteral,
rectal, sublingual, transdermal and vaginal. Abbreviations for oral
(such as 'po', 'per os') will become "oral", all values for intravenous
(such as 'iv', 'intraven') will become "iv". It supports multiple values
in one clinical text, see *Examples*.
### Argument `collapse`
Without using `collapse`, this function will return a
[list](https://rdrr.io/r/base/list.html). This can be convenient to use
e.g. inside a
[`mutate()`](https://dplyr.tidyverse.org/reference/mutate.html)):
`df %>% mutate(abx = ab_from_text(clinical_text))`
The returned AB codes can be transformed to official names, groups, etc.
with all [`ab_*`](https://amr-for-r.org/reference/ab_property.md)
functions such as
[`ab_name()`](https://amr-for-r.org/reference/ab_property.md) and
[`ab_group()`](https://amr-for-r.org/reference/ab_property.md), or by
using the `translate_ab` argument.
With using `collapse`, this function will return a
[character](https://rdrr.io/r/base/character.html):
`df %>% mutate(abx = ab_from_text(clinical_text, collapse = "|"))`
## Examples
``` r
# mind the bad spelling of amoxicillin in this line,
# straight from a true health care record:
ab_from_text("28/03/2020 regular amoxicilliin 500mg po tid")
#> [[1]]
#> Class 'ab'
#> [1] AMX
#>
ab_from_text("500 mg amoxi po and 400mg cipro iv")
#> [[1]]
#> Class 'ab'
#> [1] AMX CIP
#>
ab_from_text("500 mg amoxi po and 400mg cipro iv", type = "dose")
#> [[1]]
#> [1] 500 400
#>
ab_from_text("500 mg amoxi po and 400mg cipro iv", type = "admin")
#> [[1]]
#> [1] "oral" "iv"
#>
ab_from_text("500 mg amoxi po and 400mg cipro iv", collapse = ", ")
#> [1] "AMX, CIP"
# \donttest{
# if you want to know which antibiotic groups were administered, do e.g.:
abx <- ab_from_text("500 mg amoxi po and 400mg cipro iv")
ab_group(abx[[1]])
#> [1] "Beta-lactams/penicillins" "Fluoroquinolones"
if (require("dplyr")) {
tibble(clinical_text = c(
"given 400mg cipro and 500 mg amox",
"started on doxy iv today"
)) %>%
mutate(
abx_codes = ab_from_text(clinical_text),
abx_doses = ab_from_text(clinical_text, type = "doses"),
abx_admin = ab_from_text(clinical_text, type = "admin"),
abx_coll = ab_from_text(clinical_text, collapse = "|"),
abx_coll_names = ab_from_text(clinical_text,
collapse = "|",
translate_ab = "name"
),
abx_coll_doses = ab_from_text(clinical_text,
type = "doses",
collapse = "|"
),
abx_coll_admin = ab_from_text(clinical_text,
type = "admin",
collapse = "|"
)
)
}
#> Loading required package: dplyr
#>
#> Attaching package: dplyr
#> The following objects are masked from package:stats:
#>
#> filter, lag
#> The following objects are masked from package:base:
#>
#> intersect, setdiff, setequal, union
#> # A tibble: 2 × 8
#> clinical_text abx_codes abx_doses abx_admin abx_coll abx_coll_names
#> <chr> <list> <list> <list> <chr> <chr>
#> 1 given 400mg cipro and 5… <ab [2]> <dbl [2]> <chr [1]> CIP|AMX Ciprofloxacin…
#> 2 started on doxy iv today <ab [1]> <dbl [1]> <chr [1]> DOX Doxycycline
#> # 2 more variables: abx_coll_doses <chr>, abx_coll_admin <chr>
# }
```

View File

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

436
reference/ab_property.md Normal file
View File

@@ -0,0 +1,436 @@
# Get Properties of an Antibiotic
Use these functions to return a specific property of an antibiotic from
the [antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set. All input values will be evaluated internally with
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md).
## Usage
``` r
ab_name(x, language = get_AMR_locale(), tolower = FALSE, ...)
ab_cid(x, ...)
ab_synonyms(x, ...)
ab_tradenames(x, ...)
ab_group(x, language = get_AMR_locale(), ...)
ab_atc(x, only_first = FALSE, ...)
ab_atc_group1(x, language = get_AMR_locale(), ...)
ab_atc_group2(x, language = get_AMR_locale(), ...)
ab_loinc(x, ...)
ab_ddd(x, administration = "oral", ...)
ab_ddd_units(x, administration = "oral", ...)
ab_info(x, language = get_AMR_locale(), ...)
ab_url(x, open = FALSE, ...)
ab_property(x, property = "name", language = get_AMR_locale(), ...)
set_ab_names(data, ..., property = "name", language = get_AMR_locale(),
snake_case = NULL)
```
## Arguments
- x:
Any (vector of) text that can be coerced to a valid antibiotic drug
code with [`as.ab()`](https://amr-for-r.org/reference/as.ab.md).
- language:
Language of the returned text - the default is the current system
language (see
[`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md))
and can also be set with the package option
[`AMR_locale`](https://amr-for-r.org/reference/AMR-options.md). Use
`language = NULL` or `language = ""` to prevent translation.
- tolower:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the first [character](https://rdrr.io/r/base/character.html) of every
output should be transformed to a lower case
[character](https://rdrr.io/r/base/character.html). This will lead to
e.g. "polymyxin B" and not "polymyxin b".
- ...:
In case of `set_ab_names()` and `data` is a
[data.frame](https://rdrr.io/r/base/data.frame.html): columns to
select (supports tidy selection such as `column1:column4`), otherwise
other arguments passed on to
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md).
- only_first:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
only the first ATC code must be returned, with giving preference to
J0-codes (i.e., the antimicrobial drug group).
- administration:
Way of administration, either `"oral"` or `"iv"`.
- open:
Browse the URL using
[`utils::browseURL()`](https://rdrr.io/r/utils/browseURL.html).
- property:
One of the column names of one of the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set: `vector_or(colnames(antimicrobials), sort = FALSE)`.
- data:
A [data.frame](https://rdrr.io/r/base/data.frame.html) of which the
columns need to be renamed, or a
[character](https://rdrr.io/r/base/character.html) vector of column
names.
- snake_case:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the names should be in so-called [snake
case](https://en.wikipedia.org/wiki/Snake_case): in lower case and all
spaces/slashes replaced with an underscore (`_`).
## Value
- An [integer](https://rdrr.io/r/base/integer.html) in case of
`ab_cid()`
- A named [list](https://rdrr.io/r/base/list.html) in case of
`ab_info()` and multiple `ab_atc()`/`ab_synonyms()`/`ab_tradenames()`
- A [double](https://rdrr.io/r/base/double.html) in case of `ab_ddd()`
- A [data.frame](https://rdrr.io/r/base/data.frame.html) in case of
`set_ab_names()`
- A [character](https://rdrr.io/r/base/character.html) in all other
cases
## Details
All output [will be
translated](https://amr-for-r.org/reference/translate.md) where
possible.
The function `ab_url()` will return the direct URL to the official WHO
website. A warning will be returned if the required ATC code is not
available.
The function `set_ab_names()` is a special column renaming function for
[data.frame](https://rdrr.io/r/base/data.frame.html)s. It renames
columns names that resemble antimicrobial drugs. It always makes sure
that the new column names are unique. If `property = "atc"` is set,
preference is given to ATC codes from the J-group.
## Source
World Health Organization (WHO) Collaborating Centre for Drug Statistics
Methodology: <https://atcddd.fhi.no/atc_ddd_index/>
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER:
<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
## Examples
``` r
# all properties:
ab_name("AMX")
#> [1] "Amoxicillin"
ab_atc("AMX")
#> [1] "J01CA04" "QG51AA03" "QJ01CA04"
ab_cid("AMX")
#> [1] 33613
ab_synonyms("AMX")
#> [1] "acuotricina" "alfamox" "alfida" "amitron"
#> [5] "amoclen" "amodex" "amoksicillin" "amolin"
#> [9] "amopen" "amopenixin" "amophar" "amoran"
#> [13] "amoxi" "amoxicaps" "amoxicilina" "amoxicilline"
#> [17] "amoxicillinum" "amoxidal" "amoxiden" "amoxil"
#> [21] "amoxillat" "amoxina" "amoxine" "amoxipen"
#> [25] "amoxivet" "amoxycillin" "amoxycillinsalt" "amoxyke"
#> [29] "anemolin" "aspenil" "atoksilin" "bristamox"
#> [33] "cemoxin" "ciblor" "clamoxyl" "damoxy"
#> [37] "danoxillin" "delacillin" "demoksil" "dispermox"
#> [41] "efpenix" "eupen" "flemoxin" "flemoxine"
#> [45] "galenamox" "gramidil" "hiconcil" "himinomax"
#> [49] "histocillin" "ibiamox" "imacillin" "izoltil"
#> [53] "kentrocyllin" "lamoxy" "largopen" "larotid"
#> [57] "matasedrin" "metifarma" "moksilin" "moxacin"
#> [61] "moxal" "moxaline" "moxatag" "neotetranase"
#> [65] "novabritine" "ospamox" "pacetocin" "pamocil"
#> [69] "paradroxil" "pasetocin" "penamox" "piramox"
#> [73] "promoxil" "quimiopen" "remoxil" "riotapen"
#> [77] "robamox" "sawacillin" "siganopen" "simplamox"
#> [81] "sintopen" "sumox" "topramoxin" "trifamox"
#> [85] "trimox" "unicillin" "utimox" "velamox"
#> [89] "vetramox" "wymox" "zamocillin" "zamocilline"
#> [93] "zimox"
ab_tradenames("AMX")
#> [1] "acuotricina" "alfamox" "alfida" "amitron"
#> [5] "amoclen" "amodex" "amoksicillin" "amolin"
#> [9] "amopen" "amopenixin" "amophar" "amoran"
#> [13] "amoxi" "amoxicaps" "amoxicilina" "amoxicilline"
#> [17] "amoxicillinum" "amoxidal" "amoxiden" "amoxil"
#> [21] "amoxillat" "amoxina" "amoxine" "amoxipen"
#> [25] "amoxivet" "amoxycillin" "amoxycillinsalt" "amoxyke"
#> [29] "anemolin" "aspenil" "atoksilin" "bristamox"
#> [33] "cemoxin" "ciblor" "clamoxyl" "damoxy"
#> [37] "danoxillin" "delacillin" "demoksil" "dispermox"
#> [41] "efpenix" "eupen" "flemoxin" "flemoxine"
#> [45] "galenamox" "gramidil" "hiconcil" "himinomax"
#> [49] "histocillin" "ibiamox" "imacillin" "izoltil"
#> [53] "kentrocyllin" "lamoxy" "largopen" "larotid"
#> [57] "matasedrin" "metifarma" "moksilin" "moxacin"
#> [61] "moxal" "moxaline" "moxatag" "neotetranase"
#> [65] "novabritine" "ospamox" "pacetocin" "pamocil"
#> [69] "paradroxil" "pasetocin" "penamox" "piramox"
#> [73] "promoxil" "quimiopen" "remoxil" "riotapen"
#> [77] "robamox" "sawacillin" "siganopen" "simplamox"
#> [81] "sintopen" "sumox" "topramoxin" "trifamox"
#> [85] "trimox" "unicillin" "utimox" "velamox"
#> [89] "vetramox" "wymox" "zamocillin" "zamocilline"
#> [93] "zimox"
ab_group("AMX")
#> [1] "Beta-lactams/penicillins"
ab_atc_group1("AMX")
#> [1] "Beta-lactam antibacterials, penicillins"
ab_atc_group2("AMX")
#> [1] "Penicillins with extended spectrum"
ab_url("AMX")
#> Amoxicillin
#> "https://atcddd.fhi.no/atc_ddd_index//?code=J01CA04&showdescription=no"
# smart lowercase transformation
ab_name(x = c("AMC", "PLB"))
#> [1] "Amoxicillin/clavulanic acid" "Polymyxin B"
ab_name(x = c("AMC", "PLB"), tolower = TRUE)
#> [1] "amoxicillin/clavulanic acid" "polymyxin B"
# defined daily doses (DDD)
ab_ddd("AMX", "oral")
#> [1] 1.5
ab_ddd_units("AMX", "oral")
#> [1] "g"
ab_ddd("AMX", "iv")
#> [1] 3
ab_ddd_units("AMX", "iv")
#> [1] "g"
ab_info("AMX") # all properties as a list
#> $ab
#> [1] "AMX"
#>
#> $cid
#> [1] 33613
#>
#> $name
#> [1] "Amoxicillin"
#>
#> $group
#> [1] "Beta-lactams/penicillins"
#>
#> $atc
#> [1] "J01CA04" "QG51AA03" "QJ01CA04"
#>
#> $atc_group1
#> [1] "Beta-lactam antibacterials, penicillins"
#>
#> $atc_group2
#> [1] "Penicillins with extended spectrum"
#>
#> $tradenames
#> [1] "acuotricina" "alfamox" "alfida" "amitron"
#> [5] "amoclen" "amodex" "amoksicillin" "amolin"
#> [9] "amopen" "amopenixin" "amophar" "amoran"
#> [13] "amoxi" "amoxicaps" "amoxicilina" "amoxicilline"
#> [17] "amoxicillinum" "amoxidal" "amoxiden" "amoxil"
#> [21] "amoxillat" "amoxina" "amoxine" "amoxipen"
#> [25] "amoxivet" "amoxycillin" "amoxycillinsalt" "amoxyke"
#> [29] "anemolin" "aspenil" "atoksilin" "bristamox"
#> [33] "cemoxin" "ciblor" "clamoxyl" "damoxy"
#> [37] "danoxillin" "delacillin" "demoksil" "dispermox"
#> [41] "efpenix" "eupen" "flemoxin" "flemoxine"
#> [45] "galenamox" "gramidil" "hiconcil" "himinomax"
#> [49] "histocillin" "ibiamox" "imacillin" "izoltil"
#> [53] "kentrocyllin" "lamoxy" "largopen" "larotid"
#> [57] "matasedrin" "metifarma" "moksilin" "moxacin"
#> [61] "moxal" "moxaline" "moxatag" "neotetranase"
#> [65] "novabritine" "ospamox" "pacetocin" "pamocil"
#> [69] "paradroxil" "pasetocin" "penamox" "piramox"
#> [73] "promoxil" "quimiopen" "remoxil" "riotapen"
#> [77] "robamox" "sawacillin" "siganopen" "simplamox"
#> [81] "sintopen" "sumox" "topramoxin" "trifamox"
#> [85] "trimox" "unicillin" "utimox" "velamox"
#> [89] "vetramox" "wymox" "zamocillin" "zamocilline"
#> [93] "zimox"
#>
#> $loinc
#> [1] "101498-4" "15-8" "16-6" "16365-9" "17-4" "18-2"
#> [7] "18861-5" "18862-3" "19-0" "20-8" "21-6" "22-4"
#> [13] "25274-2" "25310-4" "3344-9" "55614-2" "55615-9" "55616-7"
#> [19] "6976-5" "6977-3" "80133-2"
#>
#> $ddd
#> $ddd$oral
#> $ddd$oral$amount
#> [1] 1.5
#>
#> $ddd$oral$units
#> [1] "g"
#>
#>
#> $ddd$iv
#> $ddd$iv$amount
#> [1] 3
#>
#> $ddd$iv$units
#> [1] "g"
#>
#>
#>
# all ab_* functions use as.ab() internally, so you can go from 'any' to 'any':
ab_atc("AMP")
#> [1] "J01CA01" "QJ01CA01" "QJ51CA01" "QS01AA19" "S01AA19"
ab_group("J01CA01")
#> [1] "Beta-lactams/penicillins"
ab_loinc("ampicillin")
#> [1] "101477-8" "101478-6" "18864-9" "18865-6" "20374-5" "21066-6"
#> [7] "23618-2" "27-3" "28-1" "29-9" "30-7" "31-5"
#> [13] "32-3" "33-1" "3355-5" "33562-0" "33919-2" "34-9"
#> [19] "43883-8" "43884-6" "6979-9" "6980-7" "87604-5"
ab_name("21066-6")
#> [1] "Ampicillin"
ab_name(6249)
#> [1] "Ampicillin"
ab_name("J01CA01")
#> [1] "Ampicillin"
# spelling from different languages and dyslexia are no problem
ab_atc("ceftriaxon")
#> [1] "J01DD04" "QJ01DD04"
ab_atc("cephtriaxone")
#> [1] "J01DD04" "QJ01DD04"
ab_atc("cephthriaxone")
#> [1] "J01DD04" "QJ01DD04"
ab_atc("seephthriaaksone")
#> [1] "J01DD04" "QJ01DD04"
# use set_ab_names() for renaming columns
colnames(example_isolates)
#> [1] "date" "patient" "age" "gender" "ward" "mo" "PEN"
#> [8] "OXA" "FLC" "AMX" "AMC" "AMP" "TZP" "CZO"
#> [15] "FEP" "CXM" "FOX" "CTX" "CAZ" "CRO" "GEN"
#> [22] "TOB" "AMK" "KAN" "TMP" "SXT" "NIT" "FOS"
#> [29] "LNZ" "CIP" "MFX" "VAN" "TEC" "TCY" "TGC"
#> [36] "DOX" "ERY" "CLI" "AZM" "IPM" "MEM" "MTR"
#> [43] "CHL" "COL" "MUP" "RIF"
colnames(set_ab_names(example_isolates))
#> [1] "date" "patient"
#> [3] "age" "gender"
#> [5] "ward" "mo"
#> [7] "benzylpenicillin" "oxacillin"
#> [9] "flucloxacillin" "amoxicillin"
#> [11] "amoxicillin_clavulanic_acid" "ampicillin"
#> [13] "piperacillin_tazobactam" "cefazolin"
#> [15] "cefepime" "cefuroxime"
#> [17] "cefoxitin" "cefotaxime"
#> [19] "ceftazidime" "ceftriaxone"
#> [21] "gentamicin" "tobramycin"
#> [23] "amikacin" "kanamycin"
#> [25] "trimethoprim" "trimethoprim_sulfamethoxazole"
#> [27] "nitrofurantoin" "fosfomycin"
#> [29] "linezolid" "ciprofloxacin"
#> [31] "moxifloxacin" "vancomycin"
#> [33] "teicoplanin" "tetracycline"
#> [35] "tigecycline" "doxycycline"
#> [37] "erythromycin" "clindamycin"
#> [39] "azithromycin" "imipenem"
#> [41] "meropenem" "metronidazole"
#> [43] "chloramphenicol" "colistin"
#> [45] "mupirocin" "rifampicin"
colnames(set_ab_names(example_isolates, NIT:VAN))
#> [1] "date" "patient" "age" "gender"
#> [5] "ward" "mo" "PEN" "OXA"
#> [9] "FLC" "AMX" "AMC" "AMP"
#> [13] "TZP" "CZO" "FEP" "CXM"
#> [17] "FOX" "CTX" "CAZ" "CRO"
#> [21] "GEN" "TOB" "AMK" "KAN"
#> [25] "TMP" "SXT" "nitrofurantoin" "fosfomycin"
#> [29] "linezolid" "ciprofloxacin" "moxifloxacin" "vancomycin"
#> [33] "TEC" "TCY" "TGC" "DOX"
#> [37] "ERY" "CLI" "AZM" "IPM"
#> [41] "MEM" "MTR" "CHL" "COL"
#> [45] "MUP" "RIF"
# \donttest{
if (require("dplyr")) {
example_isolates %>%
set_ab_names()
# this does the same:
example_isolates %>%
rename_with(set_ab_names)
# set_ab_names() works with any AB property:
example_isolates %>%
set_ab_names(property = "atc")
example_isolates %>%
set_ab_names(where(is.sir)) %>%
colnames()
example_isolates %>%
set_ab_names(NIT:VAN) %>%
colnames()
}
#> [1] "date" "patient" "age" "gender"
#> [5] "ward" "mo" "PEN" "OXA"
#> [9] "FLC" "AMX" "AMC" "AMP"
#> [13] "TZP" "CZO" "FEP" "CXM"
#> [17] "FOX" "CTX" "CAZ" "CRO"
#> [21] "GEN" "TOB" "AMK" "KAN"
#> [25] "TMP" "SXT" "nitrofurantoin" "fosfomycin"
#> [29] "linezolid" "ciprofloxacin" "moxifloxacin" "vancomycin"
#> [33] "TEC" "TCY" "TGC" "DOX"
#> [37] "ERY" "CLI" "AZM" "IPM"
#> [41] "MEM" "MTR" "CHL" "COL"
#> [45] "MUP" "RIF"
# }
```

View File

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

@@ -0,0 +1,193 @@
# Add Custom Antimicrobials
With `add_custom_antimicrobials()` you can add your own custom
antimicrobial drug names and codes.
## Usage
``` r
add_custom_antimicrobials(x)
clear_custom_antimicrobials()
```
## Arguments
- x:
A [data.frame](https://rdrr.io/r/base/data.frame.html) resembling the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set, at least containing columns "ab" and "name".
## Details
**Important:** Due to how R works, the `add_custom_antimicrobials()`
function has to be run in every R session - added antimicrobials are not
stored between sessions and are thus lost when R is exited.
There are two ways to circumvent this and automate the process of adding
antimicrobials:
**Method 1:** Using the package option
[`AMR_custom_ab`](https://amr-for-r.org/reference/AMR-options.md), which
is the preferred method. To use this method:
1. Create a data set in the structure of the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set (containing at the very least columns "ab" and "name") and
save it with [`saveRDS()`](https://rdrr.io/r/base/readRDS.html) to a
location of choice, e.g. `"~/my_custom_ab.rds"`, or any remote
location.
2. Set the file location to the package option
[`AMR_custom_ab`](https://amr-for-r.org/reference/AMR-options.md):
`options(AMR_custom_ab = "~/my_custom_ab.rds")`. This can even be a
remote file location, such as an https URL. Since options are not
saved between R sessions, it is best to save this option to the
`.Rprofile` file so that it will be loaded on start-up of R. To do
this, open the `.Rprofile` file using e.g.
`utils::file.edit("~/.Rprofile")`, add this text and save the file:
# Add custom antimicrobial codes:
options(AMR_custom_ab = "~/my_custom_ab.rds")
Upon package load, this file will be loaded and run through the
`add_custom_antimicrobials()` function.
**Method 2:** Loading the antimicrobial additions directly from your
`.Rprofile` file. Note that the definitions will be stored in a
user-specific R file, which is a suboptimal workflow. To use this
method:
1. Edit the `.Rprofile` file using e.g.
`utils::file.edit("~/.Rprofile")`.
2. Add a text like below and save the file:
# Add custom antibiotic drug codes:
AMR::add_custom_antimicrobials(
data.frame(ab = "TESTAB",
name = "Test Antibiotic",
group = "Test Group")
)
Use `clear_custom_antimicrobials()` to clear the previously added
antimicrobials.
## See also
[`add_custom_microorganisms()`](https://amr-for-r.org/reference/add_custom_microorganisms.md)
to add custom microorganisms.
## Examples
``` r
# \donttest{
# returns a wildly guessed result:
as.ab("testab")
#> Class 'ab'
#> [1] THA
# now add a custom entry - it will be considered by as.ab() and
# all ab_*() functions
add_custom_antimicrobials(
data.frame(
ab = "TESTAB",
name = "Test Antibiotic",
# you can add any property present in the
# 'antimicrobials' data set, such as 'group':
group = "Test Group"
)
)
#> Added one record to the internal `antimicrobials` data set.
# "testab" is now a new antibiotic:
as.ab("testab")
#> Class 'ab'
#> [1] TESTAB
ab_name("testab")
#> [1] "Test Antibiotic"
ab_group("testab")
#> [1] "Test Group"
ab_info("testab")
#> $ab
#> [1] "TESTAB"
#>
#> $cid
#> [1] NA
#>
#> $name
#> [1] "Test Antibiotic"
#>
#> $group
#> [1] "Test Group"
#>
#> $atc
#> [1] NA
#>
#> $atc_group1
#> [1] NA
#>
#> $atc_group2
#> [1] NA
#>
#> $tradenames
#> [1] NA
#>
#> $loinc
#> [1] NA
#>
#> $ddd
#> $ddd$oral
#> $ddd$oral$amount
#> [1] NA
#>
#> $ddd$oral$units
#> [1] NA
#>
#>
#> $ddd$iv
#> $ddd$iv$amount
#> [1] NA
#>
#> $ddd$iv$units
#> [1] NA
#>
#>
#>
# Add Co-fluampicil, which is one of the many J01CR50 codes, see
# https://atcddd.fhi.no/ddd/list_of_ddds_combined_products/
add_custom_antimicrobials(
data.frame(
ab = "COFLU",
name = "Co-fluampicil",
atc = "J01CR50",
group = "Beta-lactams/penicillins"
)
)
#> Added one record to the internal `antimicrobials` data set.
ab_atc("Co-fluampicil")
#> [1] "J01CR50"
ab_name("J01CR50")
#> [1] "Co-fluampicil"
# even antimicrobial selectors work
# see ?amr_selector
x <- data.frame(
random_column = "some value",
coflu = as.sir("S"),
ampicillin = as.sir("R")
)
x
#> random_column coflu ampicillin
#> 1 some value S R
x[, betalactams()]
#> For `betalactams()` using columns 'coflu' (co-fluampicil) and
#> 'ampicillin'
#> coflu ampicillin
#> 1 S R
# }
```

View File

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

@@ -0,0 +1,225 @@
# Add Custom Microorganisms
With `add_custom_microorganisms()` you can add your own custom
microorganisms, such the non-taxonomic outcome of laboratory analysis.
## Usage
``` r
add_custom_microorganisms(x)
clear_custom_microorganisms()
```
## Arguments
- x:
A [data.frame](https://rdrr.io/r/base/data.frame.html) resembling the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set, at least containing column "genus" (case-insensitive).
## Details
This function will fill in missing taxonomy for you, if specific
taxonomic columns are missing, see *Examples*.
**Important:** Due to how R works, the `add_custom_microorganisms()`
function has to be run in every R session - added microorganisms are not
stored between sessions and are thus lost when R is exited.
There are two ways to circumvent this and automate the process of adding
microorganisms:
**Method 1:** Using the package option
[`AMR_custom_mo`](https://amr-for-r.org/reference/AMR-options.md), which
is the preferred method. To use this method:
1. Create a data set in the structure of the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set (containing at the very least column "genus") and save it
with [`saveRDS()`](https://rdrr.io/r/base/readRDS.html) to a
location of choice, e.g. `"~/my_custom_mo.rds"`, or any remote
location.
2. Set the file location to the package option
[`AMR_custom_mo`](https://amr-for-r.org/reference/AMR-options.md):
`options(AMR_custom_mo = "~/my_custom_mo.rds")`. This can even be a
remote file location, such as an https URL. Since options are not
saved between R sessions, it is best to save this option to the
`.Rprofile` file so that it will be loaded on start-up of R. To do
this, open the `.Rprofile` file using e.g.
`utils::file.edit("~/.Rprofile")`, add this text and save the file:
# Add custom microorganism codes:
options(AMR_custom_mo = "~/my_custom_mo.rds")
Upon package load, this file will be loaded and run through the
`add_custom_microorganisms()` function.
**Method 2:** Loading the microorganism directly from your `.Rprofile`
file. Note that the definitions will be stored in a user-specific R
file, which is a suboptimal workflow. To use this method:
1. Edit the `.Rprofile` file using e.g.
`utils::file.edit("~/.Rprofile")`.
2. Add a text like below and save the file:
# Add custom antibiotic drug codes:
AMR::add_custom_microorganisms(
data.frame(genus = "Enterobacter",
species = "asburiae/cloacae")
)
Use `clear_custom_microorganisms()` to clear the previously added
microorganisms.
## See also
[`add_custom_antimicrobials()`](https://amr-for-r.org/reference/add_custom_antimicrobials.md)
to add custom antimicrobials.
## Examples
``` r
# \donttest{
# a combination of species is not formal taxonomy, so
# this will result in "Enterobacter cloacae cloacae",
# since it resembles the input best:
mo_name("Enterobacter asburiae/cloacae")
#> [1] "Enterobacter asburiae"
# now add a custom entry - it will be considered by as.mo() and
# all mo_*() functions
add_custom_microorganisms(
data.frame(
genus = "Enterobacter",
species = "asburiae/cloacae"
)
)
#> Added Enterobacter asburiae/cloacae to the internal `microorganisms` data
#> set.
# E. asburiae/cloacae is now a new microorganism:
mo_name("Enterobacter asburiae/cloacae")
#> [1] "Enterobacter asburiae/cloacae"
# its code:
as.mo("Enterobacter asburiae/cloacae")
#> Class 'mo'
#> [1] CUSTOM1_ENTRB_ASB/
# all internal algorithms will work as well:
mo_name("Ent asburia cloacae")
#> [1] "Enterobacter asburiae/cloacae"
# and even the taxonomy was added based on the genus!
mo_family("E. asburiae/cloacae")
#> [1] "Enterobacteriaceae"
mo_gramstain("Enterobacter asburiae/cloacae")
#> [1] "Gram-negative"
mo_info("Enterobacter asburiae/cloacae")
#> $mo
#> [1] "CUSTOM1_ENTRB_ASB/"
#>
#> $rank
#> [1] "species"
#>
#> $kingdom
#> [1] "Bacteria"
#>
#> $phylum
#> [1] "Pseudomonadota"
#>
#> $class
#> [1] "Gammaproteobacteria"
#>
#> $order
#> [1] "Enterobacterales"
#>
#> $family
#> [1] "Enterobacteriaceae"
#>
#> $genus
#> [1] "Enterobacter"
#>
#> $species
#> [1] "asburiae/cloacae"
#>
#> $subspecies
#> [1] ""
#>
#> $status
#> [1] "accepted"
#>
#> $synonyms
#> NULL
#>
#> $gramstain
#> [1] "Gram-negative"
#>
#> $oxygen_tolerance
#> [1] NA
#>
#> $url
#> [1] ""
#>
#> $ref
#> [1] "Self-added, 2025"
#>
#> $snomed
#> [1] NA
#>
#> $lpsn
#> [1] NA
#>
#> $mycobank
#> [1] NA
#>
#> $gbif
#> [1] NA
#>
#> $group_members
#> character(0)
#>
# the function tries to be forgiving:
add_custom_microorganisms(
data.frame(
GENUS = "BACTEROIDES / PARABACTEROIDES SLASHLINE",
SPECIES = "SPECIES"
)
)
#> Added Bacteroides/Parabacteroides to the internal `microorganisms` data
#> set.
mo_name("BACTEROIDES / PARABACTEROIDES")
#> [1] "Bacteroides/Parabacteroides"
mo_rank("BACTEROIDES / PARABACTEROIDES")
#> [1] "genus"
# taxonomy still works, even though a slashline genus was given as input:
mo_family("Bacteroides/Parabacteroides")
#> [1] "Bacteroidaceae"
# for groups and complexes, set them as species or subspecies:
add_custom_microorganisms(
data.frame(
genus = "Citrobacter",
species = c("freundii", "braakii complex"),
subspecies = c("complex", "")
)
)
#> Added Citrobacter braakii complex and Citrobacter freundii complex to the
#> internal `microorganisms` data set.
mo_name(c("C. freundii complex", "C. braakii complex"))
#> [1] "Citrobacter freundii complex" "Citrobacter braakii complex"
mo_species(c("C. freundii complex", "C. braakii complex"))
#> [1] "freundii complex" "braakii complex"
mo_gramstain(c("C. freundii complex", "C. braakii complex"))
#> [1] "Gram-negative" "Gram-negative"
# }
```

View File

@@ -7,7 +7,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -112,16 +112,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 1980-02-27 45 45.62466 19</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1953-07-26 72 72.21644 46</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1949-09-02 76 76.11233 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1986-08-03 39 39.19452 13</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1932-11-19 92 92.89863 67</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1949-03-30 76 76.53973 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1996-06-23 29 29.30685 3</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1963-09-16 62 62.07397 36</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1952-05-16 73 73.41096 47</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1952-11-14 72 72.91233 47</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1 1980-02-27 45 45.73973 19</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2 1953-07-26 72 72.33151 46</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3 1949-09-02 76 76.22740 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4 1986-08-03 39 39.30959 13</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5 1932-11-19 93 93.01370 67</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6 1949-03-30 76 76.65479 50</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7 1996-06-23 29 29.42192 3</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8 1963-09-16 62 62.18904 36</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9 1952-05-16 73 73.52603 47</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 1952-11-14 73 73.02740 47</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>

94
reference/age.md Normal file
View File

@@ -0,0 +1,94 @@
# Age in Years of Individuals
Calculates age in years based on a reference date, which is the system
date at default.
## Usage
``` r
age(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...)
```
## Arguments
- x:
Date(s), [character](https://rdrr.io/r/base/character.html) (vectors)
will be coerced with
[`as.POSIXlt()`](https://rdrr.io/r/base/as.POSIXlt.html).
- reference:
Reference date(s) (default is today),
[character](https://rdrr.io/r/base/character.html) (vectors) will be
coerced with [`as.POSIXlt()`](https://rdrr.io/r/base/as.POSIXlt.html).
- exact:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
age calculation should be exact, i.e. with decimals. It divides the
number of days of
[year-to-date](https://en.wikipedia.org/wiki/Year-to-date) (YTD) of
`x` by the number of days in the year of `reference` (either 365 or
366).
- na.rm:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
missing values should be removed.
- ...:
Arguments passed on to
[`as.POSIXlt()`](https://rdrr.io/r/base/as.POSIXlt.html), such as
`origin`.
## Value
An [integer](https://rdrr.io/r/base/integer.html) (no decimals) if
`exact = FALSE`, a [double](https://rdrr.io/r/base/double.html) (with
decimals) otherwise
## Details
Ages below 0 will be returned as `NA` with a warning. Ages above 120
will only give a warning.
This function vectorises over both `x` and `reference`, meaning that
either can have a length of 1 while the other argument has a larger
length.
## See also
To split ages into groups, use the
[`age_groups()`](https://amr-for-r.org/reference/age_groups.md)
function.
## Examples
``` r
# 10 random pre-Y2K birth dates
df <- data.frame(birth_date = as.Date("2000-01-01") - runif(10) * 25000)
# add ages
df$age <- age(df$birth_date)
# add exact ages
df$age_exact <- age(df$birth_date, exact = TRUE)
# add age at millenium switch
df$age_at_y2k <- age(df$birth_date, "2000-01-01")
df
#> birth_date age age_exact age_at_y2k
#> 1 1980-02-27 45 45.73973 19
#> 2 1953-07-26 72 72.33151 46
#> 3 1949-09-02 76 76.22740 50
#> 4 1986-08-03 39 39.30959 13
#> 5 1932-11-19 93 93.01370 67
#> 6 1949-03-30 76 76.65479 50
#> 7 1996-06-23 29 29.42192 3
#> 8 1963-09-16 62 62.18904 36
#> 9 1952-05-16 73 73.52603 47
#> 10 1952-11-14 73 73.02740 47
```

View File

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

129
reference/age_groups.md Normal file
View File

@@ -0,0 +1,129 @@
# Split Ages into Age Groups
Split ages into age groups defined by the `split` argument. This allows
for easier demographic (antimicrobial resistance) analysis. The function
returns an ordered [factor](https://rdrr.io/r/base/factor.html).
## Usage
``` r
age_groups(x, split_at = c(0, 12, 25, 55, 75), names = NULL,
na.rm = FALSE)
```
## Arguments
- x:
Age, e.g. calculated with
[`age()`](https://amr-for-r.org/reference/age.md).
- split_at:
Values to split `x` at - the default is age groups 0-11, 12-24, 25-54,
55-74 and 75+. See *Details*.
- names:
Optional names to be given to the various age groups.
- na.rm:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
missing values should be removed.
## Value
Ordered [factor](https://rdrr.io/r/base/factor.html)
## Details
To split ages, the input for the `split_at` argument can be:
- A [numeric](https://rdrr.io/r/base/numeric.html) vector. A value of
e.g. `c(10, 20)` will split `x` on 0-9, 10-19 and 20+. A value of only
`50` will split `x` on 0-49 and 50+. The default is to split on young
children (0-11), youth (12-24), young adults (25-54), middle-aged
adults (55-74) and elderly (75+).
- A character:
- `"children"` or `"kids"`, equivalent of: `c(0, 1, 2, 4, 6, 13, 18)`.
This will split on 0, 1, 2-3, 4-5, 6-12, 13-17 and 18+.
- `"elderly"` or `"seniors"`, equivalent of: `c(65, 75, 85)`. This
will split on 0-64, 65-74, 75-84, 85+.
- `"fives"`, equivalent of: `1:20 * 5`. This will split on 0-4, 5-9,
..., 95-99, 100+.
- `"tens"`, equivalent of: `1:10 * 10`. This will split on 0-9, 10-19,
..., 90-99, 100+.
## See also
To determine ages, based on one or more reference dates, use the
[`age()`](https://amr-for-r.org/reference/age.md) function.
## Examples
``` r
ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
# split into 0-49 and 50+
age_groups(ages, 50)
#> [1] 0-49 0-49 0-49 50+ 0-49 50+ 50+ 0-49 0-49
#> Levels: 0-49 < 50+
# split into 0-19, 20-49 and 50+
age_groups(ages, c(20, 50))
#> [1] 0-19 0-19 0-19 50+ 20-49 50+ 50+ 20-49 20-49
#> Levels: 0-19 < 20-49 < 50+
age_groups(ages, c(20, 50), names = c("Under 20 years", "20 to 50 years", "Over 50 years"))
#> [1] Under 20 years Under 20 years Under 20 years Over 50 years 20 to 50 years
#> [6] Over 50 years Over 50 years 20 to 50 years 20 to 50 years
#> Levels: Under 20 years < 20 to 50 years < Over 50 years
# split into groups of ten years
age_groups(ages, 1:10 * 10)
#> [1] 0-9 0-9 10-19 50-59 30-39 70-79 100+ 40-49 20-29
#> 11 Levels: 0-9 < 10-19 < 20-29 < 30-39 < 40-49 < 50-59 < 60-69 < ... < 100+
age_groups(ages, split_at = "tens")
#> [1] 0-9 0-9 10-19 50-59 30-39 70-79 100+ 40-49 20-29
#> 11 Levels: 0-9 < 10-19 < 20-29 < 30-39 < 40-49 < 50-59 < 60-69 < ... < 100+
# split into groups of five years
age_groups(ages, 1:20 * 5)
#> [1] 0-4 5-9 15-19 50-54 30-34 75-79 100+ 40-44 20-24
#> 21 Levels: 0-4 < 5-9 < 10-14 < 15-19 < 20-24 < 25-29 < 30-34 < ... < 100+
age_groups(ages, split_at = "fives")
#> [1] 0-4 5-9 15-19 50-54 30-34 75-79 100+ 40-44 20-24
#> 21 Levels: 0-4 < 5-9 < 10-14 < 15-19 < 20-24 < 25-29 < 30-34 < ... < 100+
# split specifically for children
age_groups(ages, c(1, 2, 4, 6, 13, 18))
#> [1] 2-3 6-12 13-17 18+ 18+ 18+ 18+ 18+ 18+
#> Levels: 0 < 1 < 2-3 < 4-5 < 6-12 < 13-17 < 18+
age_groups(ages, "children")
#> [1] 2-3 6-12 13-17 18+ 18+ 18+ 18+ 18+ 18+
#> Levels: 0 < 1 < 2-3 < 4-5 < 6-12 < 13-17 < 18+
# \donttest{
# resistance of ciprofloxacin per age group
if (require("dplyr") && require("ggplot2")) {
example_isolates %>%
filter_first_isolate() %>%
filter(mo == as.mo("Escherichia coli")) %>%
group_by(age_group = age_groups(age)) %>%
select(age_group, CIP) %>%
ggplot_sir(
x = "age_group",
minimum = 0,
x.title = "Age Group",
title = "Ciprofloxacin resistance per age group"
)
}
#> Loading required package: ggplot2
# }
```

View File

@@ -9,7 +9,7 @@ Adhering to previously described approaches (see Source) and especially the Baye
<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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">

838
reference/antibiogram.md Normal file
View File

@@ -0,0 +1,838 @@
# Generate Traditional, Combination, Syndromic, or WISCA Antibiograms
Create detailed antibiograms with options for traditional, combination,
syndromic, and Bayesian WISCA methods.
Adhering to previously described approaches (see *Source*) and
especially the Bayesian WISCA model (Weighted-Incidence Syndromic
Combination Antibiogram) by Bielicki *et al.*, these functions provide
flexible output formats including plots and tables, ideal for
integration with R Markdown and Quarto reports.
## Usage
``` r
antibiogram(x, antimicrobials = where(is.sir), mo_transform = "shortname",
ab_transform = "name", syndromic_group = NULL, add_total_n = FALSE,
only_all_tested = FALSE, digits = ifelse(wisca, 1, 0),
formatting_type = getOption("AMR_antibiogram_formatting_type",
ifelse(wisca, 14, 18)), col_mo = NULL, language = get_AMR_locale(),
minimum = 30, combine_SI = TRUE, sep = " + ", sort_columns = TRUE,
wisca = FALSE, simulations = 1000, conf_interval = 0.95,
interval_side = "two-tailed", info = interactive(), ...)
wisca(x, antimicrobials = where(is.sir), ab_transform = "name",
syndromic_group = NULL, only_all_tested = FALSE, digits = 1,
formatting_type = getOption("AMR_antibiogram_formatting_type", 14),
col_mo = NULL, language = get_AMR_locale(), combine_SI = TRUE,
sep = " + ", sort_columns = TRUE, simulations = 1000,
conf_interval = 0.95, interval_side = "two-tailed",
info = interactive(), ...)
retrieve_wisca_parameters(wisca_model, ...)
# S3 method for class 'antibiogram'
plot(x, ...)
# S3 method for class 'antibiogram'
autoplot(object, ...)
# S3 method for class 'antibiogram'
knit_print(x, italicise = TRUE,
na = getOption("knitr.kable.NA", default = ""), ...)
```
## Source
- Bielicki JA *et al.* (2016). **Selecting appropriate empirical
antibiotic regimens for paediatric bloodstream infections: application
of a Bayesian decision model to local and pooled antimicrobial
resistance surveillance data** *Journal of Antimicrobial Chemotherapy*
71(3); [doi:10.1093/jac/dkv397](https://doi.org/10.1093/jac/dkv397)
- Bielicki JA *et al.* (2020). **Evaluation of the coverage of 3
antibiotic regimens for neonatal sepsis in the hospital setting across
Asian countries** *JAMA Netw Open.* 3(2):e1921124;
[doi:10.1001/jamanetworkopen.2019.21124](https://doi.org/10.1001/jamanetworkopen.2019.21124)
- Klinker KP *et al.* (2021). **Antimicrobial stewardship and
antibiograms: importance of moving beyond traditional antibiograms**.
*Therapeutic Advances in Infectious Disease*, May
5;8:20499361211011373;
[doi:10.1177/20499361211011373](https://doi.org/10.1177/20499361211011373)
- Barbieri E *et al.* (2021). **Development of a Weighted-Incidence
Syndromic Combination Antibiogram (WISCA) to guide the choice of the
empiric antibiotic treatment for urinary tract infection in paediatric
patients: a Bayesian approach** *Antimicrobial Resistance & Infection
Control* May 1;10(1):74;
[doi:10.1186/s13756-021-00939-2](https://doi.org/10.1186/s13756-021-00939-2)
- **M39 Analysis and Presentation of Cumulative Antimicrobial
Susceptibility Test Data, 5th Edition**, 2022, *Clinical and
Laboratory Standards Institute (CLSI)*.
<https://clsi.org/standards/products/microbiology/documents/m39/>.
## Arguments
- x:
A [data.frame](https://rdrr.io/r/base/data.frame.html) containing at
least a column with microorganisms and columns with antimicrobial
results (class 'sir', see
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md)).
- antimicrobials:
A vector specifying the antimicrobials containing SIR values to
include in the antibiogram (see *Examples*). Will be evaluated using
[`guess_ab_col()`](https://amr-for-r.org/reference/guess_ab_col.md).
This can be:
- Any antimicrobial name or code that could match (see
[`guess_ab_col()`](https://amr-for-r.org/reference/guess_ab_col.md))
to any column in `x`
- Any [antimicrobial
selector](https://amr-for-r.org/reference/antimicrobial_selectors.md),
such as
[`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
or
[`carbapenems()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
- A combination of the above, using
[`c()`](https://rdrr.io/r/base/c.html), e.g.:
- `c(aminoglycosides(), "AMP", "AMC")`
- `c(aminoglycosides(), carbapenems())`
- Column indices using numbers
- Combination therapy, indicated by using `"+"`, with or without
[antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.md),
e.g.:
- `"cipro + genta"`
- `"TZP+TOB"`
- `c("TZP", "TZP+GEN", "TZP+TOB")`
- `carbapenems() + "GEN"`
- `carbapenems() + c("", "GEN")`
- `carbapenems() + c("", aminoglycosides())`
- mo_transform:
A character to transform microorganism input - must be `"name"`,
`"shortname"` (default), `"gramstain"`, or one of the column names of
the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set: "mo", "fullname", "status", "kingdom", "phylum", "class",
"order", "family", "genus", "species", "subspecies", "rank", "ref",
"oxygen_tolerance", "source", "lpsn", "lpsn_parent",
"lpsn_renamed_to", "mycobank", "mycobank_parent",
"mycobank_renamed_to", "gbif", "gbif_parent", "gbif_renamed_to",
"prevalence", or "snomed". Can also be `NULL` to not transform the
input or `NA` to consider all microorganisms 'unknown'.
- ab_transform:
A character to transform antimicrobial input - must be one of the
column names of the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set (defaults to `"name"`): "ab", "cid", "name", "group", "atc",
"atc_group1", "atc_group2", "abbreviations", "synonyms", "oral_ddd",
"oral_units", "iv_ddd", "iv_units", or "loinc". Can also be `NULL` to
not transform the input.
- syndromic_group:
A column name of `x`, or values calculated to split rows of `x`, e.g.
by using [`ifelse()`](https://rdrr.io/r/base/ifelse.html) or
[`case_when()`](https://dplyr.tidyverse.org/reference/case_when.html).
See *Examples*.
- add_total_n:
*(deprecated in favour of `formatting_type`)* A
[logical](https://rdrr.io/r/base/logical.html) to indicate whether
`n_tested` available numbers per pathogen should be added to the table
(default is `TRUE`). This will add the lowest and highest number of
available isolates per antimicrobial (e.g, if for *E. coli* 200
isolates are available for ciprofloxacin and 150 for amoxicillin, the
returned number will be "150-200"). This option is unavailable when
`wisca = TRUE`; in that case, use `retrieve_wisca_parameters()` to get
the parameters used for WISCA.
- only_all_tested:
(for combination antibiograms): a
[logical](https://rdrr.io/r/base/logical.html) to indicate that
isolates must be tested for all antimicrobials, see *Details*.
- digits:
Number of digits to use for rounding the antimicrobial coverage,
defaults to 1 for WISCA and 0 otherwise.
- formatting_type:
Numeric value (122 for WISCA, 1-12 for non-WISCA) indicating how the
'cells' of the antibiogram table should be formatted. See *Details* \>
*Formatting Type* for a list of options.
- col_mo:
Column name of the names or codes of the microorganisms (see
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md)) - the default
is the first column of class
[`mo`](https://amr-for-r.org/reference/as.mo.md). Values will be
coerced using [`as.mo()`](https://amr-for-r.org/reference/as.mo.md).
- language:
Language to translate text, which defaults to the system language (see
[`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md)).
- minimum:
The minimum allowed number of available (tested) isolates. Any isolate
count lower than `minimum` will return `NA` with a warning. The
default number of `30` isolates is advised by the Clinical and
Laboratory Standards Institute (CLSI) as best practice, see *Source*.
- combine_SI:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
all susceptibility should be determined by results of either S, SDD,
or I, instead of only S (default is `TRUE`).
- sep:
A separating character for antimicrobial columns in combination
antibiograms.
- sort_columns:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the antimicrobial columns must be sorted on name.
- wisca:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
Weighted-Incidence Syndromic Combination Antibiogram (WISCA) must be
generated (default is `FALSE`). This will use a Bayesian decision
model to estimate regimen coverage probabilities using [Monte Carlo
simulations](https://en.wikipedia.org/wiki/Monte_Carlo_method). Set
`simulations`, `conf_interval`, and `interval_side` to adjust.
- simulations:
(for WISCA) a numerical value to set the number of Monte Carlo
simulations.
- conf_interval:
A numerical value to set confidence interval (default is `0.95`).
- interval_side:
The side of the confidence interval, either `"two-tailed"` (default),
`"left"` or `"right"`.
- info:
A [logical](https://rdrr.io/r/base/logical.html) to indicate info
should be printed - the default is `TRUE` only in interactive mode.
- ...:
When used in [R Markdown or
Quarto](https://rdrr.io/pkg/knitr/man/kable.html): arguments passed on
to [`knitr::kable()`](https://rdrr.io/pkg/knitr/man/kable.html)
(otherwise, has no use).
- wisca_model:
The outcome of `wisca()` or `antibiogram(..., wisca = TRUE)`.
- object:
An `antibiogram()` object.
- italicise:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the microorganism names in the
[knitr](https://rdrr.io/pkg/knitr/man/kable.html) table should be made
italic, using
[`italicise_taxonomy()`](https://amr-for-r.org/reference/italicise_taxonomy.md).
- na:
Character to use for showing `NA` values.
## Details
These functions return a table with values between 0 and 100 for
*susceptibility*, not resistance.
**Remember that you should filter your data to let it contain only first
isolates!** This is needed to exclude duplicates and to reduce selection
bias. Use
[`first_isolate()`](https://amr-for-r.org/reference/first_isolate.md) to
determine them with one of the four available algorithms: isolate-based,
patient-based, episode-based, or phenotype-based.
For estimating antimicrobial coverage, especially when creating a WISCA,
the outcome might become more reliable by only including the top *n*
species encountered in the data. You can filter on this top *n* using
[`top_n_microorganisms()`](https://amr-for-r.org/reference/top_n_microorganisms.md).
For example, use `top_n_microorganisms(your_data, n = 10)` as a
pre-processing step to only include the top 10 species in the data.
The numeric values of an antibiogram are stored in a long format as the
[attribute](https://rdrr.io/r/base/attributes.html) `long_numeric`. You
can retrieve them using `attributes(x)$long_numeric`, where `x` is the
outcome of `antibiogram()` or `wisca()`. This is ideal for e.g. advanced
plotting.
### Formatting Type
The formatting of the 'cells' of the table can be set with the argument
`formatting_type`. In these examples, `5` indicates the antimicrobial
coverage (`4-6` the confidence level), `15` the number of susceptible
isolates, and `300` the number of tested (i.e., available) isolates:
1. 5
2. 15
3. 300
4. 15/300
5. 5 (300)
6. 5% (300)
7. 5 (N=300)
8. 5% (N=300)
9. 5 (15/300)
10. 5% (15/300)
11. 5 (N=15/300)
12. 5% (N=15/300)
13. 5 (4-6)
14. 5% (4-6%) - **default for WISCA**
15. 5 (4-6,300)
16. 5% (4-6%,300)
17. 5 (4-6,N=300)
18. 5% (4-6%,N=300) - **default for non-WISCA**
19. 5 (4-6,15/300)
20. 5% (4-6%,15/300)
21. 5 (4-6,N=15/300)
22. 5% (4-6%,N=15/300)
The default can be set globally with the package option
[`AMR_antibiogram_formatting_type`](https://amr-for-r.org/reference/AMR-options.md),
e.g. `options(AMR_antibiogram_formatting_type = 5)`. Do note that for
WISCA, the total numbers of tested and susceptible isolates are less
useful to report, since these are included in the Bayesian model and
apparent from the susceptibility and its confidence level.
Set `digits` (defaults to `0`) to alter the rounding of the
susceptibility percentages.
### Antibiogram Types
There are various antibiogram types, as summarised by Klinker *et al.*
(2021,
[doi:10.1177/20499361211011373](https://doi.org/10.1177/20499361211011373)
), and they are all supported by `antibiogram()`.
For clinical coverage estimations, **use WISCA whenever possible**,
since it provides more precise coverage estimates by accounting for
pathogen incidence and antimicrobial susceptibility, as has been shown
by Bielicki *et al.* (2020,
[doi:10.1001/jamanetworkopen.2019.21124](https://doi.org/10.1001/jamanetworkopen.2019.21124)
). See the section *Explaining WISCA* on this page. Do note that WISCA
is pathogen-agnostic, meaning that the outcome is not stratied by
pathogen, but rather by syndrome.
1. **Traditional Antibiogram**
Case example: Susceptibility of *Pseudomonas aeruginosa* to
piperacillin/tazobactam (TZP)
Code example:
antibiogram(your_data,
antimicrobials = "TZP")
2. **Combination Antibiogram**
Case example: Additional susceptibility of *Pseudomonas aeruginosa*
to TZP + tobramycin versus TZP alone
Code example:
antibiogram(your_data,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
3. **Syndromic Antibiogram**
Case example: Susceptibility of *Pseudomonas aeruginosa* to TZP
among respiratory specimens (obtained among ICU patients only)
Code example:
antibiogram(your_data,
antimicrobials = penicillins(),
syndromic_group = "ward")
4. **Weighted-Incidence Syndromic Combination Antibiogram (WISCA)**
WISCA can be applied to any antibiogram, see the section *Explaining
WISCA* on this page for more information.
Code example:
antibiogram(your_data,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
wisca = TRUE)
# this is equal to:
wisca(your_data,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
WISCA uses a sophisticated Bayesian decision model to combine both
local and pooled antimicrobial resistance data. This approach not
only evaluates local patterns but can also draw on multi-centre
datasets to improve regimen accuracy, even in low-incidence
infections like paediatric bloodstream infections (BSIs).
### Grouped tibbles
For any type of antibiogram, grouped
[tibbles](https://tibble.tidyverse.org/reference/tibble.html) can also
be used to calculate susceptibilities over various groups.
Code example:
library(dplyr)
your_data %>%
group_by(has_sepsis, is_neonate, sex) %>%
wisca(antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"))
### Stepped Approach for Clinical Insight
In clinical practice, antimicrobial coverage decisions evolve as more
microbiological data becomes available. This theoretical stepped
approach ensures empirical coverage can continuously assessed to improve
patient outcomes:
1. **Initial Empirical Therapy (Admission / Pre-Culture Data)**
At admission, no pathogen information is available.
- Action: broad-spectrum coverage is based on local resistance
patterns and syndromic antibiograms. Using the pathogen-agnostic
yet incidence-weighted WISCA is preferred.
- Code example:
antibiogram(your_data,
antimicrobials = selected_regimens,
mo_transform = NA) # all pathogens set to `NA`
# preferred: use WISCA
wisca(your_data,
antimicrobials = selected_regimens)
2. **Refinement with Gram Stain Results**
When a blood culture becomes positive, the Gram stain provides an
initial and crucial first stratification (Gram-positive vs.
Gram-negative).
- Action: narrow coverage based on Gram stain-specific resistance
patterns.
- Code example:
antibiogram(your_data,
antimicrobials = selected_regimens,
mo_transform = "gramstain") # all pathogens set to Gram-pos/Gram-neg
3. **Definitive Therapy Based on Species Identification**
After cultivation of the pathogen, full pathogen identification
allows precise targeting of therapy.
- Action: adjust treatment to pathogen-specific antibiograms,
minimizing resistance risks.
- Code example:
antibiogram(your_data,
antimicrobials = selected_regimens,
mo_transform = "shortname") # all pathogens set to 'G. species', e.g., E. coli
By structuring antibiograms around this stepped approach, clinicians can
make data-driven adjustments at each stage, ensuring optimal empirical
and targeted therapy while reducing unnecessary broad-spectrum
antimicrobial use.
### Inclusion in Combination Antibiograms
Note that for combination antibiograms, it is important to realise that
susceptibility can be calculated in two ways, which can be set with the
`only_all_tested` argument (default is `FALSE`). See this example for
two antimicrobials, Drug A and Drug B, about how `antibiogram()` works
to calculate the %SI:
--------------------------------------------------------------------
only_all_tested = FALSE only_all_tested = TRUE
----------------------- -----------------------
Drug A Drug B considered considered considered considered
susceptible tested susceptible tested
-------- -------- ----------- ---------- ----------- ----------
S or I S or I X X X X
R S or I X X X X
<NA> S or I X X - -
S or I R X X X X
R R - X - X
<NA> R - - - -
S or I <NA> X X - -
R <NA> - - - -
<NA> <NA> - - - -
--------------------------------------------------------------------
### Plotting
All types of antibiograms as listed above can be plotted (using
[`ggplot2::autoplot()`](https://ggplot2.tidyverse.org/reference/autoplot.html)
or base R's [`plot()`](https://amr-for-r.org/reference/plot.md) and
[`barplot()`](https://rdrr.io/r/graphics/barplot.html)). As mentioned
above, the numeric values of an antibiogram are stored in a long format
as the [attribute](https://rdrr.io/r/base/attributes.html)
`long_numeric`. You can retrieve them using
`attributes(x)$long_numeric`, where `x` is the outcome of
`antibiogram()` or `wisca()`.
The outcome of `antibiogram()` can also be used directly in R Markdown /
Quarto (i.e., `knitr`) for reports. In this case,
[`knitr::kable()`](https://rdrr.io/pkg/knitr/man/kable.html) will be
applied automatically and microorganism names will even be printed in
italics at default (see argument `italicise`).
You can also use functions from specific 'table reporting' packages to
transform the output of `antibiogram()` to your needs, e.g. with
`flextable::as_flextable()` or `gt::gt()`.
## Explaining WISCA
WISCA (Weighted-Incidence Syndromic Combination Antibiogram) estimates
the probability of empirical coverage for combination regimens.
It weights susceptibility by pathogen prevalence within a clinical
syndrome and provides credible intervals around the expected coverage.
For more background, interpretation, and examples, see [the WISCA
vignette](https://amr-for-r.org/articles/WISCA.html).
## Author
Implementation: Dr. Larisse Bolton and Dr. Matthijs Berends
## Examples
``` r
# example_isolates is a data set available in the AMR package.
# run ?example_isolates for more info.
example_isolates
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
# \donttest{
# Traditional antibiogram ----------------------------------------------
antibiogram(example_isolates,
antimicrobials = c(aminoglycosides(), carbapenems())
)
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
#> # An Antibiogram: 10 × 7
#> # Type: Non-WISCA with 95% CI
#> Pathogen Amikacin Gentamicin Imipenem Kanamycin Meropenem Tobramycin
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 CoNS 0% (0-8%,N… 86% (82-9… 52% (37… 0% (0-8%… 52% (37-… 22% (12-3…
#> 2 E. coli 100% (98-1… 98% (96-9… 100% (9… NA 100% (99… 97% (96-9…
#> 3 E. faecalis 0% (0-9%,N… 0% (0-9%,… 100% (9… 0% (0-9%… NA 0% (0-9%,…
#> 4 K. pneumoniae NA 90% (79-9… 100% (9… NA 100% (93… 90% (79-9…
#> 5 P. aeruginosa NA 100% (88-… NA 0% (0-12… NA 100% (88-…
#> 6 P. mirabilis NA 94% (80-9… 94% (79… NA NA 94% (80-9…
#> 7 S. aureus NA 99% (97-1… NA NA NA 98% (92-1…
#> 8 S. epidermidis 0% (0-8%,N… 79% (71-8… NA 0% (0-8%… NA 51% (40-6…
#> 9 S. hominis NA 92% (84-9… NA NA NA 85% (74-9…
#> 10 S. pneumoniae 0% (0-3%,N… 0% (0-3%,… NA 0% (0-3%… NA 0% (0-3%,…
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
antibiogram(example_isolates,
antimicrobials = aminoglycosides(),
ab_transform = "atc",
mo_transform = "gramstain"
)
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> # An Antibiogram: 2 × 5
#> # Type: Non-WISCA with 95% CI
#> Pathogen J01GB01 J01GB03 J01GB04 J01GB06
#> <chr> <chr> <chr> <chr> <chr>
#> 1 Gram-negative 96% (94-97%,N=686) 96% (95-98%,N=684) 0% (0-10%,N=35) 98% (96-…
#> 2 Gram-positive 34% (31-38%,N=665) 63% (60-66%,N=1170) 0% (0-1%,N=436) 0% (0-1%…
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
antibiogram(example_isolates,
antimicrobials = carbapenems(),
ab_transform = "name",
mo_transform = "name"
)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
#> # An Antibiogram: 5 × 3
#> # Type: Non-WISCA with 95% CI
#> Pathogen Imipenem Meropenem
#> <chr> <chr> <chr>
#> 1 Coagulase-negative Staphylococcus (CoNS) 52% (37-67%,N=48) 52% (37-67%,N=4…
#> 2 Enterococcus faecalis 100% (91-100%,N=38) NA
#> 3 Escherichia coli 100% (99-100%,N=422) 100% (99-100%,N…
#> 4 Klebsiella pneumoniae 100% (93-100%,N=51) 100% (93-100%,N…
#> 5 Proteus mirabilis 94% (79-99%,N=32) NA
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
# Combined antibiogram -------------------------------------------------
# combined antimicrobials yield higher empiric coverage
antibiogram(example_isolates,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
mo_transform = "gramstain"
)
#> # An Antibiogram: 2 × 4
#> # Type: Non-WISCA with 95% CI
#> Pathogen Piperacillin/tazobac…¹ Piperacillin/tazobac…² Piperacillin/tazobac…³
#> <chr> <chr> <chr> <chr>
#> 1 Gram-neg… 88% (85-91%,N=641) 99% (97-99%,N=691) 98% (97-99%,N=693)
#> 2 Gram-pos… 86% (82-89%,N=345) 98% (96-98%,N=1044) 95% (93-97%,N=550)
#> # abbreviated names: ¹​`Piperacillin/tazobactam`,
#> # ²​`Piperacillin/tazobactam + Gentamicin`,
#> # ³​`Piperacillin/tazobactam + Tobramycin`
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
# you can use any antimicrobial selector with `+` too:
antibiogram(example_isolates,
antimicrobials = ureidopenicillins() + c("", "GEN", "tobra"),
mo_transform = "gramstain"
)
#> For `ureidopenicillins()` using column 'TZP' (piperacillin/tazobactam)
#> # An Antibiogram: 2 × 4
#> # Type: Non-WISCA with 95% CI
#> Pathogen Piperacillin/tazobac…¹ Piperacillin/tazobac…² Piperacillin/tazobac…³
#> <chr> <chr> <chr> <chr>
#> 1 Gram-neg… 88% (85-91%,N=641) 99% (97-99%,N=691) 98% (97-99%,N=693)
#> 2 Gram-pos… 86% (82-89%,N=345) 98% (96-98%,N=1044) 95% (93-97%,N=550)
#> # abbreviated names: ¹​`Piperacillin/tazobactam`,
#> # ²​`Piperacillin/tazobactam + Gentamicin`,
#> # ³​`Piperacillin/tazobactam + Tobramycin`
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
# names of antimicrobials do not need to resemble columns exactly:
antibiogram(example_isolates,
antimicrobials = c("Cipro", "cipro + genta"),
mo_transform = "gramstain",
ab_transform = "name",
sep = " & "
)
#> # An Antibiogram: 2 × 3
#> # Type: Non-WISCA with 95% CI
#> Pathogen Ciprofloxacin `Ciprofloxacin & Gentamicin`
#> <chr> <chr> <chr>
#> 1 Gram-negative 91% (88-93%,N=684) 99% (97-99%,N=694)
#> 2 Gram-positive 77% (74-80%,N=724) 93% (91-94%,N=847)
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
# Syndromic antibiogram ------------------------------------------------
# the data set could contain a filter for e.g. respiratory specimens
antibiogram(example_isolates,
antimicrobials = c(aminoglycosides(), carbapenems()),
syndromic_group = "ward"
)
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> For `carbapenems()` using columns 'IPM' (imipenem) and 'MEM' (meropenem)
#> # An Antibiogram: 14 × 8
#> # Type: Non-WISCA with 95% CI
#> `Syndromic Group` Pathogen Amikacin Gentamicin Imipenem Kanamycin Meropenem
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 Clinical CoNS NA 89% (84-9… 57% (39… NA 57% (39-…
#> 2 ICU CoNS NA 79% (68-8… NA NA NA
#> 3 Outpatient CoNS NA 84% (66-9… NA NA NA
#> 4 Clinical E. coli 100% (9… 98% (96-9… 100% (9… NA 100% (99…
#> 5 ICU E. coli 100% (9… 99% (95-1… 100% (9… NA 100% (97…
#> 6 Clinical K. pneumo… NA 92% (81-9… 100% (9… NA 100% (92…
#> 7 Clinical P. mirabi… NA 100% (88-… NA NA NA
#> 8 Clinical S. aureus NA 99% (95-1… NA NA NA
#> 9 ICU S. aureus NA 100% (95-… NA NA NA
#> 10 Clinical S. epider… NA 82% (72-9… NA NA NA
#> 11 ICU S. epider… NA 72% (60-8… NA NA NA
#> 12 Clinical S. hominis NA 96% (85-9… NA NA NA
#> 13 Clinical S. pneumo… 0% (0-5… 0% (0-5%,… NA 0% (0-5%… NA
#> 14 ICU S. pneumo… 0% (0-1… 0% (0-12%… NA 0% (0-12… NA
#> # 1 more variable: Tobramycin <chr>
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
# now define a data set with only E. coli
ex1 <- example_isolates[which(mo_genus() == "Escherichia"), ]
#> Using column 'mo' as input for `mo_genus()`
# with a custom language, though this will be determined automatically
# (i.e., this table will be in Spanish on Spanish systems)
antibiogram(ex1,
antimicrobials = aminoglycosides(),
ab_transform = "name",
syndromic_group = ifelse(ex1$ward == "ICU",
"UCI", "No UCI"
),
language = "es"
)
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> # An Antibiogram: 2 × 5
#> # Type: Non-WISCA with 95% CI
#> `Grupo sindrómico` Patógeno Amikacina Gentamicina Tobramicina
#> <chr> <chr> <chr> <chr> <chr>
#> 1 No UCI E. coli 100% (97-100%,N=119) 98% (96-99%,N=32… 98% (96-99…
#> 2 UCI E. coli 100% (93-100%,N=52) 99% (95-100%,N=1… 96% (92-99…
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
# WISCA antibiogram ----------------------------------------------------
# WISCA are not stratified by species, but rather on syndromes
antibiogram(example_isolates,
antimicrobials = c("TZP", "TZP+TOB", "TZP+GEN"),
syndromic_group = "ward",
wisca = TRUE
)
#> # An Antibiogram: 3 × 4
#> # Type: WISCA with 95% CI
#> `Syndromic Group` `Piperacillin/tazobactam` Piperacillin/tazobactam + Gentam…¹
#> <chr> <chr> <chr>
#> 1 Clinical 73.4% (67.6-78.6%) 92.4% (90.6-93.7%)
#> 2 ICU 57.4% (49.7-65.6%) 85% (82.1-87.6%)
#> 3 Outpatient 56.9% (46.9-66.7%) 74.4% (69-79.7%)
#> # abbreviated name: ¹​`Piperacillin/tazobactam + Gentamicin`
#> # 1 more variable: `Piperacillin/tazobactam + Tobramycin` <chr>
#> # Use `ggplot2::autoplot()` or base R `plot()` to create a plot of this antibiogram,
#> # or use it directly in R Markdown or https://quarto.org, see ?antibiogram
# Print the output for R Markdown / Quarto -----------------------------
ureido <- antibiogram(example_isolates,
antimicrobials = ureidopenicillins(),
syndromic_group = "ward",
wisca = TRUE
)
#> For `ureidopenicillins()` using column 'TZP' (piperacillin/tazobactam)
# in an Rmd file, you would just need to return `ureido` in a chunk,
# but to be explicit here:
if (requireNamespace("knitr")) {
cat(knitr::knit_print(ureido))
}
#>
#>
#> |Syndromic Group |Piperacillin/tazobactam |
#> |:---------------|:-----------------------|
#> |Clinical |73.6% (68.4-79%) |
#> |ICU |57.4% (49.7-65.4%) |
#> |Outpatient |57% (47.2-66.7%) |
# Generate plots with ggplot2 or base R --------------------------------
ab1 <- antibiogram(example_isolates,
antimicrobials = c("AMC", "CIP", "TZP", "TZP+TOB"),
mo_transform = "gramstain"
)
ab2 <- antibiogram(example_isolates,
antimicrobials = c("AMC", "CIP", "TZP", "TZP+TOB"),
mo_transform = "gramstain",
syndromic_group = "ward"
)
if (requireNamespace("ggplot2")) {
ggplot2::autoplot(ab1)
}
if (requireNamespace("ggplot2")) {
ggplot2::autoplot(ab2)
}
plot(ab1)
plot(ab2)
# }
```

View File

@@ -17,7 +17,7 @@ my_data_with_all_these_columns %&amp;gt;%
<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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -217,14 +217,14 @@ my_data_with_all_these_columns %&amp;gt;%
<li><p><code>aminopenicillins()</code> can select: <br> amoxicillin (AMX) and ampicillin (AMP)</p></li>
<li><p><code>antifungals()</code> can select: <br> amorolfine (AMO), amphotericin B (AMB), amphotericin B-high (AMH), anidulafungin (ANI), butoconazole (BUT), caspofungin (CAS), ciclopirox (CIX), clotrimazole (CTR), econazole (ECO), fluconazole (FLU), flucytosine (FCT), fosfluconazole (FFL), griseofulvin (GRI), hachimycin (HCH), ibrexafungerp (IBX), isavuconazole (ISV), isoconazole (ISO), itraconazole (ITR), ketoconazole (KET), manogepix (MGX), micafungin (MIF), miconazole (MCZ), nystatin (NYS), oteseconazole (OTE), pimaricin (PMR), posaconazole (POS), rezafungin (RZF), ribociclib (RBC), sulconazole (SUC), terbinafine (TRB), terconazole (TRC), and voriconazole (VOR)</p></li>
<li><p><code>antimycobacterials()</code> can select: <br> 4-aminosalicylic acid (AMA), calcium aminosalicylate (CLA), capreomycin (CAP), clofazimine (CLF), delamanid (DLM), enviomycin (ENV), ethambutol (ETH), ethambutol/isoniazid (ETI), ethionamide (ETI1), isoniazid (INH), isoniazid/sulfamethoxazole/trimethoprim/pyridoxine (IST), morinamide (MRN), p-aminosalicylic acid (PAS), pretomanid (PMD), protionamide (PTH), pyrazinamide (PZA), rifabutin (RIB), rifampicin (RIF), rifampicin/ethambutol/isoniazid (REI), rifampicin/isoniazid (RFI), rifampicin/pyrazinamide/ethambutol/isoniazid (RPEI), rifampicin/pyrazinamide/isoniazid (RPI), rifamycin (RFM), rifapentine (RFP), sodium aminosalicylate (SDA), streptomycin/isoniazid (STI), terizidone (TRZ), thioacetazone (TAT), thioacetazone/isoniazid (THI1), tiocarlide (TCR), and viomycin (VIO)</p></li>
<li><p><code>betalactams()</code> can select: <br> amoxicillin (AMX), amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin (AMP), ampicillin/sulbactam (SAM), apalcillin (APL), aspoxicillin (APX), azidocillin (AZD), azlocillin (AZL), aztreonam (ATM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), bacampicillin (BAM), benzathine benzylpenicillin (BNB), benzathine phenoxymethylpenicillin (BNP), benzylpenicillin (PEN), benzylpenicillin screening test (PEN-S), biapenem (BIA), carbenicillin (CRB), carindacillin (CRN), carumonam (CAR), cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), ciclacillin (CIC), clometocillin (CLM), cloxacillin (CLO), dicloxacillin (DIC), doripenem (DOR), epicillin (EPC), ertapenem (ETP), flucloxacillin (FLC), hetacillin (HET), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), latamoxef (LTM), lenampicillin (LEN), loracarbef (LOR), mecillinam (MEC), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), metampicillin (MTM), meticillin (MET), mezlocillin (MEZ), mezlocillin/sulbactam (MSU), nafcillin (NAF), oxacillin (OXA), oxacillin screening test (OXA-S), panipenem (PAN), penamecillin (PNM), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), pheneticillin (PHE), phenoxymethylpenicillin (PHN), piperacillin (PIP), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), piridicillin (PRC), pivampicillin (PVM), pivmecillinam (PME), procaine benzylpenicillin (PRB), propicillin (PRP), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), sarmoxicillin (SRX), sulbenicillin (SBC), sultamicillin (SLT6), talampicillin (TAL), tebipenem (TBP), temocillin (TEM), ticarcillin (TIC), ticarcillin/clavulanic acid (TCC), and tigemonam (TMN)</p></li>
<li><p><code>betalactams_with_inhibitor()</code> can select: <br> amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin/sulbactam (SAM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefoperazone/sulbactam (CSL), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefpodoxime/clavulanic acid (CDC), ceftaroline/avibactam (CPA), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), ceftolozane/tazobactam (CZT), ceftriaxone/beta-lactamase inhibitor (CEB), imipenem/relebactam (IMR), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), mezlocillin/sulbactam (MSU), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), and ticarcillin/clavulanic acid (TCC)</p></li>
<li><p><code>carbapenems()</code> can select: <br> biapenem (BIA), doripenem (DOR), ertapenem (ETP), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), panipenem (PAN), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), and tebipenem (TBP)</p></li>
<li><p><code>cephalosporins()</code> can select: <br> cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), latamoxef (LTM), and loracarbef (LOR)</p></li>
<li><p><code>betalactams()</code> can select: <br> amoxicillin (AMX), amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin (AMP), ampicillin/sulbactam (SAM), apalcillin (APL), aspoxicillin (APX), azidocillin (AZD), azlocillin (AZL), aztreonam (ATM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), bacampicillin (BAM), benzathine benzylpenicillin (BNB), benzathine phenoxymethylpenicillin (BNP), benzylpenicillin (PEN), benzylpenicillin screening test (PEN-S), biapenem (BIA), carbenicillin (CRB), carindacillin (CRN), carumonam (CAR), cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), ciclacillin (CIC), clometocillin (CLM), cloxacillin (CLO), dicloxacillin (DIC), doripenem (DOR), epicillin (EPC), ertapenem (ETP), flucloxacillin (FLC), hetacillin (HET), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), latamoxef (LTM), lenampicillin (LEN), loracarbef (LOR), mecillinam (MEC), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), metampicillin (MTM), meticillin (MET), mezlocillin (MEZ), mezlocillin/sulbactam (MSU), nafcillin (NAF), oxacillin (OXA), oxacillin screening test (OXA-S), panipenem (PAN), penamecillin (PNM), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), pheneticillin (PHE), phenoxymethylpenicillin (PHN), piperacillin (PIP), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), piridicillin (PRC), pivampicillin (PVM), pivmecillinam (PME), procaine benzylpenicillin (PRB), propicillin (PRP), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), sarmoxicillin (SRX), sulbenicillin (SBC), sultamicillin (SLT6), talampicillin (TAL), taniborbactam (TAN), tebipenem (TBP), temocillin (TEM), ticarcillin (TIC), ticarcillin/clavulanic acid (TCC), and tigemonam (TMN)</p></li>
<li><p><code>betalactams_with_inhibitor()</code> can select: <br> amoxicillin/clavulanic acid (AMC), amoxicillin/sulbactam (AXS), ampicillin/sulbactam (SAM), aztreonam/avibactam (AZA), aztreonam/nacubactam (ANC), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefoperazone/sulbactam (CSL), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefpodoxime/clavulanic acid (CDC), ceftaroline/avibactam (CPA), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), ceftolozane/tazobactam (CZT), ceftriaxone/beta-lactamase inhibitor (CEB), imipenem/relebactam (IMR), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), mezlocillin/sulbactam (MSU), penicillin/novobiocin (PNO), penicillin/sulbactam (PSU), piperacillin/sulbactam (PIS), piperacillin/tazobactam (TZP), and ticarcillin/clavulanic acid (TCC)</p></li>
<li><p><code>carbapenems()</code> can select: <br> biapenem (BIA), doripenem (DOR), ertapenem (ETP), imipenem (IPM), imipenem/EDTA (IPE), imipenem/relebactam (IMR), meropenem (MEM), meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), panipenem (PAN), razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), taniborbactam (TAN), and tebipenem (TBP)</p></li>
<li><p><code>cephalosporins()</code> can select: <br> cefacetrile (CAC), cefaclor (CEC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefamandole (MAN), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetamet (CAT), cefetamet pivoxil (CPI), cefetecol (CCL), cefetrizole (CZL), cefiderocol (FDC), cefixime (CFM), cefmenoxime (CMX), cefmetazole (CMZ), cefodizime (DIZ), cefonicid (CID), cefoperazone (CFP), cefoperazone/sulbactam (CSL), ceforanide (CND), cefoselis (CSE), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotetan (CTT), cefotiam (CTF), cefotiam hexetil (CHE), cefovecin (FOV), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefozopran (ZOP), cefpimizole (CFZ), cefpiramide (CPM), cefpirome (CPO), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefprozil (CPR), cefquinome (CEQ), cefroxadine (CRD), cefsulodin (CFS), cefsumide (CSU), ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftezole (CTL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), ceftolozane/tazobactam (CZT), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), cefuroxime (CXM), cefuroxime axetil (CXA), cephradine (CED), latamoxef (LTM), and loracarbef (LOR)</p></li>
<li><p><code>cephalosporins_1st()</code> can select: <br> cefacetrile (CAC), cefadroxil (CFR), cefalexin (LEX), cefaloridine (RID), cefalotin (CEP), cefapirin (HAP), cefatrizine (CTZ), cefazedone (CZD), cefazolin (CZO), cefroxadine (CRD), ceftezole (CTL), and cephradine (CED)</p></li>
<li><p><code>cephalosporins_2nd()</code> can select: <br> cefaclor (CEC), cefamandole (MAN), cefmetazole (CMZ), cefonicid (CID), ceforanide (CND), cefotetan (CTT), cefotiam (CTF), cefoxitin (FOX), cefoxitin screening test (FOX-S), cefprozil (CPR), cefuroxime (CXM), cefuroxime axetil (CXA), and loracarbef (LOR)</p></li>
<li><p><code>cephalosporins_3rd()</code> can select: <br> cefcapene (CCP), cefcapene pivoxil (CCX), cefdinir (CDR), cefditoren (DIT), cefditoren pivoxil (DIX), cefetamet (CAT), cefetamet pivoxil (CPI), cefixime (CFM), cefmenoxime (CMX), cefodizime (DIZ), cefoperazone (CFP), cefoperazone/sulbactam (CSL), cefotaxime (CTX), cefotaxime screening test (CTX-S), cefotaxime/clavulanic acid (CTC), cefotaxime/sulbactam (CTS), cefotiam hexetil (CHE), cefovecin (FOV), cefpimizole (CFZ), cefpiramide (CPM), cefpodoxime (CPD), cefpodoxime proxetil (CPX), cefpodoxime/clavulanic acid (CDC), cefsulodin (CFS), ceftazidime (CAZ), ceftazidime/avibactam (CZA), ceftazidime/clavulanic acid (CCV), cefteram (CEM), cefteram pivoxil (CPL), ceftibuten (CTB), ceftiofur (TIO), ceftizoxime (CZX), ceftizoxime alapivoxil (CZP), ceftriaxone (CRO), ceftriaxone/beta-lactamase inhibitor (CEB), and latamoxef (LTM)</p></li>
<li><p><code>cephalosporins_4th()</code> can select: <br> cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetecol (CCL), cefoselis (CSE), cefozopran (ZOP), cefpirome (CPO), and cefquinome (CEQ)</p></li>
<li><p><code>cephalosporins_4th()</code> can select: <br> cefepime (FEP), cefepime/amikacin (CFA), cefepime/clavulanic acid (CPC), cefepime/enmetazobactam (FPE), cefepime/nacubactam (FNC), cefepime/taniborbactam (FTA), cefepime/tazobactam (FPT), cefepime/zidebactam (FPZ), cefetecol (CCL), cefoselis (CSE), cefozopran (ZOP), cefpirome (CPO), and cefquinome (CEQ)</p></li>
<li><p><code>cephalosporins_5th()</code> can select: <br> ceftaroline (CPT), ceftaroline/avibactam (CPA), ceftobiprole (BPR), ceftobiprole medocaril (CFM1), and ceftolozane/tazobactam (CZT)</p></li>
<li><p><code>fluoroquinolones()</code> can select: <br> besifloxacin (BES), ciprofloxacin (CIP), ciprofloxacin/metronidazole (CIM), ciprofloxacin/ornidazole (CIO), ciprofloxacin/tinidazole (CIT), clinafloxacin (CLX), danofloxacin (DAN), delafloxacin (DFX), difloxacin (DIF), enoxacin (ENX), enrofloxacin (ENR), finafloxacin (FIN), fleroxacin (FLE), garenoxacin (GRN), gatifloxacin (GAT), gemifloxacin (GEM), grepafloxacin (GRX), lascufloxacin (LSC), levofloxacin (LVX), levofloxacin/ornidazole (LEO), levonadifloxacin (LND), lomefloxacin (LOM), marbofloxacin (MAR), metioxate (MXT), miloxacin (MIL), moxifloxacin (MFX), nadifloxacin (NAD), nemonoxacin (NEM), nifuroquine (NIF), nitroxoline (NTR), norfloxacin (NOR), norfloxacin screening test (NOR-S), norfloxacin/metronidazole (NME), norfloxacin/tinidazole (NTI), ofloxacin (OFX), ofloxacin/ornidazole (OOR), orbifloxacin (ORB), pazufloxacin (PAZ), pefloxacin (PEF), pefloxacin screening test (PEF-S), pradofloxacin (PRA), premafloxacin (PRX), prulifloxacin (PRU), rufloxacin (RFL), sarafloxacin (SAR), sitafloxacin (SIT), sparfloxacin (SPX), temafloxacin (TMX), tilbroquinol (TBQ), tioxacin (TXC), tosufloxacin (TFX), and trovafloxacin (TVA)</p></li>
<li><p><code>glycopeptides()</code> can select: <br> avoparcin (AVO), bleomycin (BLM), dalbavancin (DAL), norvancomycin (NVA), oritavancin (ORI), ramoplanin (RAM), teicoplanin (TEC), teicoplanin-macromethod (TCM), telavancin (TLV), vancomycin (VAN), and vancomycin-macromethod (VAM)</p></li>
@@ -294,7 +294,7 @@ my_data_with_all_these_columns %&amp;gt;%
<span class="r-msg co"><span class="r-pr">#&gt;</span> <span style="color: #0000BB;"> • your_data[, carbapenems()]</span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> <span style="color: #0000BB;"> • your_data[, c("column_a", "column_b", carbapenems())]</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Class 'ab'</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] BIA DOR ETP IMR IPM MEM MEV PAN RIA RIT RZM TBP</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] BIA DOR ETP IMR IPM MEM MEV PAN RIA RIT RZM TAN TBP</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># Though they are primarily intended to use for selections and filters.</span></span></span>

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Data Sets with 616 Antimicrobial Drugs — antimicrobials • AMR (for R)</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Lato-0.4.10/font.css" rel="stylesheet"><link href="../deps/Fira_Code-0.4.10/font.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet"><script src="../extra.js"></script><meta property="og:title" content="Data Sets with 616 Antimicrobial Drugs — antimicrobials"><meta name="description" content="Two data sets containing all antimicrobials and antivirals. Use as.ab() or one of the ab_* functions to retrieve values from the antimicrobials data set. Three identifiers are included in this data set: an antimicrobial ID (ab, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (atc) as defined by the WHO, and a Compound ID (cid) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Data Sets with 618 Antimicrobial Drugs — antimicrobials • AMR (for R)</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Lato-0.4.10/font.css" rel="stylesheet"><link href="../deps/Fira_Code-0.4.10/font.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet"><script src="../extra.js"></script><meta property="og:title" content="Data Sets with 618 Antimicrobial Drugs — antimicrobials"><meta name="description" content="Two data sets containing all antimicrobials and antivirals. Use as.ab() or one of the ab_* functions to retrieve values from the antimicrobials data set. Three identifiers are included in this data set: an antimicrobial ID (ab, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (atc) as defined by the WHO, and a Compound ID (cid) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
The antibiotics data set has been renamed to antimicrobials. The old name will be removed in a future version."><meta property="og:description" content="Two data sets containing all antimicrobials and antivirals. Use as.ab() or one of the ab_* functions to retrieve values from the antimicrobials data set. Three identifiers are included in this data set: an antimicrobial ID (ab, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (atc) as defined by the WHO, and a Compound ID (cid) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
The antibiotics data set has been renamed to antimicrobials. The old name will be removed in a future version."><meta property="og:image" content="https://amr-for-r.org/logo.svg"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous"><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@@ -9,7 +9,7 @@ The antibiotics data set has been renamed to antimicrobials. The old name will b
<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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -46,7 +46,7 @@ The antibiotics data set has been renamed to antimicrobials. The old name will b
</nav><div class="container template-reference-topic">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.svg" class="logo" alt=""><h1>Data Sets with 616 Antimicrobial Drugs</h1>
<img src="../logo.svg" class="logo" alt=""><h1>Data Sets with 618 Antimicrobial Drugs</h1>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/main/R/data.R" class="external-link"><code>R/data.R</code></a></small>
<div class="d-none name"><code>antimicrobials.Rd</code></div>
</div>
@@ -69,7 +69,7 @@ The antibiotics data set has been renamed to antimicrobials. The old name will b
<h2 id="format">Format<a class="anchor" aria-label="anchor" href="#format"></a></h2>
<div class="section">
<h3 id="for-the-antimicrobials-data-set-a-tibble-with-observations-and-variables-">For the antimicrobials data set: a <a href="https://tibble.tidyverse.org/reference/tibble.html" class="external-link">tibble</a> with 496 observations and 14 variables:<a class="anchor" aria-label="anchor" href="#for-the-antimicrobials-data-set-a-tibble-with-observations-and-variables-"></a></h3>
<h3 id="for-the-antimicrobials-data-set-a-tibble-with-observations-and-variables-">For the antimicrobials data set: a <a href="https://tibble.tidyverse.org/reference/tibble.html" class="external-link">tibble</a> with 498 observations and 14 variables:<a class="anchor" aria-label="anchor" href="#for-the-antimicrobials-data-set-a-tibble-with-observations-and-variables-"></a></h3>
<ul><li><p><code>ab</code><br> antimicrobial ID as used in this package (such as <code>AMC</code>), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. <em><strong>This is a unique identifier.</strong></em></p></li>
<li><p><code>cid</code><br> Compound ID as found in PubChem. <em><strong>This is a unique identifier.</strong></em></p></li>
@@ -103,7 +103,7 @@ The antibiotics data set has been renamed to antimicrobials. The old name will b
<li><p><code>loinc</code><br> All codes associated with the name of the antiviral drug from Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023). Use <code><a href="av_property.html">av_loinc()</a></code> to retrieve them quickly, see <code><a href="av_property.html">av_property()</a></code>.</p></li>
</ul></div>
<p>An object of class <code>deprecated_amr_dataset</code> (inherits from <code>tbl_df</code>, <code>tbl</code>, <code>data.frame</code>) with 496 rows and 14 columns.</p>
<p>An object of class <code>deprecated_amr_dataset</code> (inherits from <code>tbl_df</code>, <code>tbl</code>, <code>data.frame</code>) with 498 rows and 14 columns.</p>
<p>An object of class <code>tbl_df</code> (inherits from <code>tbl</code>, <code>data.frame</code>) with 120 rows and 11 columns.</p>
</div>
<div class="section level2">
@@ -145,7 +145,7 @@ The antibiotics data set has been renamed to antimicrobials. The old name will b
<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="va">antimicrobials</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 496 × 14</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 498 × 14</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> ab cid name group atc atc_group1 atc_group2 abbreviations synonyms</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494; font-style: italic;">&lt;ab&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;lis&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;list&gt;</span> <span style="color: #949494; font-style: italic;">&lt;named &gt;</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 1</span> AMA <span style="text-decoration: underline;">4</span>649 4-ami… Anti… <span style="color: #949494;">&lt;chr&gt;</span> Drugs for… Aminosali… <span style="color: #949494;">&lt;chr [1]&gt;</span> <span style="color: #949494;">&lt;chr&gt;</span> </span>
@@ -158,7 +158,7 @@ The antibiotics data set has been renamed to antimicrobials. The old name will b
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 8</span> AMX <span style="text-decoration: underline;">33</span>613 Amoxi… Beta… <span style="color: #949494;">&lt;chr&gt;</span> Beta-lact… Penicilli… <span style="color: #949494;">&lt;chr [4]&gt;</span> <span style="color: #949494;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;"> 9</span> AMC 23<span style="text-decoration: underline;">665</span>637 Amoxi… Beta… <span style="color: #949494;">&lt;chr&gt;</span> Beta-lact… Combinati… <span style="color: #949494;">&lt;chr [6]&gt;</span> <span style="color: #949494;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">10</span> AXS <span style="text-decoration: underline;">465</span>441 Amoxi… Beta… <span style="color: #949494;">&lt;chr&gt;</span> <span style="color: #BB0000;">NA</span> <span style="color: #BB0000;">NA</span> <span style="color: #949494;">&lt;chr [1]&gt;</span> <span style="color: #949494;">&lt;chr&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 486 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 488 more rows</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 5 more variables: oral_ddd &lt;dbl&gt;, oral_units &lt;chr&gt;, iv_ddd &lt;dbl&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># iv_units &lt;chr&gt;, loinc &lt;list&gt;</span></span>
<span class="r-in"><span><span class="va">antivirals</span></span></span>

253
reference/antimicrobials.md Normal file
View File

@@ -0,0 +1,253 @@
# Data Sets with 618 Antimicrobial Drugs
Two data sets containing all antimicrobials and antivirals. Use
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md) or one of the
[`ab_*`](https://amr-for-r.org/reference/ab_property.md) functions to
retrieve values from the antimicrobials data set. Three identifiers are
included in this data set: an antimicrobial ID (`ab`, primarily used in
this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as
defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other
properties in this data set are derived from one or more of these codes.
Note that some drugs have multiple ATC codes.
**The `antibiotics` data set has been renamed to `antimicrobials`. The
old name will be removed in a future version.**
## Usage
``` r
antimicrobials
antibiotics
antivirals
```
## Format
### For the antimicrobials data set: a [tibble](https://tibble.tidyverse.org/reference/tibble.html) with 498 observations and 14 variables:
- `ab`
antimicrobial ID as used in this package (such as `AMC`), using the
official EARS-Net (European Antimicrobial Resistance Surveillance
Network) codes where available. ***This is a unique identifier.***
- `cid`
Compound ID as found in PubChem. ***This is a unique identifier.***
- `name`
Official name as used by WHONET/EARS-Net or the WHO. ***This is a
unique identifier.***
- `group`
A short and concise group name, based on WHONET and WHOCC definitions
- `atc`
ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC,
like `J01CR02` (last updated May 4th, 2025):
- `atc_group1`
Official pharmacological subgroup (3rd level ATC code) as defined by
the WHOCC, like `"Macrolides, lincosamides and streptogramins"`
- `atc_group2`
Official chemical subgroup (4th level ATC code) as defined by the
WHOCC, like `"Macrolides"`
- `abbr`
List of abbreviations as used in many countries, also for
antimicrobial susceptibility testing (AST)
- `synonyms`
Synonyms (often trade names) of a drug, as found in PubChem based on
their compound ID
ATC properties (last updated May 4th, 2025):
- `oral_ddd`
Defined Daily Dose (DDD), oral treatment, currently available for 180
drugs
- `oral_units`
Units of `oral_ddd`
- `iv_ddd`
Defined Daily Dose (DDD), parenteral (intravenous) treatment,
currently available for 153 drugs
- `iv_units`
Units of `iv_ddd`
LOINC:
- `loinc`
All codes associated with the name of the antimicrobial drug from
Logical Observation Identifiers Names and Codes (LOINC), Version 2.76
(18 September, 2023). Use
[`ab_loinc()`](https://amr-for-r.org/reference/ab_property.md) to
retrieve them quickly, see
[`ab_property()`](https://amr-for-r.org/reference/ab_property.md).
### For the antivirals data set: a [tibble](https://tibble.tidyverse.org/reference/tibble.html) with 120 observations and 11 variables:
- `av`
Antiviral ID as used in this package (such as `ACI`), using the
official EARS-Net (European Antimicrobial Resistance Surveillance
Network) codes where available. ***This is a unique identifier.***
Combinations are codes that contain a `+` to indicate this, such as
`ATA+COBI` for atazanavir/cobicistat.
- `name`
Official name as used by WHONET/EARS-Net or the WHO. ***This is a
unique identifier.***
- `atc`
ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC,
see *Details*
- `cid`
Compound ID as found in PubChem. ***This is a unique identifier.***
- `atc_group`
Official pharmacological subgroup (3rd level ATC code) as defined by
the WHOCC
- `synonyms`
Synonyms (often trade names) of a drug, as found in PubChem based on
their compound ID
- `oral_ddd`
Defined Daily Dose (DDD), oral treatment
- `oral_units`
Units of `oral_ddd`
- `iv_ddd`
Defined Daily Dose (DDD), parenteral treatment
- `iv_units`
Units of `iv_ddd`
- `loinc`
All codes associated with the name of the antiviral drug from Logical
Observation Identifiers Names and Codes (LOINC), Version 2.76 (18
September, 2023). Use
[`av_loinc()`](https://amr-for-r.org/reference/av_property.md) to
retrieve them quickly, see
[`av_property()`](https://amr-for-r.org/reference/av_property.md).
An object of class `deprecated_amr_dataset` (inherits from `tbl_df`,
`tbl`, `data.frame`) with 498 rows and 14 columns.
An object of class `tbl_df` (inherits from `tbl`, `data.frame`) with 120
rows and 11 columns.
## Source
- WHO Collaborating Centre for Drug Statistics Methodology, Guidelines
for ATC classification and DDD assignment, Oslo Accessed from
<https://atcddd.fhi.no/atc_ddd_index/> on May 4th, 2025.
- Logical Observation Identifiers Names and Codes (LOINC), Version 2.76
(18 September, 2023). Accessed from <https://loinc.org> on October
19th, 2023.
- European Commission Public Health PHARMACEUTICALS - COMMUNITY
REGISTER:
<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
## Details
Properties that are based on an ATC code are only available when an ATC
is available. These properties are: `atc_group1`, `atc_group2`,
`oral_ddd`, `oral_units`, `iv_ddd` and `iv_units`. Do note that ATC
codes are not unique. For example, J01CR02 is officially the ATC code
for "amoxicillin and beta-lactamase inhibitor". Consequently, these two
items from the antimicrobials data set both return `"J01CR02"`:
ab_atc("amoxicillin/clavulanic acid")
ab_atc("amoxicillin/sulbactam")
Synonyms (i.e. trade names) were derived from the PubChem Compound ID
(column `cid`) and are consequently only available where a CID is
available.
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## WHOCC
This package contains **all ~550 antibiotic, antimycotic and antiviral
drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC
groups and Defined Daily Dose (DDD) from the World Health Organization
Collaborating Centre for Drug Statistics Methodology (WHOCC,
<https://atcddd.fhi.no>) and the Pharmaceuticals Community Register of
the European Commission
(<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>).
These have become the gold standard for international drug utilisation
monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health
and funded by the Norwegian government. The European Commission is the
executive of the European Union and promotes its general interest.
**NOTE: The WHOCC copyright does not allow use for commercial purposes,
unlike any other info from this package.** See
<https://atcddd.fhi.no/copyright_disclaimer/.>
## See also
[microorganisms](https://amr-for-r.org/reference/microorganisms.md),
[intrinsic_resistant](https://amr-for-r.org/reference/intrinsic_resistant.md)
## Examples
``` r
antimicrobials
#> # A tibble: 498 × 14
#> ab cid name group atc atc_group1 atc_group2 abbreviations synonyms
#> <ab> <dbl> <chr> <chr> <lis> <chr> <chr> <list> <named >
#> 1 AMA 4649 4-ami… Anti… <chr> Drugs for… Aminosali… <chr [1]> <chr>
#> 2 ACM 6450012 Acety… Macr… <chr> NA NA <chr [1]> <chr>
#> 3 ASP 49787020 Acety… Macr… <chr> NA NA <chr [1]> <chr>
#> 4 ALS 8954 Aldes… Othe… <chr> Drugs for… Drugs for… <chr [1]> <chr>
#> 5 AMK 37768 Amika… Amin… <chr> Aminoglyc… Other ami… <chr [6]> <chr>
#> 6 AKF NA Amika… Amin… <chr> NA NA <chr [1]> <chr>
#> 7 AMO 54260 Amoro… Anti… <chr> Antifunga… Other ant… <chr [1]> <chr>
#> 8 AMX 33613 Amoxi… Beta… <chr> Beta-lact… Penicilli… <chr [4]> <chr>
#> 9 AMC 23665637 Amoxi… Beta… <chr> Beta-lact… Combinati… <chr [6]> <chr>
#> 10 AXS 465441 Amoxi… Beta… <chr> NA NA <chr [1]> <chr>
#> # 488 more rows
#> # 5 more variables: oral_ddd <dbl>, oral_units <chr>, iv_ddd <dbl>,
#> # iv_units <chr>, loinc <list>
antivirals
#> # A tibble: 120 × 11
#> av name atc cid atc_group synonyms oral_ddd oral_units iv_ddd
#> <av> <chr> <chr> <dbl> <chr> <list> <dbl> <chr> <dbl>
#> 1 ABA Abacavir J05A… 4.41e5 Nucleosi… <chr> 0.6 g NA
#> 2 ACI Aciclovir J05A… 1.35e8 Nucleosi… <chr> 4 g 4
#> 3 ADD Adefovir… J05A… 6.09e4 Nucleosi… <chr> 10 mg NA
#> 4 AME Amenamev… J05A… 1.14e7 Other an… <chr> 0.4 g NA
#> 5 AMP Amprenav… J05A… 6.50e4 Protease… <chr> 1.2 g NA
#> 6 ASU Asunapre… J05A… 1.61e7 Antivira… <chr> 0.2 g NA
#> 7 ATA Atazanav… J05A… 1.48e5 Protease… <chr> 0.3 g NA
#> 8 ATA+COBI Atazanav… J05A… 8.66e7 Antivira… <chr> NA NA NA
#> 9 ATA+RIT Atazanav… J05A… 2.51e7 Antivira… <chr> 0.3 g NA
#> 10 BAM Baloxavi… J05A… 1.24e8 Other an… <chr> 40 mg NA
#> # 110 more rows
#> # 2 more variables: iv_units <chr>, loinc <list>
```

View File

@@ -7,7 +7,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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
reference/as.ab.md Normal file
View File

@@ -0,0 +1,222 @@
# Transform Input to an Antibiotic ID
Use this function to determine the antimicrobial drug code of one or
more antimicrobials. The data set
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md) will
be searched for abbreviations, official names and synonyms (brand
names).
## Usage
``` r
as.ab(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
info = interactive(), ...)
is.ab(x)
ab_reset_session()
```
## Arguments
- x:
A [character](https://rdrr.io/r/base/character.html) vector to
determine to antibiotic ID.
- flag_multiple_results:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
note should be printed to the console that probably more than one
antibiotic drug code or name can be retrieved from a single input
value.
- language:
Language to coerce input values from any of the 28 supported
languages - default to the system language if supported (see
[`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md)).
- info:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
progress bar should be printed - the default is `TRUE` only in
interactive mode.
- ...:
Arguments passed on to internal functions.
## Value
A [character](https://rdrr.io/r/base/character.html)
[vector](https://rdrr.io/r/base/vector.html) with additional class `ab`
## Details
All entries in the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md) data
set have three different identifiers: a human readable EARS-Net code
(column `ab`, used by ECDC and WHONET), an ATC code (column `atc`, used
by WHO), and a CID code (column `cid`, Compound ID, used by PubChem).
The data set contains more than 5,000 official brand names from many
different countries, as found in PubChem. Not that some drugs contain
multiple ATC codes.
All these properties will be searched for the user input. The `as.ab()`
can correct for different forms of misspelling:
- Wrong spelling of drug names (such as "tobramicin" or "gentamycin"),
which corrects for most audible similarities such as f/ph, x/ks,
c/z/s, t/th, etc.
- Too few or too many vowels or consonants
- Switching two characters (such as "mreopenem", often the case in
clinical data, when doctors typed too fast)
- Digitalised paper records, leaving artefacts like 0/o/O (zero and
O's), B/8, n/r, etc.
Use the [`ab_*`](https://amr-for-r.org/reference/ab_property.md)
functions to get properties based on the returned antibiotic ID, see
*Examples*.
Note: the `as.ab()` and
[`ab_*`](https://amr-for-r.org/reference/ab_property.md) functions may
use very long regular expression to match brand names of antimicrobial
drugs. This may fail on some systems.
You can add your own manual codes to be considered by `as.ab()` and all
[`ab_*`](https://amr-for-r.org/reference/ab_property.md) functions, see
[`add_custom_antimicrobials()`](https://amr-for-r.org/reference/add_custom_antimicrobials.md).
## Source
World Health Organization (WHO) Collaborating Centre for Drug Statistics
Methodology: <https://atcddd.fhi.no/atc_ddd_index/>
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER:
<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
## WHOCC
This package contains **all ~550 antibiotic, antimycotic and antiviral
drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC
groups and Defined Daily Dose (DDD) from the World Health Organization
Collaborating Centre for Drug Statistics Methodology (WHOCC,
<https://atcddd.fhi.no>) and the Pharmaceuticals Community Register of
the European Commission
(<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>).
These have become the gold standard for international drug utilisation
monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health
and funded by the Norwegian government. The European Commission is the
executive of the European Union and promotes its general interest.
**NOTE: The WHOCC copyright does not allow use for commercial purposes,
unlike any other info from this package.** See
<https://atcddd.fhi.no/copyright_disclaimer/.>
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
- [antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
for the [data.frame](https://rdrr.io/r/base/data.frame.html) that is
being used to determine ATCs
- [`ab_from_text()`](https://amr-for-r.org/reference/ab_from_text.md)
for a function to retrieve antimicrobial drugs from clinical text
(from health care records)
## Examples
``` r
# these examples all return "ERY", the ID of erythromycin:
as.ab("J01FA01")
#> Class 'ab'
#> [1] ERY
as.ab("J 01 FA 01")
#> Class 'ab'
#> [1] ERY
as.ab("Erythromycin")
#> Class 'ab'
#> [1] ERY
as.ab("eryt")
#> Class 'ab'
#> [1] ERY
as.ab("ERYT")
#> Class 'ab'
#> [1] ERY
as.ab("ERY")
#> Class 'ab'
#> [1] ERY
as.ab("eritromicine") # spelled wrong, yet works
#> Class 'ab'
#> [1] ERY
as.ab("Erythrocin") # trade name
#> Class 'ab'
#> [1] ERY
# spelling from different languages and dyslexia are no problem
ab_atc("ceftriaxon")
#> [1] "J01DD04" "QJ01DD04"
ab_atc("cephtriaxone") # small spelling error
#> [1] "J01DD04" "QJ01DD04"
ab_atc("cephthriaxone") # or a bit more severe
#> [1] "J01DD04" "QJ01DD04"
ab_atc("seephthriaaksone") # and even this works
#> [1] "J01DD04" "QJ01DD04"
# use ab_* functions to get a specific properties (see ?ab_property);
# they use as.ab() internally:
ab_name("J01FA01")
#> [1] "Erythromycin"
ab_name("eryt")
#> [1] "Erythromycin"
# \donttest{
if (require("dplyr")) {
# you can quickly rename 'sir' columns using set_ab_names() with dplyr:
example_isolates %>%
set_ab_names(where(is.sir), property = "atc")
}
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo J01CE01 J01CF04 J01CF05
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S
#> # 1,990 more rows
#> # 37 more variables: J01CA04 <sir>, J01CR02 <sir>, J01CA01 <sir>,
#> # J01CR05 <sir>, J01DB04 <sir>, J01DE01 <sir>, J01DC02 <sir>, J01DC01 <sir>,
#> # J01DD01 <sir>, J01DD02 <sir>, J01DD04 <sir>, J01GB03 <sir>, J01GB01 <sir>,
#> # J01GB06 <sir>, J01GB04 <sir>, J01EA01 <sir>, J01EE01 <sir>, J01XE01 <sir>,
#> # J01XX01 <sir>, J01XX08 <sir>, J01MA02 <sir>, J01MA14 <sir>, J01XA01 <sir>,
#> # J01XA02 <sir>, J01AA07 <sir>, J01AA12 <sir>, J01AA02 <sir>, …
# }
```

View File

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

177
reference/as.av.md Normal file
View File

@@ -0,0 +1,177 @@
# Transform Input to an Antiviral Drug ID
Use this function to determine the antiviral drug code of one or more
antiviral drugs. The data set
[antivirals](https://amr-for-r.org/reference/antimicrobials.md) will be
searched for abbreviations, official names and synonyms (brand names).
## Usage
``` r
as.av(x, flag_multiple_results = TRUE, info = interactive(), ...)
is.av(x)
```
## Arguments
- x:
A [character](https://rdrr.io/r/base/character.html) vector to
determine to antiviral drug ID.
- flag_multiple_results:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
note should be printed to the console that probably more than one
antiviral drug code or name can be retrieved from a single input
value.
- info:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
progress bar should be printed - the default is `TRUE` only in
interactive mode.
- ...:
Arguments passed on to internal functions.
## Value
A [character](https://rdrr.io/r/base/character.html)
[vector](https://rdrr.io/r/base/vector.html) with additional class
[`ab`](https://amr-for-r.org/reference/as.ab.md)
## Details
All entries in the
[antivirals](https://amr-for-r.org/reference/antimicrobials.md) data set
have three different identifiers: a human readable EARS-Net code (column
`ab`, used by ECDC and WHONET), an ATC code (column `atc`, used by WHO),
and a CID code (column `cid`, Compound ID, used by PubChem). The data
set contains more than 5,000 official brand names from many different
countries, as found in PubChem. Not that some drugs contain multiple ATC
codes.
All these properties will be searched for the user input. The `as.av()`
can correct for different forms of misspelling:
- Wrong spelling of drug names (such as "acyclovir"), which corrects for
most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc.
- Too few or too many vowels or consonants
- Switching two characters (such as "aycclovir", often the case in
clinical data, when doctors typed too fast)
- Digitalised paper records, leaving artefacts like 0/o/O (zero and
O's), B/8, n/r, etc.
Use the [`av_*`](https://amr-for-r.org/reference/av_property.md)
functions to get properties based on the returned antiviral drug ID, see
*Examples*.
Note: the `as.av()` and
[`av_*`](https://amr-for-r.org/reference/av_property.md) functions may
use very long regular expression to match brand names of antimicrobial
drugs. This may fail on some systems.
## Source
World Health Organization (WHO) Collaborating Centre for Drug Statistics
Methodology: <https://atcddd.fhi.no/atc_ddd_index/>
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER:
<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
## WHOCC
This package contains **all ~550 antibiotic, antimycotic and antiviral
drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC
groups and Defined Daily Dose (DDD) from the World Health Organization
Collaborating Centre for Drug Statistics Methodology (WHOCC,
<https://atcddd.fhi.no>) and the Pharmaceuticals Community Register of
the European Commission
(<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>).
These have become the gold standard for international drug utilisation
monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health
and funded by the Norwegian government. The European Commission is the
executive of the European Union and promotes its general interest.
**NOTE: The WHOCC copyright does not allow use for commercial purposes,
unlike any other info from this package.** See
<https://atcddd.fhi.no/copyright_disclaimer/.>
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
- [antivirals](https://amr-for-r.org/reference/antimicrobials.md) for
the [data.frame](https://rdrr.io/r/base/data.frame.html) that is being
used to determine ATCs
- [`av_from_text()`](https://amr-for-r.org/reference/av_from_text.md)
for a function to retrieve antimicrobial drugs from clinical text
(from health care records)
## Examples
``` r
# these examples all return "ACI", the ID of aciclovir:
as.av("J05AB01")
#> Class 'av'
#> [1] ACI
as.av("J 05 AB 01")
#> Class 'av'
#> [1] ACI
as.av("Aciclovir")
#> Class 'av'
#> [1] ACI
as.av("aciclo")
#> Class 'av'
#> [1] ACI
as.av(" aciclo 123")
#> Class 'av'
#> [1] ACI
as.av("ACICL")
#> Class 'av'
#> [1] ACI
as.av("ACI")
#> Class 'av'
#> [1] ACI
as.av("Virorax") # trade name
#> Class 'av'
#> [1] ACI
as.av("Zovirax") # trade name
#> Class 'av'
#> [1] ACI
as.av("acyklofir") # severe spelling error, yet works
#> Class 'av'
#> [1] ACI
# use av_* functions to get a specific properties (see ?av_property);
# they use as.av() internally:
av_name("J05AB01")
#> [1] "Aciclovir"
av_name("acicl")
#> [1] "Aciclovir"
```

View File

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

96
reference/as.disk.md Normal file
View File

@@ -0,0 +1,96 @@
# Transform Input to Disk Diffusion Diameters
This transforms a vector to a new class `disk`, which is a disk
diffusion growth zone size (around an antibiotic disk) in millimetres
between 0 and 50.
## Usage
``` r
as.disk(x, na.rm = FALSE)
NA_disk_
is.disk(x)
```
## Format
An object of class `disk` (inherits from `integer`) of length 1.
## Arguments
- x:
Vector.
- na.rm:
A [logical](https://rdrr.io/r/base/logical.html) indicating whether
missing values should be removed.
## Value
An [integer](https://rdrr.io/r/base/integer.html) with additional class
`disk`
## Details
Interpret disk values as SIR values with
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md). It supports
guidelines from EUCAST and CLSI.
Disk diffusion growth zone sizes must be between 0 and 50 millimetres.
Values higher than 50 but lower than 100 will be maximised to 50. All
others input values outside the 0-50 range will return `NA`.
`NA_disk_` is a missing value of the new `disk` class.
## See also
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
## Examples
``` r
# transform existing disk zones to the `disk` class (using base R)
df <- data.frame(
microorganism = "Escherichia coli",
AMP = 20,
CIP = 14,
GEN = 18,
TOB = 16
)
df[, 2:5] <- lapply(df[, 2:5], as.disk)
str(df)
#> 'data.frame': 1 obs. of 5 variables:
#> $ microorganism: chr "Escherichia coli"
#> $ AMP : 'disk' int 20
#> $ CIP : 'disk' int 14
#> $ GEN : 'disk' int 18
#> $ TOB : 'disk' int 16
# \donttest{
# transforming is easier with dplyr:
if (require("dplyr")) {
df %>% mutate(across(AMP:TOB, as.disk))
}
#> microorganism AMP CIP GEN TOB
#> 1 Escherichia coli 20 14 18 16
# }
# interpret disk values, see ?as.sir
as.sir(
x = as.disk(18),
mo = "Strep pneu", # `mo` will be coerced with as.mo()
ab = "ampicillin", # and `ab` with as.ab()
guideline = "EUCAST"
)
#> Class 'sir'
#> [1] R
# interpret whole data set, pretend to be all from urinary tract infections:
as.sir(df, uti = TRUE)
#> microorganism AMP CIP GEN TOB
#> 1 Escherichia coli S <NA> S S
```

View File

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

232
reference/as.mic.md Normal file
View File

@@ -0,0 +1,232 @@
# Transform Input to Minimum Inhibitory Concentrations (MIC)
This transforms vectors to a new class `mic`, which treats the input as
decimal numbers, while maintaining operators (such as "\>=") and only
allowing valid MIC values known to the field of (medical) microbiology.
## Usage
``` r
as.mic(x, na.rm = FALSE, keep_operators = "all")
is.mic(x)
NA_mic_
rescale_mic(x, mic_range, keep_operators = "edges", as.mic = TRUE)
mic_p50(x, na.rm = FALSE, ...)
mic_p90(x, na.rm = FALSE, ...)
# S3 method for class 'mic'
droplevels(x, as.mic = FALSE, ...)
```
## Arguments
- x:
A [character](https://rdrr.io/r/base/character.html) or
[numeric](https://rdrr.io/r/base/numeric.html) vector.
- na.rm:
A [logical](https://rdrr.io/r/base/logical.html) indicating whether
missing values should be removed.
- keep_operators:
A [character](https://rdrr.io/r/base/character.html) specifying how to
handle operators (such as `>` and `<=`) in the input. Accepts one of
three values: `"all"` (or `TRUE`) to keep all operators, `"none"` (or
`FALSE`) to remove all operators, or `"edges"` to keep operators only
at both ends of the range.
- mic_range:
A manual range to rescale the MIC values, e.g.,
`mic_range = c(0.001, 32)`. Use `NA` to prevent rescaling on one side,
e.g., `mic_range = c(NA, 32)`.
- as.mic:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the `mic` class should be kept - the default is `TRUE` for
`rescale_mic()` and `FALSE` for
[`droplevels()`](https://rdatatable.gitlab.io/data.table/reference/fdroplevels.html).
When setting this to `FALSE` in `rescale_mic()`, the output will have
factor levels that acknowledge `mic_range`.
- ...:
Arguments passed on to methods.
## Value
Ordered [factor](https://rdrr.io/r/base/factor.html) with additional
class `mic`, that in mathematical operations acts as a
[numeric](https://rdrr.io/r/base/numeric.html) vector. Bear in mind that
the outcome of any mathematical operation on MICs will return a
[numeric](https://rdrr.io/r/base/numeric.html) value.
## Details
To interpret MIC values as SIR values, use
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md) on MIC values.
It supports guidelines from EUCAST (2011-2025) and CLSI (2011-2025).
This class for MIC values is a quite a special data type: formally it is
an ordered [factor](https://rdrr.io/r/base/factor.html) with valid MIC
values as [factor](https://rdrr.io/r/base/factor.html) levels (to make
sure only valid MIC values are retained), but for any mathematical
operation it acts as decimal numbers:
x <- random_mic(10)
x
#> Class 'mic'
#> [1] 16 1 8 8 64 >=128 0.0625 32 32 16
is.factor(x)
#> [1] TRUE
x[1] * 2
#> [1] 32
median(x)
#> [1] 26
This makes it possible to maintain operators that often come with MIC
values, such "\>=" and "\<=", even when filtering using
[numeric](https://rdrr.io/r/base/numeric.html) values in data analysis,
e.g.:
x[x > 4]
#> Class 'mic'
#> [1] 16 8 8 64 >=128 32 32 16
df <- data.frame(x, hospital = "A")
subset(df, x > 4) # or with dplyr: df %>% filter(x > 4)
#> x hospital
#> 1 16 A
#> 5 64 A
#> 6 >=128 A
#> 8 32 A
#> 9 32 A
#> 10 16 A
All so-called [group generic
functions](https://rdrr.io/r/base/groupGeneric.html) are implemented for
the MIC class (such as `!`, `!=`, `<`, `>=`,
[`exp()`](https://rdrr.io/r/base/Log.html),
[`log2()`](https://rdrr.io/r/base/Log.html)). Some mathematical
functions are also implemented (such as
[`quantile()`](https://rdrr.io/r/stats/quantile.html),
[`median()`](https://rdrr.io/r/stats/median.html),
[`fivenum()`](https://rdrr.io/r/stats/fivenum.html)). Since
[`sd()`](https://rdrr.io/r/stats/sd.html) and
[`var()`](https://rdrr.io/r/stats/cor.html) are non-generic functions,
these could not be extended. Use
[`mad()`](https://rdrr.io/r/stats/mad.html) as an alternative, or use
e.g. `sd(as.numeric(x))` where `x` is your vector of MIC values.
Using [`as.double()`](https://rdrr.io/r/base/double.html) or
[`as.numeric()`](https://rdrr.io/r/base/numeric.html) on MIC values will
remove the operators and return a numeric vector. Do **not** use
[`as.integer()`](https://rdrr.io/r/base/integer.html) on MIC values as
by the R convention on [factor](https://rdrr.io/r/base/factor.html)s, it
will return the index of the factor levels (which is often useless for
regular users).
The function `is.mic()` detects if the input contains class `mic`. If
the input is a [data.frame](https://rdrr.io/r/base/data.frame.html) or
[list](https://rdrr.io/r/base/list.html), it iterates over all
columns/items and returns a
[logical](https://rdrr.io/r/base/logical.html) vector.
Use
[`droplevels()`](https://rdatatable.gitlab.io/data.table/reference/fdroplevels.html)
to drop unused levels. At default, it will return a plain factor. Use
`droplevels(..., as.mic = TRUE)` to maintain the `mic` class.
With `rescale_mic()`, existing MIC ranges can be limited to a defined
range of MIC values. This can be useful to better compare MIC
distributions.
For `ggplot2`, use one of the
[`scale_*_mic()`](https://amr-for-r.org/reference/plot.md) functions to
plot MIC values. They allows custom MIC ranges and to plot intermediate
log2 levels for missing MIC values.
`NA_mic_` is a missing value of the new `mic` class, analogous to e.g.
base R's [`NA_character_`](https://rdrr.io/r/base/NA.html).
Use `mic_p50()` and `mic_p90()` to get the 50th and 90th percentile of
MIC values. They return 'normal'
[numeric](https://rdrr.io/r/base/numeric.html) values.
## See also
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
## Examples
``` r
mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
mic_data
#> Class 'mic'
#> [1] >=32 1 1 1 8 <=0.128 8 16 16
is.mic(mic_data)
#> [1] TRUE
# this can also coerce combined MIC/SIR values:
as.mic("<=0.002; S")
#> Class 'mic'
#> [1] <=0.002
# mathematical processing treats MICs as numeric values
fivenum(mic_data)
#> [1] 0.128 1.000 8.000 16.000 32.000
quantile(mic_data)
#> 0% 25% 50% 75% 100%
#> 0.128 1.000 8.000 16.000 32.000
all(mic_data < 512)
#> [1] TRUE
# rescale MICs using rescale_mic()
rescale_mic(mic_data, mic_range = c(4, 16))
#> Class 'mic'
#> [1] >=16 <=4 <=4 <=4 8 <=4 8 >=16 >=16
# interpret MIC values
as.sir(
x = as.mic(2),
mo = as.mo("Streptococcus pneumoniae"),
ab = "AMX",
guideline = "EUCAST"
)
#> Class 'sir'
#> [1] R
as.sir(
x = as.mic(c(0.01, 2, 4, 8)),
mo = as.mo("Streptococcus pneumoniae"),
ab = "AMX",
guideline = "EUCAST"
)
#> Class 'sir'
#> [1] S R R R
# plot MIC values, see ?plot
plot(mic_data)
plot(mic_data, mo = "E. coli", ab = "cipro")
if (require("ggplot2")) {
autoplot(mic_data, mo = "E. coli", ab = "cipro")
}
if (require("ggplot2")) {
autoplot(mic_data, mo = "E. coli", ab = "cipro", language = "nl") # Dutch
}
```

View File

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

599
reference/as.mo.md Normal file
View File

@@ -0,0 +1,599 @@
# Transform Arbitrary Input to Valid Microbial Taxonomy
Use this function to get a valid microorganism code (`mo`) based on
arbitrary user input. Determination is done using intelligent rules and
the complete taxonomic tree of the kingdoms Animalia, Archaea, Bacteria,
Chromista, and Protozoa, and most microbial species from the kingdom
Fungi (see *Source*). The input can be almost anything: a full name
(like `"Staphylococcus aureus"`), an abbreviated name (such as
`"S. aureus"`), an abbreviation known in the field (such as `"MRSA"`),
or just a genus. See *Examples*.
## Usage
``` r
as.mo(x, Becker = FALSE, Lancefield = FALSE,
minimum_matching_score = NULL,
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
reference_df = get_mo_source(),
ignore_pattern = getOption("AMR_ignore_pattern", NULL),
cleaning_regex = getOption("AMR_cleaning_regex", mo_cleaning_regex()),
only_fungi = getOption("AMR_only_fungi", FALSE),
language = get_AMR_locale(), info = interactive(), ...)
is.mo(x)
mo_uncertainties()
mo_renamed()
mo_failures()
mo_reset_session()
mo_cleaning_regex()
```
## Arguments
- x:
A [character](https://rdrr.io/r/base/character.html) vector or a
[data.frame](https://rdrr.io/r/base/data.frame.html) with one or two
columns.
- Becker:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
staphylococci should be categorised into coagulase-negative
staphylococci ("CoNS") and coagulase-positive staphylococci ("CoPS")
instead of their own species, according to Karsten Becker *et al.*
(see *Source*). Please see *Details* for a full list of staphylococcal
species that will be converted.
This excludes *Staphylococcus aureus* at default, use `Becker = "all"`
to also categorise *S. aureus* as "CoPS".
- Lancefield:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
beta-haemolytic *Streptococcus* should be categorised into Lancefield
groups instead of their own species, according to Rebecca C.
Lancefield (see *Source*). These streptococci will be categorised in
their first group, e.g. *Streptococcus dysgalactiae* will be group C,
although officially it was also categorised into groups G and L. .
Please see *Details* for a full list of streptococcal species that
will be converted.
This excludes enterococci at default (who are in group D), use
`Lancefield = "all"` to also categorise all enterococci as group D.
- minimum_matching_score:
A numeric value to set as the lower limit for the [MO matching
score](https://amr-for-r.org/reference/mo_matching_score.md). When
left blank, this will be determined automatically based on the
character length of `x`, its [taxonomic
kingdom](https://amr-for-r.org/reference/microorganisms.md) and [human
pathogenicity](https://amr-for-r.org/reference/mo_matching_score.md).
- keep_synonyms:
A [logical](https://rdrr.io/r/base/logical.html) to indicate if old,
previously valid taxonomic names must be preserved and not be
corrected to currently accepted names. The default is `FALSE`, which
will return a note if old taxonomic names were processed. The default
can be set with the package option
[`AMR_keep_synonyms`](https://amr-for-r.org/reference/AMR-options.md),
i.e. `options(AMR_keep_synonyms = TRUE)` or
`options(AMR_keep_synonyms = FALSE)`.
- reference_df:
A [data.frame](https://rdrr.io/r/base/data.frame.html) to be used for
extra reference when translating `x` to a valid `mo`. See
[`set_mo_source()`](https://amr-for-r.org/reference/mo_source.md) and
[`get_mo_source()`](https://amr-for-r.org/reference/mo_source.md) to
automate the usage of your own codes (e.g. used in your analysis or
organisation).
- ignore_pattern:
A Perl-compatible [regular
expression](https://rdrr.io/r/base/regex.html) (case-insensitive) of
which all matches in `x` must return `NA`. This can be convenient to
exclude known non-relevant input and can also be set with the package
option
[`AMR_ignore_pattern`](https://amr-for-r.org/reference/AMR-options.md),
e.g.
`options(AMR_ignore_pattern = "(not reported|contaminated flora)")`.
- cleaning_regex:
A Perl-compatible [regular
expression](https://rdrr.io/r/base/regex.html) (case-insensitive) to
clean the input of `x`. Every matched part in `x` will be removed. At
default, this is the outcome of `mo_cleaning_regex()`, which removes
texts between brackets and texts such as "species" and "serovar". The
default can be set with the package option
[`AMR_cleaning_regex`](https://amr-for-r.org/reference/AMR-options.md).
- only_fungi:
A [logical](https://rdrr.io/r/base/logical.html) to indicate if only
fungi must be found, making sure that e.g. misspellings always return
records from the kingdom of Fungi. This can be set globally for [all
microorganism
functions](https://amr-for-r.org/reference/mo_property.md) with the
package option
[`AMR_only_fungi`](https://amr-for-r.org/reference/AMR-options.md),
i.e. `options(AMR_only_fungi = TRUE)`.
- language:
Language to translate text like "no growth", which defaults to the
system language (see
[`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md)).
- info:
A [logical](https://rdrr.io/r/base/logical.html) to indicate that info
must be printed, e.g. a progress bar when more than 25 items are to be
coerced, or a list with old taxonomic names. The default is `TRUE`
only in interactive mode.
- ...:
Other arguments passed on to functions.
## Value
A [character](https://rdrr.io/r/base/character.html)
[vector](https://rdrr.io/r/base/vector.html) with additional class `mo`
## Details
A microorganism (MO) code from this package (class: `mo`) is
human-readable and typically looks like these examples:
Code Full name
--------------- --------------------------------------
B_KLBSL Klebsiella
B_KLBSL_PNMN Klebsiella pneumoniae
B_KLBSL_PNMN_RHNS Klebsiella pneumoniae rhinoscleromatis
| | | |
| | | |
| | | \---> subspecies, a 3-5 letter acronym
| | \----> species, a 3-6 letter acronym
| \----> genus, a 4-8 letter acronym
\----> kingdom: A (Archaea), AN (Animalia), B (Bacteria),
C (Chromista), F (Fungi), PL (Plantae),
P (Protozoa)
Values that cannot be coerced will be considered 'unknown' and will
return the MO code `UNKNOWN` with a warning.
Use the [`mo_*`](https://amr-for-r.org/reference/mo_property.md)
functions to get properties based on the returned code, see *Examples*.
The `as.mo()` function uses a novel and scientifically validated
([doi:10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03) )
matching score algorithm (see *Matching Score for Microorganisms* below)
to match input against the [available microbial
taxonomy](https://amr-for-r.org/reference/microorganisms.md) in this
package. This implicates that e.g. `"E. coli"` (a microorganism highly
prevalent in humans) will return the microbial ID of *Escherichia coli*
and not *Entamoeba coli* (a microorganism less prevalent in humans),
although the latter would alphabetically come first.
### Coping with Uncertain Results
Results of non-exact taxonomic input are based on their [matching
score](https://amr-for-r.org/reference/mo_matching_score.md). The lowest
allowed score can be set with the `minimum_matching_score` argument. At
default this will be determined based on the character length of the
input, the [taxonomic
kingdom](https://amr-for-r.org/reference/microorganisms.md), and the
[human
pathogenicity](https://amr-for-r.org/reference/mo_matching_score.md) of
the taxonomic outcome. If values are matched with uncertainty, a message
will be shown to suggest the user to inspect the results with
`mo_uncertainties()`, which returns a
[data.frame](https://rdrr.io/r/base/data.frame.html) with all
specifications.
To increase the quality of matching, the `cleaning_regex` argument is
used to clean the input. This must be a [regular
expression](https://rdrr.io/r/base/regex.html) that matches parts of the
input that should be removed before the input is matched against the
[available microbial
taxonomy](https://amr-for-r.org/reference/microorganisms.md). It will be
matched Perl-compatible and case-insensitive. The default value of
`cleaning_regex` is the outcome of the helper function
`mo_cleaning_regex()`.
There are three helper functions that can be run after using the
`as.mo()` function:
- Use `mo_uncertainties()` to get a
[data.frame](https://rdrr.io/r/base/data.frame.html) that prints in a
pretty format with all taxonomic names that were guessed. The output
contains the matching score for all matches (see *Matching Score for
Microorganisms* below).
- Use `mo_failures()` to get a
[character](https://rdrr.io/r/base/character.html)
[vector](https://rdrr.io/r/base/vector.html) with all values that
could not be coerced to a valid value.
- Use `mo_renamed()` to get a
[data.frame](https://rdrr.io/r/base/data.frame.html) with all values
that could be coerced based on old, previously accepted taxonomic
names.
### For Mycologists
The [matching score
algorithm](https://amr-for-r.org/reference/mo_matching_score.md) gives
precedence to bacteria over fungi. If you are only analysing fungi, be
sure to use `only_fungi = TRUE`, or better yet, add this to your code
and run it once every session:
options(AMR_only_fungi = TRUE)
This will make sure that no bacteria or other 'non-fungi' will be
returned by `as.mo()`, or any of the
[`mo_*`](https://amr-for-r.org/reference/mo_property.md) functions.
### Coagulase-negative and Coagulase-positive Staphylococci
With `Becker = TRUE`, the following staphylococci will be converted to
their corresponding coagulase group:
- Coagulase-negative: *S. americanisciuri*, *S. argensis*, *S.
arlettae*, *S. auricularis*, *S. borealis*, *S. brunensis*, *S.
caeli*, *S. caledonicus*, *S. canis*, *S. capitis*, *S. capitis
capitis*, *S. capitis urealyticus*, *S. capitis ureolyticus*, *S.
caprae*, *S. carnosus*, *S. carnosus carnosus*, *S. carnosus utilis*,
*S. casei*, *S. caseolyticus*, *S. chromogenes*, *S. cohnii*, *S.
cohnii cohnii*, *S. cohnii urealyticum*, *S. cohnii urealyticus*, *S.
condimenti*, *S. croceilyticus*, *S. debuckii*, *S. devriesei*, *S.
durrellii*, *S. edaphicus*, *S. epidermidis*, *S. equorum*, *S.
equorum equorum*, *S. equorum linens*, *S. felis*, *S. fleurettii*,
*S. gallinarum*, *S. haemolyticus*, *S. hominis*, *S. hominis
hominis*, *S. hominis novobiosepticus*, *S. jettensis*, *S. kloosii*,
*S. lentus*, *S. lloydii*, *S. lugdunensis*, *S. marylandisciuri*, *S.
massiliensis*, *S. microti*, *S. muscae*, *S. nepalensis*, *S.
pasteuri*, *S. petrasii*, *S. petrasii croceilyticus*, *S. petrasii
jettensis*, *S. petrasii petrasii*, *S. petrasii pragensis*, *S.
pettenkoferi*, *S. piscifermentans*, *S. pragensis*, *S.
pseudoxylosus*, *S. pulvereri*, *S. ratti*, *S. rostri*, *S.
saccharolyticus*, *S. saprophyticus*, *S. saprophyticus bovis*, *S.
saprophyticus saprophyticus*, *S. schleiferi*, *S. schleiferi
schleiferi*, *S. sciuri*, *S. sciuri carnaticus*, *S. sciuri lentus*,
*S. sciuri rodentium*, *S. sciuri sciuri*, *S. shinii*, *S. simulans*,
*S. stepanovicii*, *S. succinus*, *S. succinus casei*, *S. succinus
succinus*, *S. taiwanensis*, *S. urealyticus*, *S. ureilyticus*, *S.
veratri*, *S. vitulinus*, *S. vitulus*, *S. warneri*, and *S. xylosus*
- Coagulase-positive: *S. agnetis*, *S. argenteus*, *S. coagulans*, *S.
cornubiensis*, *S. delphini*, *S. hyicus*, *S. hyicus chromogenes*,
*S. hyicus hyicus*, *S. intermedius*, *S. lutrae*, *S.
pseudintermedius*, *S. roterodami*, *S. schleiferi coagulans*, *S.
schweitzeri*, *S. simiae*, and *S. singaporensis*
This is based on:
- Becker K *et al.* (2014). **Coagulase-Negative Staphylococci.** *Clin
Microbiol Rev.* 27(4): 870-926;
[doi:10.1128/CMR.00109-13](https://doi.org/10.1128/CMR.00109-13)
- Becker K *et al.* (2019). **Implications of identifying the recently
defined members of the *S. aureus* complex, *S. argenteus* and *S.
schweitzeri*: A position paper of members of the ESCMID Study Group
for staphylococci and Staphylococcal Diseases (ESGS).** *Clin
Microbiol Infect*;
[doi:10.1016/j.cmi.2019.02.028](https://doi.org/10.1016/j.cmi.2019.02.028)
- Becker K *et al.* (2020). **Emergence of coagulase-negative
staphylococci.** *Expert Rev Anti Infect Ther.* 18(4):349-366;
[doi:10.1080/14787210.2020.1730813](https://doi.org/10.1080/14787210.2020.1730813)
For newly named staphylococcal species, such as *S. brunensis* (2024)
and *S. shinii* (2023), we looked up the scientific reference to make
sure the species are considered for the correct coagulase group.
### Lancefield Groups in Streptococci
With `Lancefield = TRUE`, the following streptococci will be converted
to their corresponding Lancefield group:
- Streptococcus Group A: *S. pyogenes*
- Streptococcus Group B: *S. agalactiae*
- Streptococcus Group C: *S. dysgalactiae*, *S. dysgalactiae
dysgalactiae*, *S. dysgalactiae equisimilis*, *S. equi*, *S. equi
equi*, *S. equi ruminatorum*, and *S. equi zooepidemicus*
- Streptococcus Group F: *S. anginosus*, *S. anginosus anginosus*, *S.
anginosus whileyi*, *S. constellatus*, *S. constellatus constellatus*,
*S. constellatus pharyngis*, *S. constellatus viborgensis*, and *S.
intermedius*
- Streptococcus Group G: *S. canis*, *S. dysgalactiae*, *S. dysgalactiae
dysgalactiae*, and *S. dysgalactiae equisimilis*
- Streptococcus Group H: *S. sanguinis*
- Streptococcus Group K: *S. salivarius*, *S. salivarius salivarius*,
and *S. salivarius thermophilus*
- Streptococcus Group L: *S. dysgalactiae*, *S. dysgalactiae
dysgalactiae*, and *S. dysgalactiae equisimilis*
This is based on:
- Lancefield RC (1933). **A serological differentiation of human and
other groups of hemolytic streptococci.** *J Exp Med.* 57(4): 571-95;
[doi:10.1084/jem.57.4.571](https://doi.org/10.1084/jem.57.4.571)
## Source
- Berends MS *et al.* (2022). **AMR: An R Package for Working with
Antimicrobial Resistance Data**. *Journal of Statistical Software*,
104(3), 1-31;
[doi:10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)
- Parte, AC *et al.* (2020). **List of Prokaryotic names with Standing
in Nomenclature (LPSN) moves to the DSMZ.** International Journal of
Systematic and Evolutionary Microbiology, 70, 5607-5612;
[doi:10.1099/ijsem.0.004332](https://doi.org/10.1099/ijsem.0.004332) .
Accessed from <https://lpsn.dsmz.de> on June 24th, 2024.
- Vincent, R *et al* (2013). **MycoBank gearing up for new horizons.**
IMA Fungus, 4(2), 371-9;
[doi:10.5598/imafungus.2013.04.02.16](https://doi.org/10.5598/imafungus.2013.04.02.16)
. Accessed from <https://www.mycobank.org> on June 24th, 2024.
- GBIF Secretariat (2023). GBIF Backbone Taxonomy. Checklist dataset
[doi:10.15468/39omei](https://doi.org/10.15468/39omei) . Accessed from
<https://www.gbif.org> on June 24th, 2024.
- Reimer, LC *et al.* (2022). ***BacDive* in 2022: the knowledge base
for standardized bacterial and archaeal data.** Nucleic Acids Res.,
50(D1):D741-D74;
[doi:10.1093/nar/gkab961](https://doi.org/10.1093/nar/gkab961) .
Accessed from <https://bacdive.dsmz.de> on July 16th, 2024.
- Public Health Information Network Vocabulary Access and Distribution
System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020.
Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12).
URL: <https://www.cdc.gov/phin/php/phinvads/>
- Bartlett A *et al.* (2022). **A comprehensive list of bacterial
pathogens infecting humans** *Microbiology* 168:001269;
[doi:10.1099/mic.0.001269](https://doi.org/10.1099/mic.0.001269)
## Matching Score for Microorganisms
With ambiguous user input in `as.mo()` and all the
[`mo_*`](https://amr-for-r.org/reference/mo_property.md) functions, the
returned results are chosen based on their matching score using
[`mo_matching_score()`](https://amr-for-r.org/reference/mo_matching_score.md).
This matching score \\m\\, is calculated as:
\$\$m\_{(x, n)} = \frac{l\_{n} - 0.5 \cdot \min \begin{cases}l\_{n} \\
\textrm{lev}(x, n)\end{cases}}{l\_{n} \cdot p\_{n} \cdot k\_{n}}\$\$
where:
- \\x\\ is the user input;
- \\n\\ is a taxonomic name (genus, species, and subspecies);
- \\l_n\\ is the length of \\n\\;
- \\lev\\ is the [Levenshtein distance
function](https://en.wikipedia.org/wiki/Levenshtein_distance)
(counting any insertion as 1, and any deletion or substitution as 2)
that is needed to change \\x\\ into \\n\\;
- \\p_n\\ is the human pathogenic prevalence group of \\n\\, as
described below;
- \\k_n\\ is the taxonomic kingdom of \\n\\, set as Bacteria = 1, Fungi
= 1.25, Protozoa = 1.5, Chromista = 1.75, Archaea = 2, others = 3.
The grouping into human pathogenic prevalence \\p\\ is based on recent
work from Bartlett *et al.* (2022,
[doi:10.1099/mic.0.001269](https://doi.org/10.1099/mic.0.001269) ) who
extensively studied medical-scientific literature to categorise all
bacterial species into these groups:
- **Established**, if a taxonomic species has infected at least three
persons in three or more references. These records have
`prevalence = 1.15` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set;
- **Putative**, if a taxonomic species has fewer than three known cases.
These records have `prevalence = 1.25` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set.
Furthermore,
- Genera from the World Health Organization's (WHO) Priority Pathogen
List have `prevalence = 1.0` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set;
- Any genus present in the **established** list also has
`prevalence = 1.15` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set;
- Any other genus present in the **putative** list has
`prevalence = 1.25` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set;
- Any other species or subspecies of which the genus is present in the
two aforementioned groups, has `prevalence = 1.5` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set;
- Any *non-bacterial* genus, species or subspecies of which the genus is
present in the following list, has `prevalence = 1.25` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set: *Absidia*, *Acanthamoeba*, *Acremonium*, *Actinomucor*,
*Aedes*, *Alternaria*, *Amoeba*, *Ancylostoma*, *Angiostrongylus*,
*Anisakis*, *Anopheles*, *Apophysomyces*, *Arthroderma*,
*Aspergillus*, *Aureobasidium*, *Basidiobolus*, *Beauveria*,
*Bipolaris*, *Blastobotrys*, *Blastocystis*, *Blastomyces*, *Candida*,
*Capillaria*, *Chaetomium*, *Chilomastix*, *Chrysonilia*,
*Chrysosporium*, *Cladophialophora*, *Cladosporium*, *Clavispora*,
*Coccidioides*, *Cokeromyces*, *Conidiobolus*, *Coniochaeta*,
*Contracaecum*, *Cordylobia*, *Cryptococcus*, *Cryptosporidium*,
*Cunninghamella*, *Curvularia*, *Cyberlindnera*, *Debaryozyma*,
*Demodex*, *Dermatobia*, *Dientamoeba*, *Diphyllobothrium*,
*Dirofilaria*, *Echinostoma*, *Entamoeba*, *Enterobius*,
*Epidermophyton*, *Exidia*, *Exophiala*, *Exserohilum*, *Fasciola*,
*Fonsecaea*, *Fusarium*, *Geotrichum*, *Giardia*, *Graphium*,
*Haloarcula*, *Halobacterium*, *Halococcus*, *Hansenula*,
*Hendersonula*, *Heterophyes*, *Histomonas*, *Histoplasma*, *Hortaea*,
*Hymenolepis*, *Hypomyces*, *Hysterothylacium*, *Kloeckera*,
*Kluyveromyces*, *Kodamaea*, *Lacazia*, *Leishmania*, *Lichtheimia*,
*Lodderomyces*, *Lomentospora*, *Madurella*, *Malassezia*,
*Malbranchea*, *Metagonimus*, *Meyerozyma*, *Microsporidium*,
*Microsporum*, *Millerozyma*, *Mortierella*, *Mucor*,
*Mycocentrospora*, *Nannizzia*, *Necator*, *Nectria*, *Ochroconis*,
*Oesophagostomum*, *Oidiodendron*, *Opisthorchis*, *Paecilomyces*,
*Paracoccidioides*, *Pediculus*, *Penicillium*, *Phaeoacremonium*,
*Phaeomoniella*, *Phialophora*, *Phlebotomus*, *Phoma*, *Pichia*,
*Piedraia*, *Pithomyces*, *Pityrosporum*, *Pneumocystis*,
*Pseudallescheria*, *Pseudoscopulariopsis*, *Pseudoterranova*,
*Pulex*, *Purpureocillium*, *Quambalaria*, *Rhinocladiella*,
*Rhizomucor*, *Rhizopus*, *Rhodotorula*, *Saccharomyces*, *Saksenaea*,
*Saprochaete*, *Sarcoptes*, *Scedosporium*, *Schistosoma*,
*Schizosaccharomyces*, *Scolecobasidium*, *Scopulariopsis*,
*Scytalidium*, *Spirometra*, *Sporobolomyces*, *Sporopachydermia*,
*Sporothrix*, *Sporotrichum*, *Stachybotrys*, *Strongyloides*,
*Syncephalastrum*, *Syngamus*, *Taenia*, *Talaromyces*, *Teleomorph*,
*Toxocara*, *Trichinella*, *Trichobilharzia*, *Trichoderma*,
*Trichomonas*, *Trichophyton*, *Trichosporon*, *Trichostrongylus*,
*Trichuris*, *Tritirachium*, *Trombicula*, *Trypanosoma*, *Tunga*,
*Ulocladium*, *Ustilago*, *Verticillium*, *Wallemia*, *Wangiella*,
*Wickerhamomyces*, *Wuchereria*, *Yarrowia*, or *Zygosaccharomyces*;
- All other records have `prevalence = 2.0` in the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set.
When calculating the matching score, all characters in \\x\\ and \\n\\
are ignored that are other than A-Z, a-z, 0-9, spaces and parentheses.
All matches are sorted descending on their matching score and for all
user input values, the top match will be returned. This will lead to the
effect that e.g., `"E. coli"` will return the microbial ID of
*Escherichia coli* (\\m = 0.688\\, a highly prevalent microorganism
found in humans) and not *Entamoeba coli* (\\m = 0.381\\, a less
prevalent microorganism in humans), although the latter would
alphabetically come first.
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
[microorganisms](https://amr-for-r.org/reference/microorganisms.md) for
the [data.frame](https://rdrr.io/r/base/data.frame.html) that is being
used to determine ID's.
The [`mo_*`](https://amr-for-r.org/reference/mo_property.md) functions
(such as [`mo_genus()`](https://amr-for-r.org/reference/mo_property.md),
[`mo_gramstain()`](https://amr-for-r.org/reference/mo_property.md)) to
get properties based on the returned code.
## Examples
``` r
# \donttest{
# These examples all return "B_STPHY_AURS", the ID of S. aureus:
as.mo(c(
"sau", # WHONET code
"stau",
"STAU",
"staaur",
"S. aureus",
"S aureus",
"Sthafilokkockus aureus", # handles incorrect spelling
"Staphylococcus aureus (MRSA)",
"MRSA", # Methicillin Resistant S. aureus
"VISA", # Vancomycin Intermediate S. aureus
"VRSA", # Vancomycin Resistant S. aureus
115329001 # SNOMED CT code
))
#> Class 'mo'
#> [1] B_STPHY_AURS B_STPHY_AURS B_STPHY_AURS B_STPHY_AURS B_STPHY_AURS
#> [6] B_STPHY_AURS B_STPHY_AURS B_STPHY_AURS B_STPHY_AURS B_STPHY_AURS
#> [11] B_STPHY_AURS B_STPHY_AURS
# Dyslexia is no problem - these all work:
as.mo(c(
"Ureaplasma urealyticum",
"Ureaplasma urealyticus",
"Ureaplasmium urealytica",
"Ureaplazma urealitycium"
))
#> Class 'mo'
#> [1] B_URPLS_URLY B_URPLS_URLY B_URPLS_URLY B_URPLS_URLY
# input will get cleaned up with the input given in the `cleaning_regex` argument,
# which defaults to `mo_cleaning_regex()`:
cat(mo_cleaning_regex(), "\n")
#> ([^A-Za-z- \(\)\[\]{}]+|([({]|\[).+([})]|\])|(^| )( ?[a-z-]+[-](resistant|susceptible) ?|e?spp([^a-z]+|$)|e?ssp([^a-z]+|$)|serogr.?up[a-z]*|e?ss([^a-z]+|$)|e?sp([^a-z]+|$)|var([^a-z]+|$)|serovar[a-z]*|sube?species|biovar[a-z]*|e?species|Ig[ADEGM]|e?subsp|biotype|titer|dummy))
as.mo("Streptococcus group A")
#> Class 'mo'
#> [1] B_STRPT_GRPA
as.mo("S. epidermidis") # will remain species: B_STPHY_EPDR
#> Class 'mo'
#> [1] B_STPHY_EPDR
as.mo("S. epidermidis", Becker = TRUE) # will not remain species: B_STPHY_CONS
#> Class 'mo'
#> [1] B_STPHY_CONS
as.mo("S. pyogenes") # will remain species: B_STRPT_PYGN
#> Class 'mo'
#> [1] B_STRPT_PYGN
as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPT_GRPA
#> Class 'mo'
#> [1] B_STRPT_GRPA
# All mo_* functions use as.mo() internally too (see ?mo_property):
mo_genus("E. coli")
#> [1] "Escherichia"
mo_gramstain("ESCO")
#> [1] "Gram-negative"
mo_is_intrinsic_resistant("ESCCOL", ab = "vanco")
#> Determining intrinsic resistance based on 'EUCAST Expected Resistant
#> Phenotypes' v1.2 (2023). This note will be shown once per session.
#> [1] TRUE
# }
```

View File

@@ -9,7 +9,7 @@ Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI 2011-2025,
<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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -415,10 +415,10 @@ Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI 2011-2025,
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># A tibble: 4 × 18</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> datetime index method ab_given mo_given host_given input_given</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;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> 2025-10-13 <span style="color: #949494;">20:19:03</span> 1 MIC amoxicillin Escherich… human 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2025-10-13 <span style="color: #949494;">20:19:03</span> 1 MIC cipro Escherich… human 0.256 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> 2025-10-13 <span style="color: #949494;">20:19:03</span> 1 DISK tobra Escherich… human 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> 2025-10-13 <span style="color: #949494;">20:19:03</span> 1 DISK genta Escherich… human 18 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">1</span> 2025-11-24 <span style="color: #949494;">10:38:56</span> 1 MIC amoxicillin Escherich… human 8 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">2</span> 2025-11-24 <span style="color: #949494;">10:38:56</span> 1 MIC cipro Escherich… human 0.256 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">3</span> 2025-11-24 <span style="color: #949494;">10:38:56</span> 1 DISK tobra Escherich… human 16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #BCBCBC;">4</span> 2025-11-24 <span style="color: #949494;">10:38:56</span> 1 DISK genta Escherich… human 18 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># 11 more variables: ab &lt;ab&gt;, mo &lt;mo&gt;, host &lt;chr&gt;, input &lt;chr&gt;,</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #949494;"># outcome &lt;sir&gt;, notes &lt;chr&gt;, guideline &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;"># breakpoint_S_R &lt;chr&gt;, site &lt;chr&gt;</span></span>

916
reference/as.sir.md Normal file
View File

@@ -0,0 +1,916 @@
# Interpret MIC and Disk Diffusion as SIR, or Clean Existing SIR Data
Clean up existing SIR values, or interpret minimum inhibitory
concentration (MIC) values and disk diffusion diameters according to
EUCAST or CLSI. `as.sir()` transforms the input to a new class `sir`,
which is an ordered [factor](https://rdrr.io/r/base/factor.html)
containing the levels `S`, `SDD`, `I`, `R`, `NI`.
Breakpoints are currently implemented from EUCAST 2011-2025 and CLSI
2011-2025, see *Details*. All breakpoints used for interpretation are
available in our
[clinical_breakpoints](https://amr-for-r.org/reference/clinical_breakpoints.md)
data set.
## Usage
``` r
as.sir(x, ...)
NA_sir_
is.sir(x)
is_sir_eligible(x, threshold = 0.05)
# Default S3 method
as.sir(x, S = "^(S|U)+$", I = "^(I)+$", R = "^(R)+$",
NI = "^(N|NI|V)+$", SDD = "^(SDD|D|H)+$", info = interactive(), ...)
# S3 method for class 'mic'
as.sir(x, mo = NULL, ab = deparse(substitute(x)),
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
add_intrinsic_resistance = FALSE,
reference_data = AMR::clinical_breakpoints,
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
language = get_AMR_locale(), verbose = FALSE, info = interactive(),
conserve_capped_values = NULL, ...)
# S3 method for class 'disk'
as.sir(x, mo = NULL, ab = deparse(substitute(x)),
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
add_intrinsic_resistance = FALSE,
reference_data = AMR::clinical_breakpoints,
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
language = get_AMR_locale(), verbose = FALSE, info = interactive(),
...)
# S3 method for class 'data.frame'
as.sir(x, ..., col_mo = NULL,
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
add_intrinsic_resistance = FALSE,
reference_data = AMR::clinical_breakpoints,
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
language = get_AMR_locale(), verbose = FALSE, info = interactive(),
parallel = FALSE, max_cores = -1, conserve_capped_values = NULL)
sir_interpretation_history(clean = FALSE)
```
## Source
For interpretations of minimum inhibitory concentration (MIC) values and
disk diffusion diameters:
- **CLSI M39: Analysis and Presentation of Cumulative Antimicrobial
Susceptibility Test Data**, 2011-2025, *Clinical and Laboratory
Standards Institute* (CLSI).
<https://clsi.org/standards/products/microbiology/documents/m39/>.
- **CLSI M100: Performance Standard for Antimicrobial Susceptibility
Testing**, 2011-2025, *Clinical and Laboratory Standards Institute*
(CLSI).
<https://clsi.org/standards/products/microbiology/documents/m100/>.
- **CLSI VET01: Performance Standards for Antimicrobial Disk and
Dilution Susceptibility Tests for Bacteria Isolated From Animals**,
2019-2025, *Clinical and Laboratory Standards Institute* (CLSI).
<https://clsi.org/standards/products/veterinary-medicine/documents/vet01/>.
- **EUCAST Breakpoint tables for interpretation of MICs and zone
diameters**, 2011-2025, *European Committee on Antimicrobial
Susceptibility Testing* (EUCAST).
<https://www.eucast.org/clinical_breakpoints>.
- **WHONET** as a source for machine-reading the clinical breakpoints
([read more
here](https://amr-for-r.org/reference/clinical_breakpoints.html#imported-from-whonet)),
1989-2025, *WHO Collaborating Centre for Surveillance of Antimicrobial
Resistance*. <https://whonet.org/>.
## Arguments
- x:
Vector of values (for class
[`mic`](https://amr-for-r.org/reference/as.mic.md): MIC values in
mg/L, for class [`disk`](https://amr-for-r.org/reference/as.disk.md):
a disk diffusion radius in millimetres).
- ...:
For using on a [data.frame](https://rdrr.io/r/base/data.frame.html):
selection of columns to apply `as.sir()` to. Supports [tidyselect
language](https://tidyselect.r-lib.org/reference/starts_with.html)
such as `where(is.mic)`, `starts_with(...)`, or `column1:column4`, and
can thus also be [antimicrobial
selectors](https://amr-for-r.org/reference/antimicrobial_selectors.md)
such as `as.sir(df, penicillins())`.
Otherwise: arguments passed on to methods.
- threshold:
Maximum fraction of invalid antimicrobial interpretations of `x`, see
*Examples*.
- S, I, R, NI, SDD:
A case-independent [regular
expression](https://rdrr.io/r/base/regex.html) to translate input to
this result. This regular expression will be run *after* all
non-letters and whitespaces are removed from the input.
- info:
A [logical](https://rdrr.io/r/base/logical.html) to print information
about the process, defaults to `TRUE` only in [interactive
sessions](https://rdrr.io/r/base/interactive.html).
- mo:
A vector (or column name) with
[character](https://rdrr.io/r/base/character.html)s that can be
coerced to valid microorganism codes with
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md), can be left
empty to determine it automatically.
- ab:
A vector (or column name) with
[character](https://rdrr.io/r/base/character.html)s that can be
coerced to a valid antimicrobial drug code with
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md).
- guideline:
A guideline name (or column name) to use for SIR interpretation.
Defaults to EUCAST 2025 (the latest implemented EUCAST guideline in
the
[clinical_breakpoints](https://amr-for-r.org/reference/clinical_breakpoints.md)
data set), but can be set with the package option
[`AMR_guideline`](https://amr-for-r.org/reference/AMR-options.md).
Currently supports EUCAST (2011-2025) and CLSI (2011-2025), see
*Details*. Using a column name allows for straightforward
interpretation of historical data, which must be analysed in the
context of, for example, different years.
- uti:
(Urinary Tract Infection) a vector (or column name) with
[logical](https://rdrr.io/r/base/logical.html)s (`TRUE` or `FALSE`) to
specify whether a UTI specific interpretation from the guideline
should be chosen. For using `as.sir()` on a
[data.frame](https://rdrr.io/r/base/data.frame.html), this can also be
a column containing [logical](https://rdrr.io/r/base/logical.html)s or
when left blank, the data set will be searched for a column
'specimen', and rows within this column containing 'urin' (such as
'urine', 'urina') will be regarded isolates from a UTI. See
*Examples*.
- capped_mic_handling:
A [character](https://rdrr.io/r/base/character.html) string that
controls how MIC values with a cap (i.e., starting with `<`, `<=`,
`>`, or `>=`) are interpreted. Supports the following options:
`"none"`
- `<=` and `>=` are treated as-is.
- `<` and `>` are treated as-is.
`"conservative"`
- `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within
the breakpoint guideline range.
- `<` always returns `"S"`, and `>` always returns `"R"`.
`"standard"` (default)
- `<=` and `>=` return `"NI"` (non-interpretable) if the MIC is within
the breakpoint guideline range.
- `<` and `>` are treated as-is.
`"inverse"`
- `<=` and `>=` are treated as-is.
- `<` always returns `"S"`, and `>` always returns `"R"`.
The default `"standard"` setting ensures cautious handling of
uncertain values while preserving interpretability. This option can
also be set with the package option
[`AMR_capped_mic_handling`](https://amr-for-r.org/reference/AMR-options.md).
- add_intrinsic_resistance:
*(only useful when using a EUCAST guideline)* a
[logical](https://rdrr.io/r/base/logical.html) to indicate whether
intrinsic antibiotic resistance must also be considered for applicable
bug-drug combinations, meaning that e.g. ampicillin will always return
"R" in *Klebsiella* species. Determination is based on the
[intrinsic_resistant](https://amr-for-r.org/reference/intrinsic_resistant.md)
data set, that itself is based on ['EUCAST Expert Rules' and 'EUCAST
Intrinsic Resistance and Unusual Phenotypes'
v3.3](https://www.eucast.org/expert_rules_and_expected_phenotypes)
(2021).
- reference_data:
A [data.frame](https://rdrr.io/r/base/data.frame.html) to be used for
interpretation, which defaults to the
[clinical_breakpoints](https://amr-for-r.org/reference/clinical_breakpoints.md)
data set. Changing this argument allows for using own interpretation
guidelines. This argument must contain a data set that is equal in
structure to the
[clinical_breakpoints](https://amr-for-r.org/reference/clinical_breakpoints.md)
data set (same column names and column types). Please note that the
`guideline` argument will be ignored when `reference_data` is manually
set.
- substitute_missing_r_breakpoint:
A [logical](https://rdrr.io/r/base/logical.html) to indicate that a
missing clinical breakpoints for R (resistant) must be substituted
with R - the default is `FALSE`. Some (especially CLSI) breakpoints
only have a breakpoint for S, meaning that the outcome can only be
`"S"` or `NA`. Setting this to `TRUE` will convert the `NA`s in these
cases to `"R"`. Can also be set with the package option
[`AMR_substitute_missing_r_breakpoint`](https://amr-for-r.org/reference/AMR-options.md).
- include_screening:
A [logical](https://rdrr.io/r/base/logical.html) to indicate that
clinical breakpoints for screening are allowed - the default is
`FALSE`. Can also be set with the package option
[`AMR_include_screening`](https://amr-for-r.org/reference/AMR-options.md).
- include_PKPD:
A [logical](https://rdrr.io/r/base/logical.html) to indicate that
PK/PD clinical breakpoints must be applied as a last resort - the
default is `TRUE`. Can also be set with the package option
[`AMR_include_PKPD`](https://amr-for-r.org/reference/AMR-options.md).
- breakpoint_type:
The type of breakpoints to use, either "ECOFF", "animal", or "human".
ECOFF stands for Epidemiological Cut-Off values. The default is
`"human"`, which can also be set with the package option
[`AMR_breakpoint_type`](https://amr-for-r.org/reference/AMR-options.md).
If `host` is set to values of veterinary species, this will
automatically be set to `"animal"`.
- host:
A vector (or column name) with
[character](https://rdrr.io/r/base/character.html)s to indicate the
host. Only useful for veterinary breakpoints, as it requires
`breakpoint_type = "animal"`. The values can be any text resembling
the animal species, even in any of the 28 supported languages of this
package. For foreign languages, be sure to set the language with
[`set_AMR_locale()`](https://amr-for-r.org/reference/translate.md)
(though it will be automatically guessed based on the system
language).
- language:
Language to convert values set in `host` when using animal
breakpoints. Use one of these supported language names or [ISO 639-1
codes](https://en.wikipedia.org/wiki/ISO_639-1): English (en), Arabic
(ar), Bengali (bn), Chinese (zh), Czech (cs), Danish (da), Dutch (nl),
Finnish (fi), French (fr), German (de), Greek (el), Hindi (hi),
Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Norwegian
(no), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru),
Spanish (es), Swahili (sw), Swedish (sv), Turkish (tr), Ukrainian
(uk), Urdu (ur), or Vietnamese (vi).
- verbose:
A [logical](https://rdrr.io/r/base/logical.html) to indicate that all
notes should be printed during interpretation of MIC values or disk
diffusion values.
- conserve_capped_values:
Deprecated, use `capped_mic_handling` instead.
- col_mo:
Column name of the names or codes of the microorganisms (see
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md)) - the default
is the first column of class
[`mo`](https://amr-for-r.org/reference/as.mo.md). Values will be
coerced using [`as.mo()`](https://amr-for-r.org/reference/as.mo.md).
- parallel:
A [logical](https://rdrr.io/r/base/logical.html) to indicate if
parallel computing must be used, defaults to `FALSE`. This requires no
additional packages, as the used `parallel` package is part of base R.
On Windows and on R \< 4.0.0
[`parallel::parLapply()`](https://rdrr.io/r/parallel/clusterApply.html)
will be used, in all other cases the more efficient
[`parallel::mclapply()`](https://rdrr.io/r/parallel/mclapply.html)
will be used.
- max_cores:
Maximum number of cores to use if `parallel = TRUE`. Use a negative
value to subtract that number from the available number of cores, e.g.
a value of `-2` on an 8-core machine means that at most 6 cores will
be used. Defaults to `-1`. There will never be used more cores than
variables to analyse. The available number of cores are detected using
[`parallelly::availableCores()`](https://parallelly.futureverse.org/reference/availableCores.html)
if that package is installed, and base R's
[`parallel::detectCores()`](https://rdrr.io/r/parallel/detectCores.html)
otherwise.
- clean:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
previously stored results should be forgotten after returning the
'logbook' with results.
## Value
Ordered [factor](https://rdrr.io/r/base/factor.html) with new class
`sir`
## Details
*Note: The clinical breakpoints in this package were validated through,
and imported from, [WHONET](https://whonet.org). The public use of this
`AMR` package has been endorsed by both CLSI and EUCAST. See
[clinical_breakpoints](https://amr-for-r.org/reference/clinical_breakpoints.md)
for more information.*
### How it Works
The `as.sir()` function can work in four ways:
1. For **cleaning raw / untransformed data**. The data will be cleaned
to only contain valid values, namely: **S** for susceptible, **I**
for intermediate or 'susceptible, increased exposure', **R** for
resistant, **NI** for non-interpretable, and **SDD** for susceptible
dose-dependent. Each of these can be set using a [regular
expression](https://rdrr.io/r/base/regex.html). Furthermore,
`as.sir()` will try its best to clean with some intelligence. For
example, mixed values with SIR interpretations and MIC values such
as `"<0.25; S"` will be coerced to `"S"`. Combined interpretations
for multiple test methods (as seen in laboratory records) such as
`"S; S"` will be coerced to `"S"`, but a value like `"S; I"` will
return `NA` with a warning that the input is invalid.
2. For **interpreting minimum inhibitory concentration (MIC) values**
according to EUCAST or CLSI. You must clean your MIC values first
using [`as.mic()`](https://amr-for-r.org/reference/as.mic.md), that
also gives your columns the new data class
[`mic`](https://amr-for-r.org/reference/as.mic.md). Also, be sure to
have a column with microorganism names or codes. It will be found
automatically, but can be set manually using the `mo` argument.
- Example to apply using `dplyr`:
your_data %>% mutate_if(is.mic, as.sir)
your_data %>% mutate(across(where(is.mic), as.sir))
your_data %>% mutate_if(is.mic, as.sir, ab = "column_with_antibiotics", mo = "column_with_microorganisms")
your_data %>% mutate_if(is.mic, as.sir, ab = c("cipro", "ampicillin", ...), mo = c("E. coli", "K. pneumoniae", ...))
# for veterinary breakpoints, also set `host`:
your_data %>% mutate_if(is.mic, as.sir, host = "column_with_animal_species", guideline = "CLSI")
# fast processing with parallel computing:
as.sir(your_data, ..., parallel = TRUE)
- Operators like "\<=" will be stripped before interpretation. When
using `capped_mic_handling = "conservative"`, an MIC value of e.g.
"\>2" will always return "R", even if the breakpoint according to
the chosen guideline is "\>=4". This is to prevent that capped
values from raw laboratory data would not be treated
conservatively. The default behaviour
(`capped_mic_handling = "standard"`) considers "\>2" to be lower
than "\>=4" and might in this case return "S" or "I".
- **Note:** When using CLSI as the guideline, MIC values must be
log2-based doubling dilutions. Values not in this format, will be
automatically rounded up to the nearest log2 level as CLSI
instructs, and a warning will be thrown.
3. For **interpreting disk diffusion diameters** according to EUCAST or
CLSI. You must clean your disk zones first using
[`as.disk()`](https://amr-for-r.org/reference/as.disk.md), that also
gives your columns the new data class
[`disk`](https://amr-for-r.org/reference/as.disk.md). Also, be sure
to have a column with microorganism names or codes. It will be found
automatically, but can be set manually using the `mo` argument.
- Example to apply using `dplyr`:
your_data %>% mutate_if(is.disk, as.sir)
your_data %>% mutate(across(where(is.disk), as.sir))
your_data %>% mutate_if(is.disk, as.sir, ab = "column_with_antibiotics", mo = "column_with_microorganisms")
your_data %>% mutate_if(is.disk, as.sir, ab = c("cipro", "ampicillin", ...), mo = c("E. coli", "K. pneumoniae", ...))
# for veterinary breakpoints, also set `host`:
your_data %>% mutate_if(is.disk, as.sir, host = "column_with_animal_species", guideline = "CLSI")
# fast processing with parallel computing:
as.sir(your_data, ..., parallel = TRUE)
4. For **interpreting a complete data set**, with automatic
determination of MIC values, disk diffusion diameters, microorganism
names or codes, and antimicrobial test results. This is done very
simply by running `as.sir(your_data)`.
**For points 2, 3 and 4: Use `sir_interpretation_history()`** to
retrieve a [data.frame](https://rdrr.io/r/base/data.frame.html) with all
results of all previous `as.sir()` calls. It also contains notes about
interpretation, and the exact input and output values.
### Supported Guidelines
For interpreting MIC values as well as disk diffusion diameters,
currently implemented guidelines are:
- For **clinical microbiology**: EUCAST 2011-2025 and CLSI 2011-2025;
- For **veterinary microbiology**: EUCAST 2021-2025 and CLSI 2019-2025;
- For **ECOFFs** (Epidemiological Cut-off Values): EUCAST 2020-2025 and
CLSI 2022-2025.
The `guideline` argument must be set to e.g., `"EUCAST 2025"` or
`"CLSI 2025"`. By simply using `"EUCAST"` (the default) or `"CLSI"` as
input, the latest included version of that guideline will automatically
be selected. Importantly, using a column name of your data instead,
allows for straightforward interpretation of historical data that must
be analysed in the context of, for example, different years.
You can set your own data set using the `reference_data` argument. The
`guideline` argument will then be ignored.
It is also possible to set the default guideline with the package option
[`AMR_guideline`](https://amr-for-r.org/reference/AMR-options.md) (e.g.
in your `.Rprofile` file), such as:
options(AMR_guideline = "CLSI")
options(AMR_guideline = "CLSI 2018")
options(AMR_guideline = "EUCAST 2020")
# or to reset:
options(AMR_guideline = NULL)
### Working with Veterinary Breakpoints
When using veterinary breakpoints (i.e., setting
`breakpoint_type = "animal"`), a column with animal species must be
available or set manually using the `host` argument. The column must
contain names like "dogs", "cats", "cattle", "swine", "horses",
"poultry", or "aquatic". Other animal names like "goats", "rabbits", or
"monkeys" are also recognised but may not be available in all
guidelines. Matching is case-insensitive and accepts Latin-based
synonyms (e.g., "bovine" for cattle and "canine" for dogs).
Regarding choice of veterinary guidelines, these might be the best
options to set before analysis:
options(AMR_guideline = "CLSI")
options(AMR_breakpoint_type = "animal")
### After Interpretation
After using `as.sir()`, you can use the
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
defined by EUCAST to (1) apply inferred susceptibility and resistance
based on results of other antimicrobials and (2) apply intrinsic
resistance based on taxonomic properties of a microorganism.
To determine which isolates are multi-drug resistant, be sure to run
[`mdro()`](https://amr-for-r.org/reference/mdro.md) (which applies the
MDR/PDR/XDR guideline from 2012 at default) on a data set that contains
S/I/R values. Read more about [interpreting multidrug-resistant
organisms here](https://amr-for-r.org/reference/mdro.md).
### Other
The function `is.sir()` detects if the input contains class `sir`. If
the input is a [data.frame](https://rdrr.io/r/base/data.frame.html) or
[list](https://rdrr.io/r/base/list.html), it iterates over all
columns/items and returns a
[logical](https://rdrr.io/r/base/logical.html) vector.
The base R function [`as.double()`](https://rdrr.io/r/base/double.html)
can be used to retrieve quantitative values from a `sir` object: `"S"` =
1, `"I"`/`"SDD"` = 2, `"R"` = 3. All other values are rendered `NA`.
**Note:** Do not use
[`as.integer()`](https://rdrr.io/r/base/integer.html), since that
(because of how R works internally) will return the factor level
indices, and not these aforementioned quantitative values.
The function `is_sir_eligible()` returns `TRUE` when a column contains
at most 5% potentially invalid antimicrobial interpretations, and
`FALSE` otherwise. The threshold of 5% can be set with the `threshold`
argument. If the input is a
[data.frame](https://rdrr.io/r/base/data.frame.html), it iterates over
all columns and returns a [logical](https://rdrr.io/r/base/logical.html)
vector.
`NA_sir_` is a missing value of the new `sir` class, analogous to e.g.
base R's [`NA_character_`](https://rdrr.io/r/base/NA.html).
## Interpretation of SIR
In 2019, the European Committee on Antimicrobial Susceptibility Testing
(EUCAST) has decided to change the definitions of susceptibility testing
categories S, I, and R (<https://www.eucast.org/newsiandr>).
This AMR package follows insight; use
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
(equal to
[`proportion_SI()`](https://amr-for-r.org/reference/proportion.md)) to
determine antimicrobial susceptibility and
[`count_susceptible()`](https://amr-for-r.org/reference/count.md) (equal
to [`count_SI()`](https://amr-for-r.org/reference/count.md)) to count
susceptible isolates.
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
[`as.mic()`](https://amr-for-r.org/reference/as.mic.md),
[`as.disk()`](https://amr-for-r.org/reference/as.disk.md),
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md)
## Examples
``` r
example_isolates
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
summary(example_isolates[, 1:10]) # see all SIR results at a glance
#> date patient age gender
#> Min. :2002-01-02 Length:2000 Min. : 0.00 Length:2000
#> 1st Qu.:2005-07-31 Class :character 1st Qu.:63.00 Class :character
#> Median :2009-07-31 Mode :character Median :74.00 Mode :character
#> Mean :2009-11-20 Mean :70.69
#> 3rd Qu.:2014-05-30 3rd Qu.:82.00
#> Max. :2017-12-28 Max. :97.00
#> ward mo PEN
#> Length:2000 Class :mo Class:sir
#> Class :character <NA> :0 %S :25.6% (n=417)
#> Mode :character Unique:90 %SDD : 0.0% (n=0)
#> #1 :B_ESCHR_COLI %I : 0.7% (n=11)
#> #2 :B_STPHY_CONS %R :73.7% (n=1201)
#> #3 :B_STPHY_AURS %NI : 0.0% (n=0)
#> OXA FLC AMX
#> Class:sir Class:sir Class:sir
#> %S :68.8% (n=251) %S :70.5% (n=665) %S :40.2% (n=543)
#> %SDD : 0.0% (n=0) %SDD : 0.0% (n=0) %SDD : 0.0% (n=0)
#> %I : 0.0% (n=0) %I : 0.0% (n=0) %I : 0.2% (n=3)
#> %R :31.2% (n=114) %R :29.5% (n=278) %R :59.6% (n=804)
#> %NI : 0.0% (n=0) %NI : 0.0% (n=0) %NI : 0.0% (n=0)
# create some example data sets, with combined MIC values and disk zones
df_wide <- data.frame(
microorganism = "Escherichia coli",
amoxicillin = as.mic(8),
cipro = as.mic(0.256),
tobra = as.disk(16),
genta = as.disk(18),
ERY = "R"
)
df_long <- data.frame(
bacteria = rep("Escherichia coli", 4),
antibiotic = c("amoxicillin", "cipro", "tobra", "genta"),
mics = as.mic(c(0.01, 1, 4, 8)),
disks = as.disk(c(6, 10, 14, 18)),
guideline = c("EUCAST 2021", "EUCAST 2022", "EUCAST 2023", "EUCAST 2024")
)
# and clean previous SIR interpretation logs
x <- sir_interpretation_history(clean = TRUE)
# For INTERPRETING disk diffusion and MIC values -----------------------
# most basic application:
as.sir(df_wide)
#> microorganism amoxicillin cipro tobra genta ERY
#> 1 Escherichia coli S I S S R
# return a 'logbook' about the results:
sir_interpretation_history()
#> # A tibble: 4 × 18
#> datetime index method ab_given mo_given host_given input_given
#> <dttm> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 2025-11-24 10:38:56 1 MIC amoxicillin Escherich… human 8
#> 2 2025-11-24 10:38:56 1 MIC cipro Escherich… human 0.256
#> 3 2025-11-24 10:38:56 1 DISK tobra Escherich… human 16
#> 4 2025-11-24 10:38:56 1 DISK genta Escherich… human 18
#> # 11 more variables: ab <ab>, mo <mo>, host <chr>, input <chr>,
#> # outcome <sir>, notes <chr>, guideline <chr>, ref_table <chr>, uti <lgl>,
#> # breakpoint_S_R <chr>, site <chr>
# \donttest{
# using parallel computing, which is available in base R:
as.sir(df_wide, parallel = TRUE, info = TRUE)
#> Returning previously coerced values for various antimicrobials. Run
#> `ab_reset_session()` to reset this. This note will be shown once per
#> session.
#>
#> Running in parallel mode using 3 out of 4 cores, on columns 'amoxicillin',
#> 'cipro', 'tobra', 'genta', and 'ERY'...
#> DONE
#>
#>
#> Run `sir_interpretation_history()` to retrieve a logbook with all details
#> of the breakpoint interpretations.
#> microorganism amoxicillin cipro tobra genta ERY
#> 1 Escherichia coli S I S S R
## Using dplyr -------------------------------------------------
if (require("dplyr")) {
# approaches that all work without additional arguments:
df_wide %>% mutate_if(is.mic, as.sir)
df_wide %>% mutate_if(function(x) is.mic(x) | is.disk(x), as.sir)
df_wide %>% mutate(across(where(is.mic), as.sir))
df_wide %>% mutate_at(vars(amoxicillin:tobra), as.sir)
df_wide %>% mutate(across(amoxicillin:tobra, as.sir))
df_wide %>% mutate(across(aminopenicillins(), as.sir))
# approaches that all work with additional arguments:
df_long %>%
# given a certain data type, e.g. MIC values
mutate_if(is.mic, as.sir,
mo = "bacteria",
ab = "antibiotic",
guideline = "guideline"
)
df_long %>%
mutate(across(
where(is.mic),
function(x) {
as.sir(x,
mo = "bacteria",
ab = "antibiotic",
guideline = "CLSI"
)
}
))
df_wide %>%
# given certain columns, e.g. from 'cipro' to 'genta'
mutate_at(vars(cipro:genta), as.sir,
mo = "bacteria",
guideline = "CLSI"
)
df_wide %>%
mutate(across(
cipro:genta,
function(x) {
as.sir(x,
mo = "bacteria",
guideline = "CLSI"
)
}
))
# for veterinary breakpoints, add 'host':
df_long$animal_species <- c("cats", "dogs", "horses", "cattle")
df_long %>%
# given a certain data type, e.g. MIC values
mutate_if(is.mic, as.sir,
mo = "bacteria",
ab = "antibiotic",
host = "animal_species",
guideline = "CLSI"
)
df_long %>%
mutate(across(
where(is.mic),
function(x) {
as.sir(x,
mo = "bacteria",
ab = "antibiotic",
host = "animal_species",
guideline = "CLSI"
)
}
))
df_wide %>%
mutate_at(vars(cipro:genta), as.sir,
mo = "bacteria",
ab = "antibiotic",
host = "animal_species",
guideline = "CLSI"
)
df_wide %>%
mutate(across(
cipro:genta,
function(x) {
as.sir(x,
mo = "bacteria",
host = "animal_species",
guideline = "CLSI"
)
}
))
# to include information about urinary tract infections (UTI)
data.frame(
mo = "E. coli",
nitrofuratoin = c("<= 2", 32),
from_the_bladder = c(TRUE, FALSE)
) %>%
as.sir(uti = "from_the_bladder")
data.frame(
mo = "E. coli",
nitrofuratoin = c("<= 2", 32),
specimen = c("urine", "blood")
) %>%
as.sir() # automatically determines urine isolates
df_wide %>%
mutate_at(vars(cipro:genta), as.sir, mo = "E. coli", uti = TRUE)
}
#> For `aminopenicillins()` using column 'amoxicillin'
#> Warning: There was 1 warning in `mutate()`.
#> In argument: `across(...)`.
#> Caused by warning:
#> ! Some MICs were converted to the nearest higher log2 level, following the
#> CLSI interpretation guideline.
#> Warning: There was 1 warning in `mutate()`.
#> In argument: `cipro = (function (x, ...) ...`.
#> Caused by warning:
#> ! Some MICs were converted to the nearest higher log2 level, following the
#> CLSI interpretation guideline.
#> Warning: There was 1 warning in `mutate()`.
#> In argument: `across(...)`.
#> Caused by warning:
#> ! Some MICs were converted to the nearest higher log2 level, following the
#> CLSI interpretation guideline.
#> Warning: There was 1 warning in `mutate()`.
#> In argument: `mics = (function (x, ...) ...`.
#> Caused by warning:
#> ! Some MICs were converted to the nearest higher log2 level, following the
#> CLSI interpretation guideline.
#> Warning: There was 1 warning in `mutate()`.
#> In argument: `across(...)`.
#> Caused by warning:
#> ! Some MICs were converted to the nearest higher log2 level, following the
#> CLSI interpretation guideline.
#> Interpreting MIC values: 'antibiotic' (ASP, acetylspiramycin), CLSI 2025...
#> Interpreting disk diffusion zones: 'antibiotic' (ASP, acetylspiramycin),
#> CLSI 2025...
#> Interpreting disk diffusion zones: 'antibiotic' (ASP, acetylspiramycin),
#> CLSI 2025...
#> Warning: There was 1 warning in `mutate()`.
#> In argument: `cipro = (function (x, ...) ...`.
#> Caused by warning:
#> ! Some MICs were converted to the nearest higher log2 level, following the
#> CLSI interpretation guideline.
#> Warning: There was 1 warning in `mutate()`.
#> In argument: `across(...)`.
#> Caused by warning:
#> ! Some MICs were converted to the nearest higher log2 level, following the
#> CLSI interpretation guideline.
#> microorganism amoxicillin cipro tobra genta ERY
#> 1 Escherichia coli 8 <NA> S S R
## Using base R ------------------------------------------------
# for single values
as.sir(
x = as.mic(2),
mo = as.mo("S. pneumoniae"),
ab = "AMP",
guideline = "EUCAST"
)
#> Class 'sir'
#> [1] R
as.sir(
x = as.disk(18),
mo = "Strep pneu", # `mo` will be coerced with as.mo()
ab = "ampicillin", # and `ab` with as.ab()
guideline = "EUCAST"
)
#> Class 'sir'
#> [1] R
# For CLEANING existing SIR values -------------------------------------
as.sir(c("S", "SDD", "I", "R", "NI", "A", "B", "C"))
#> Warning: in `as.sir()`: 3 results in index '20' truncated (38%) that were invalid
#> antimicrobial interpretations: "A", "B", and "C"
#> Class 'sir'
#> [1] S SDD I R NI <NA> <NA> <NA>
as.sir("<= 0.002; S") # will return "S"
#> Class 'sir'
#> [1] S
sir_data <- as.sir(c(rep("S", 474), rep("I", 36), rep("R", 370)))
is.sir(sir_data)
#> [1] TRUE
plot(sir_data) # for percentages
barplot(sir_data) # for frequencies
# as common in R, you can use as.integer() to return factor indices:
as.integer(as.sir(c("S", "SDD", "I", "R", "NI", NA)))
#> [1] 1 2 3 4 5 NA
# but for computational use, as.double() will return 1 for S, 2 for I/SDD, and 3 for R:
as.double(as.sir(c("S", "SDD", "I", "R", "NI", NA)))
#> [1] 1 2 2 3 NA NA
# the dplyr way
if (require("dplyr")) {
example_isolates %>%
mutate_at(vars(PEN:RIF), as.sir)
# same:
example_isolates %>%
as.sir(PEN:RIF)
# fastest way to transform all columns with already valid AMR results to class `sir`:
example_isolates %>%
mutate_if(is_sir_eligible, as.sir)
# since dplyr 1.0.0, this can also be the more impractical:
# example_isolates %>%
# mutate(across(where(is_sir_eligible), as.sir))
}
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
# }
```

View File

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

131
reference/atc_online.md Normal file
View File

@@ -0,0 +1,131 @@
# Get ATC Properties from WHOCC Website
Gets data from the WHOCC website to determine properties of an
Anatomical Therapeutic Chemical (ATC) (e.g. an antimicrobial), such as
the name, defined daily dose (DDD) or standard unit.
## Usage
``` r
atc_online_property(atc_code, property, administration = "O",
url = "https://atcddd.fhi.no/atc_ddd_index/?code=%s&showdescription=no",
url_vet = "https://atcddd.fhi.no/atcvet/atcvet_index/?code=%s&showdescription=no")
atc_online_groups(atc_code, ...)
atc_online_ddd(atc_code, ...)
atc_online_ddd_units(atc_code, ...)
```
## Source
<https://atcddd.fhi.no/atc_ddd_alterations__cumulative/ddd_alterations/abbrevations/>
## Arguments
- atc_code:
A [character](https://rdrr.io/r/base/character.html) (vector) with ATC
code(s) of antimicrobials, will be coerced with
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md) and
[`ab_atc()`](https://amr-for-r.org/reference/ab_property.md)
internally if not a valid ATC code.
- property:
Property of an ATC code. Valid values are `"ATC"`, `"Name"`, `"DDD"`,
`"U"` (`"unit"`), `"Adm.R"`, `"Note"` and `groups`. For this last
option, all hierarchical groups of an ATC code will be returned, see
*Examples*.
- administration:
Type of administration when using `property = "Adm.R"`, see *Details*.
- url:
URL of website of the WHOCC. The sign `%s` can be used as a
placeholder for ATC codes.
- url_vet:
URL of website of the WHOCC for veterinary medicine. The sign `%s` can
be used as a placeholder for ATC_vet codes (that all start with "Q").
- ...:
Arguments to pass on to `atc_property`.
## Details
Options for argument `administration`:
- `"Implant"` = Implant
- `"Inhal"` = Inhalation
- `"Instill"` = Instillation
- `"N"` = nasal
- `"O"` = oral
- `"P"` = parenteral
- `"R"` = rectal
- `"SL"` = sublingual/buccal
- `"TD"` = transdermal
- `"V"` = vaginal
Abbreviations of return values when using `property = "U"` (unit):
- `"g"` = gram
- `"mg"` = milligram
- `"mcg"` = microgram
- `"U"` = unit
- `"TU"` = thousand units
- `"MU"` = million units
- `"mmol"` = millimole
- `"ml"` = millilitre (e.g. eyedrops)
**N.B. This function requires an internet connection and only works if
the following packages are installed: `curl`, `rvest`, `xml2`.**
## Examples
``` r
# \donttest{
if (requireNamespace("curl") && requireNamespace("rvest") && requireNamespace("xml2")) {
# oral DDD (Defined Daily Dose) of amoxicillin
atc_online_property("J01CA04", "DDD", "O")
atc_online_ddd(ab_atc("amox"))
# parenteral DDD (Defined Daily Dose) of amoxicillin
atc_online_property("J01CA04", "DDD", "P")
atc_online_property("J01CA04", property = "groups") # search hierarchical groups of amoxicillin
}
#> Loading required namespace: rvest
#> in `atc_online_property()`: no properties found for ATC QG51AA03. Please
#> check
#> https://atcddd.fhi.no/atcvet/atcvet_index/?code=QG51AA03&showdescription=no.
#> in `atc_online_property()`: no properties found for ATC QJ01CA04. Please
#> check
#> https://atcddd.fhi.no/atcvet/atcvet_index/?code=QJ01CA04&showdescription=no.
#> [1] "ANTIINFECTIVES FOR SYSTEMIC USE"
#> [2] "ANTIBACTERIALS FOR SYSTEMIC USE"
#> [3] "BETA-LACTAM ANTIBACTERIALS, PENICILLINS"
#> [4] "Penicillins with extended spectrum"
# }
```

View File

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

130
reference/av_from_text.md Normal file
View File

@@ -0,0 +1,130 @@
# Retrieve Antiviral Drug Names and Doses from Clinical Text
Use this function on e.g. clinical texts from health care records. It
returns a [list](https://rdrr.io/r/base/list.html) with all antiviral
drugs, doses and forms of administration found in the texts.
## Usage
``` r
av_from_text(text, type = c("drug", "dose", "administration"),
collapse = NULL, translate_av = FALSE, thorough_search = NULL,
info = interactive(), ...)
```
## Arguments
- text:
Text to analyse.
- type:
Type of property to search for, either `"drug"`, `"dose"` or
`"administration"`, see *Examples*.
- collapse:
A [character](https://rdrr.io/r/base/character.html) to pass on to
`paste(, collapse = ...)` to only return one
[character](https://rdrr.io/r/base/character.html) per element of
`text`, see *Examples*.
- translate_av:
If `type = "drug"`: a column name of the
[antivirals](https://amr-for-r.org/reference/antimicrobials.md) data
set to translate the antibiotic abbreviations to, using
[`av_property()`](https://amr-for-r.org/reference/av_property.md). The
default is `FALSE`. Using `TRUE` is equal to using "name".
- thorough_search:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the input must be extensively searched for misspelling and other
faulty input values. Setting this to `TRUE` will take considerably
more time than when using `FALSE`. At default, it will turn `TRUE`
when all input elements contain a maximum of three words.
- info:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether a
progress bar should be printed - the default is `TRUE` only in
interactive mode.
- ...:
Arguments passed on to
[`as.av()`](https://amr-for-r.org/reference/as.av.md).
## Value
A [list](https://rdrr.io/r/base/list.html), or a
[character](https://rdrr.io/r/base/character.html) if `collapse` is not
`NULL`
## Details
This function is also internally used by
[`as.av()`](https://amr-for-r.org/reference/as.av.md), although it then
only searches for the first drug name and will throw a note if more drug
names could have been returned. Note: the
[`as.av()`](https://amr-for-r.org/reference/as.av.md) function may use
very long regular expression to match brand names of antiviral drugs.
This may fail on some systems.
### Argument `type`
At default, the function will search for antiviral drug names. All text
elements will be searched for official names, ATC codes and brand names.
As it uses [`as.av()`](https://amr-for-r.org/reference/as.av.md)
internally, it will correct for misspelling.
With `type = "dose"` (or similar, like "dosing", "doses"), all text
elements will be searched for
[numeric](https://rdrr.io/r/base/numeric.html) values that are higher
than 100 and do not resemble years. The output will be
[numeric](https://rdrr.io/r/base/numeric.html). It supports any unit (g,
mg, IE, etc.) and multiple values in one clinical text, see *Examples*.
With `type = "administration"` (or abbreviations, like "admin", "adm"),
all text elements will be searched for a form of drug administration. It
supports the following forms (including common abbreviations): buccal,
implant, inhalation, instillation, intravenous, nasal, oral, parenteral,
rectal, sublingual, transdermal and vaginal. Abbreviations for oral
(such as 'po', 'per os') will become "oral", all values for intravenous
(such as 'iv', 'intraven') will become "iv". It supports multiple values
in one clinical text, see *Examples*.
### Argument `collapse`
Without using `collapse`, this function will return a
[list](https://rdrr.io/r/base/list.html). This can be convenient to use
e.g. inside a
[`mutate()`](https://dplyr.tidyverse.org/reference/mutate.html)):
`df %>% mutate(avx = av_from_text(clinical_text))`
The returned AV codes can be transformed to official names, groups, etc.
with all [`av_*`](https://amr-for-r.org/reference/av_property.md)
functions such as
[`av_name()`](https://amr-for-r.org/reference/av_property.md) and
[`av_group()`](https://amr-for-r.org/reference/av_property.md), or by
using the `translate_av` argument.
With using `collapse`, this function will return a
[character](https://rdrr.io/r/base/character.html):
`df %>% mutate(avx = av_from_text(clinical_text, collapse = "|"))`
## Examples
``` r
av_from_text("28/03/2020 valaciclovir po tid")
#> [[1]]
#> Class 'av'
#> [1] VALA
#>
av_from_text("28/03/2020 valaciclovir po tid", type = "admin")
#> [[1]]
#> [1] "oral"
#>
```

View File

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

241
reference/av_property.md Normal file
View File

@@ -0,0 +1,241 @@
# Get Properties of an Antiviral Drug
Use these functions to return a specific property of an antiviral drug
from the [antivirals](https://amr-for-r.org/reference/antimicrobials.md)
data set. All input values will be evaluated internally with
[`as.av()`](https://amr-for-r.org/reference/as.av.md).
## Usage
``` r
av_name(x, language = get_AMR_locale(), tolower = FALSE, ...)
av_cid(x, ...)
av_synonyms(x, ...)
av_tradenames(x, ...)
av_group(x, language = get_AMR_locale(), ...)
av_atc(x, ...)
av_loinc(x, ...)
av_ddd(x, administration = "oral", ...)
av_ddd_units(x, administration = "oral", ...)
av_info(x, language = get_AMR_locale(), ...)
av_url(x, open = FALSE, ...)
av_property(x, property = "name", language = get_AMR_locale(), ...)
```
## Arguments
- x:
Any (vector of) text that can be coerced to a valid antiviral drug
code with [`as.av()`](https://amr-for-r.org/reference/as.av.md).
- language:
Language of the returned text - the default is system language (see
[`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md))
and can also be set with the package option
[`AMR_locale`](https://amr-for-r.org/reference/AMR-options.md). Use
`language = NULL` or `language = ""` to prevent translation.
- tolower:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the first [character](https://rdrr.io/r/base/character.html) of every
output should be transformed to a lower case
[character](https://rdrr.io/r/base/character.html).
- ...:
Other arguments passed on to
[`as.av()`](https://amr-for-r.org/reference/as.av.md).
- administration:
Way of administration, either `"oral"` or `"iv"`.
- open:
Browse the URL using
[`utils::browseURL()`](https://rdrr.io/r/utils/browseURL.html).
- property:
One of the column names of one of the
[antivirals](https://amr-for-r.org/reference/antimicrobials.md) data
set: `vector_or(colnames(antivirals), sort = FALSE)`.
## Value
- An [integer](https://rdrr.io/r/base/integer.html) in case of
`av_cid()`
- A named [list](https://rdrr.io/r/base/list.html) in case of
`av_info()` and multiple `av_atc()`/`av_synonyms()`/`av_tradenames()`
- A [double](https://rdrr.io/r/base/double.html) in case of `av_ddd()`
- A [character](https://rdrr.io/r/base/character.html) in all other
cases
## Details
All output [will be
translated](https://amr-for-r.org/reference/translate.md) where
possible.
The function `av_url()` will return the direct URL to the official WHO
website. A warning will be returned if the required ATC code is not
available.
## Source
World Health Organization (WHO) Collaborating Centre for Drug Statistics
Methodology: <https://atcddd.fhi.no/atc_ddd_index/>
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER:
<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
[antivirals](https://amr-for-r.org/reference/antimicrobials.md)
## Examples
``` r
# all properties:
av_name("ACI")
#> [1] "Aciclovir"
av_atc("ACI")
#> [1] "J05AB01"
av_cid("ACI")
#> [1] 135398513
av_synonyms("ACI")
#> [1] "acicloftal" "aciclovier" "aciclovirum"
#> [4] "activir" "acyclofoam" "acycloguanosine"
#> [7] "acyclovir" "acyclovir lauriad" "avaclyr"
#> [10] "cargosil" "cyclovir" "genvir"
#> [13] "gerpevir" "hascovir" "maynar"
#> [16] "novirus" "poviral" "sitavig"
#> [19] "sitavir" "vipral" "viropump"
#> [22] "virorax" "zovirax" "zyclir"
av_tradenames("ACI")
#> [1] "acicloftal" "aciclovier" "aciclovirum"
#> [4] "activir" "acyclofoam" "acycloguanosine"
#> [7] "acyclovir" "acyclovir lauriad" "avaclyr"
#> [10] "cargosil" "cyclovir" "genvir"
#> [13] "gerpevir" "hascovir" "maynar"
#> [16] "novirus" "poviral" "sitavig"
#> [19] "sitavir" "vipral" "viropump"
#> [22] "virorax" "zovirax" "zyclir"
av_group("ACI")
#> [1] "Nucleosides and nucleotides excl. reverse transcriptase inhibitors"
av_url("ACI")
#> Aciclovir
#> "https://atcddd.fhi.no/atc_ddd_index/?code=J05AB01&showdescription=no"
# lowercase transformation
av_name(x = c("ACI", "VALA"))
#> [1] "Aciclovir" "Valaciclovir"
av_name(x = c("ACI", "VALA"), tolower = TRUE)
#> [1] "aciclovir" "valaciclovir"
# defined daily doses (DDD)
av_ddd("ACI", "oral")
#> [1] 4
av_ddd_units("ACI", "oral")
#> [1] "g"
av_ddd("ACI", "iv")
#> [1] 4
av_ddd_units("ACI", "iv")
#> [1] "g"
av_info("ACI") # all properties as a list
#> $av
#> [1] "ACI"
#>
#> $cid
#> [1] 135398513
#>
#> $name
#> [1] "Aciclovir"
#>
#> $group
#> [1] "Nucleosides and nucleotides excl. reverse transcriptase inhibitors"
#>
#> $atc
#> [1] "J05AB01"
#>
#> $tradenames
#> [1] "acicloftal" "aciclovier" "aciclovirum"
#> [4] "activir" "acyclofoam" "acycloguanosine"
#> [7] "acyclovir" "acyclovir lauriad" "avaclyr"
#> [10] "cargosil" "cyclovir" "genvir"
#> [13] "gerpevir" "hascovir" "maynar"
#> [16] "novirus" "poviral" "sitavig"
#> [19] "sitavir" "vipral" "viropump"
#> [22] "virorax" "zovirax" "zyclir"
#>
#> $loinc
#> [1] ""
#>
#> $ddd
#> $ddd$oral
#> $ddd$oral$amount
#> [1] 4
#>
#> $ddd$oral$units
#> [1] "g"
#>
#>
#> $ddd$iv
#> $ddd$iv$amount
#> [1] 4
#>
#> $ddd$iv$units
#> [1] "g"
#>
#>
#>
# all av_* functions use as.av() internally, so you can go from 'any' to 'any':
av_atc("ACI")
#> [1] "J05AB01"
av_group("J05AB01")
#> [1] "Nucleosides and nucleotides excl. reverse transcriptase inhibitors"
av_loinc("abacavir")
#> [1] "29113-8" "30273-7" "30287-7" "30303-2" "78772-1" "78773-9" "79134-3"
#> [8] "80118-3"
av_name("29113-8")
#> [1] "Abacavir"
av_name(135398513)
#> [1] "Aciclovir"
av_name("J05AB01")
#> [1] "Aciclovir"
```

View File

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

140
reference/availability.md Normal file
View File

@@ -0,0 +1,140 @@
# Check Availability of Columns
Easy check for data availability of all columns in a data set. This
makes it easy to get an idea of which antimicrobial combinations can be
used for calculation with e.g.
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md) and
[`resistance()`](https://amr-for-r.org/reference/proportion.md).
## Usage
``` r
availability(tbl, width = NULL)
```
## Arguments
- tbl:
A [data.frame](https://rdrr.io/r/base/data.frame.html) or
[list](https://rdrr.io/r/base/list.html).
- width:
Number of characters to present the visual availability - the default
is filling the width of the console.
## Value
[data.frame](https://rdrr.io/r/base/data.frame.html) with column names
of `tbl` as row names
## Details
The function returns a
[data.frame](https://rdrr.io/r/base/data.frame.html) with columns
`"resistant"` and `"visual_resistance"`. The values in that columns are
calculated with
[`resistance()`](https://amr-for-r.org/reference/proportion.md).
## Examples
``` r
availability(example_isolates)
#> count available visual_availabilty resistant visual_resistance
#> date 2000 100.0% |####################|
#> patient 2000 100.0% |####################|
#> age 2000 100.0% |####################|
#> gender 2000 100.0% |####################|
#> ward 2000 100.0% |####################|
#> mo 2000 100.0% |####################|
#> PEN 1629 81.5% |################----| 73.7% |##############------|
#> OXA 365 18.3% |###-----------------| 31.2% |######--------------|
#> FLC 943 47.2% |#########-----------| 29.5% |#####---------------|
#> AMX 1350 67.5% |#############-------| 59.6% |###########---------|
#> AMC 1879 94.0% |##################--| 23.7% |####----------------|
#> AMP 1350 67.5% |#############-------| 59.6% |###########---------|
#> TZP 1001 50.0% |##########----------| 12.6% |##------------------|
#> CZO 446 22.3% |####----------------| 44.6% |########------------|
#> FEP 724 36.2% |#######-------------| 14.2% |##------------------|
#> CXM 1789 89.5% |#################---| 26.3% |#####---------------|
#> FOX 818 40.9% |########------------| 27.4% |#####---------------|
#> CTX 943 47.2% |#########-----------| 15.5% |###-----------------|
#> CAZ 1811 90.6% |##################--| 66.5% |#############-------|
#> CRO 943 47.2% |#########-----------| 15.5% |###-----------------|
#> GEN 1855 92.8% |##################--| 24.6% |####----------------|
#> TOB 1351 67.6% |#############-------| 34.4% |######--------------|
#> AMK 692 34.6% |######--------------| 63.7% |############--------|
#> KAN 471 23.6% |####----------------| 100.0% |####################|
#> TMP 1499 75.0% |###############-----| 38.1% |#######-------------|
#> SXT 1759 88.0% |#################---| 20.5% |####----------------|
#> NIT 743 37.2% |#######-------------| 17.1% |###-----------------|
#> FOS 351 17.6% |###-----------------| 42.2% |########------------|
#> LNZ 1023 51.2% |##########----------| 69.3% |#############-------|
#> CIP 1409 70.5% |#############-------| 16.2% |###-----------------|
#> MFX 211 10.6% |##------------------| 33.6% |######--------------|
#> VAN 1861 93.1% |##################--| 38.3% |#######-------------|
#> TEC 976 48.8% |#########-----------| 75.7% |###############-----|
#> TCY 1200 60.0% |###########---------| 29.8% |#####---------------|
#> TGC 798 39.9% |########------------| 12.7% |##------------------|
#> DOX 1136 56.8% |###########---------| 27.7% |#####---------------|
#> ERY 1894 94.7% |##################--| 57.2% |###########---------|
#> CLI 1520 76.0% |###############-----| 61.2% |############--------|
#> AZM 1894 94.7% |##################--| 57.2% |###########---------|
#> IPM 889 44.5% |########------------| 6.2% |#-------------------|
#> MEM 829 41.5% |########------------| 5.9% |#-------------------|
#> MTR 34 1.7% |--------------------| 14.7% |##------------------|
#> CHL 154 7.7% |#-------------------| 21.4% |####----------------|
#> COL 1640 82.0% |################----| 81.2% |################----|
#> MUP 270 13.5% |##------------------| 5.9% |#-------------------|
#> RIF 1003 50.2% |##########----------| 69.6% |#############-------|
# \donttest{
if (require("dplyr")) {
example_isolates %>%
filter(mo == as.mo("Escherichia coli")) %>%
select_if(is.sir) %>%
availability()
}
#> count available visual_availabilty resistant visual_resistance
#> PEN 467 100.0% |######################| 100.0% |######################|
#> OXA 0 0.0% |----------------------|
#> FLC 0 0.0% |----------------------|
#> AMX 392 83.9% |##################----| 50.0% |###########-----------|
#> AMC 467 100.0% |######################| 13.1% |##--------------------|
#> AMP 392 83.9% |##################----| 50.0% |###########-----------|
#> TZP 416 89.1% |###################---| 5.5% |#---------------------|
#> CZO 82 17.6% |###-------------------| 2.4% |----------------------|
#> FEP 317 67.9% |##############--------| 2.8% |----------------------|
#> CXM 465 99.6% |######################| 5.4% |#---------------------|
#> FOX 377 80.7% |#################-----| 6.9% |#---------------------|
#> CTX 459 98.3% |#####################-| 2.4% |----------------------|
#> CAZ 460 98.5% |#####################-| 2.4% |----------------------|
#> CRO 459 98.3% |#####################-| 2.4% |----------------------|
#> GEN 460 98.5% |#####################-| 2.0% |----------------------|
#> TOB 462 98.9% |#####################-| 2.6% |----------------------|
#> AMK 171 36.6% |########--------------| 0.0% |----------------------|
#> KAN 0 0.0% |----------------------|
#> TMP 396 84.8% |##################----| 39.1% |########--------------|
#> SXT 465 99.6% |######################| 31.6% |######----------------|
#> NIT 458 98.1% |#####################-| 2.8% |----------------------|
#> FOS 61 13.1% |##--------------------| 0.0% |----------------------|
#> LNZ 467 100.0% |######################| 100.0% |######################|
#> CIP 456 97.6% |#####################-| 12.5% |##--------------------|
#> MFX 57 12.2% |##--------------------| 100.0% |######################|
#> VAN 467 100.0% |######################| 100.0% |######################|
#> TEC 467 100.0% |######################| 100.0% |######################|
#> TCY 3 0.6% |----------------------| 66.7% |##############--------|
#> TGC 68 14.6% |###-------------------| 0.0% |----------------------|
#> DOX 0 0.0% |----------------------|
#> ERY 467 100.0% |######################| 100.0% |######################|
#> CLI 467 100.0% |######################| 100.0% |######################|
#> AZM 467 100.0% |######################| 100.0% |######################|
#> IPM 422 90.4% |###################---| 0.0% |----------------------|
#> MEM 418 89.5% |###################---| 0.0% |----------------------|
#> MTR 2 0.4% |----------------------| 0.0% |----------------------|
#> CHL 0 0.0% |----------------------|
#> COL 240 51.4% |###########-----------| 0.0% |----------------------|
#> MUP 0 0.0% |----------------------|
#> RIF 467 100.0% |######################| 100.0% |######################|
# }
```

View File

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

@@ -0,0 +1,218 @@
# Determine Bug-Drug Combinations
Determine antimicrobial resistance (AMR) of all bug-drug combinations in
your data set where at least 30 (default) isolates are available per
species. Use [`format()`](https://rdrr.io/r/base/format.html) on the
result to prettify it to a publishable/printable format, see *Examples*.
## Usage
``` r
bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname,
include_n_rows = FALSE, ...)
# S3 method for class 'bug_drug_combinations'
format(x, translate_ab = "name (ab, atc)",
language = get_AMR_locale(), minimum = 30, combine_SI = TRUE,
add_ab_group = TRUE, remove_intrinsic_resistant = FALSE,
decimal.mark = getOption("OutDec"), big.mark = ifelse(decimal.mark ==
",", ".", ","), ...)
```
## Arguments
- x:
A data set with antimicrobials columns, such as `amox`, `AMX` and
`AMC`.
- col_mo:
Column name of the names or codes of the microorganisms (see
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md)) - the default
is the first column of class
[`mo`](https://amr-for-r.org/reference/as.mo.md). Values will be
coerced using [`as.mo()`](https://amr-for-r.org/reference/as.mo.md).
- FUN:
The function to call on the `mo` column to transform the microorganism
codes - the default is
[`mo_shortname()`](https://amr-for-r.org/reference/mo_property.md).
- include_n_rows:
A [logical](https://rdrr.io/r/base/logical.html) to indicate if the
total number of rows must be included in the output.
- ...:
Arguments passed on to `FUN`.
- translate_ab:
A [character](https://rdrr.io/r/base/character.html) of length 1
containing column names of the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set.
- language:
Language of the returned text - the default is the current system
language (see
[`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md))
and can also be set with the package option
[`AMR_locale`](https://amr-for-r.org/reference/AMR-options.md). Use
`language = NULL` or `language = ""` to prevent translation.
- minimum:
The minimum allowed number of available (tested) isolates. Any isolate
count lower than `minimum` will return `NA` with a warning. The
default number of `30` isolates is advised by the Clinical and
Laboratory Standards Institute (CLSI) as best practice, see *Source*.
- combine_SI:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
values S, SDD, and I should be summed, so resistance will be based on
only R - the default is `TRUE`.
- add_ab_group:
A [logical](https://rdrr.io/r/base/logical.html) to indicate where the
group of the antimicrobials must be included as a first column.
- remove_intrinsic_resistant:
[logical](https://rdrr.io/r/base/logical.html) to indicate that rows
and columns with 100% resistance for all tested antimicrobials must be
removed from the table.
- decimal.mark:
the character to be used to indicate the numeric decimal point.
- big.mark:
character; if not empty used as mark between every `big.interval`
decimals *before* (hence `big`) the decimal point.
## Value
The function `bug_drug_combinations()` returns a
[data.frame](https://rdrr.io/r/base/data.frame.html) with columns "mo",
"ab", "S", "SDD", "I", "R", and "total".
## Details
The function [`format()`](https://rdrr.io/r/base/format.html) calculates
the resistance per bug-drug combination and returns a table ready for
reporting/publishing. Use `combine_SI = TRUE` (default) to test R vs.
S+I and `combine_SI = FALSE` to test R+I vs. S. This table can also
directly be used in R Markdown / Quarto without the need for e.g.
[`knitr::kable()`](https://rdrr.io/pkg/knitr/man/kable.html).
## Examples
``` r
# example_isolates is a data set available in the AMR package.
# run ?example_isolates for more info.
example_isolates
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
# \donttest{
x <- bug_drug_combinations(example_isolates)
head(x)
#> # A tibble: 6 × 8
#> mo ab S SDD I R NI total
#> <chr> <chr> <int> <int> <int> <int> <int> <int>
#> 1 (unknown species) AMC 15 0 0 0 0 15
#> 2 (unknown species) AMK 0 0 0 0 0 0
#> 3 (unknown species) AMP 15 0 0 1 0 16
#> 4 (unknown species) AMX 15 0 0 1 0 16
#> 5 (unknown species) AZM 3 0 0 3 0 6
#> 6 (unknown species) CAZ 0 0 0 0 0 0
#> Use 'format()' on this result to get a publishable/printable format.
format(x, translate_ab = "name (atc)")
#> # A tibble: 39 × 12
#> Group Drug CoNS `E. coli` `E. faecalis` `K. pneumoniae` `P. aeruginosa`
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 "Aminogl… Amik… "100… " 0.0% … "100.0% (39/… "" ""
#> 2 "" Gent… " 13… " 2.0% … "100.0% (39/… " 10.3% (6/58)" " 0.0% (0/30)"
#> 3 "" Kana… "100… "" "100.0% (39/… "" "100.0% (30/30…
#> 4 "" Tobr… " 78… " 2.6% … "100.0% (39/… " 10.3% (6/58)" " 0.0% (0/30)"
#> 5 "Antimyc… Rifa… "" "100.0% … "" "100.0% (58/58… "100.0% (30/30…
#> 6 "Beta-la… Amox… " 93… " 50.0% … "" "100.0% (58/58… "100.0% (30/30…
#> 7 "" Amox… " 42… " 13.1% … "" " 10.3% (6/58)" "100.0% (30/30…
#> 8 "" Ampi… " 93… " 50.0% … "" "100.0% (58/58… "100.0% (30/30…
#> 9 "" Benz… " 77… "100.0% … "" "100.0% (58/58… "100.0% (30/30…
#> 10 "" Fluc… " 42… "" "" "" ""
#> # 29 more rows
#> # 5 more variables: `P. mirabilis` <chr>, `S. aureus` <chr>,
#> # `S. epidermidis` <chr>, `S. hominis` <chr>, `S. pneumoniae` <chr>
# Use FUN to change to transformation of microorganism codes
bug_drug_combinations(example_isolates,
FUN = mo_gramstain
)
#> # A tibble: 80 × 8
#> mo ab S SDD I R NI total
#> <chr> <chr> <int> <int> <int> <int> <int> <int>
#> 1 Gram-negative AMC 463 0 89 174 0 726
#> 2 Gram-negative AMK 251 0 0 5 0 256
#> 3 Gram-negative AMP 226 0 0 405 0 631
#> 4 Gram-negative AMX 226 0 0 405 0 631
#> 5 Gram-negative AZM 1 0 2 696 0 699
#> 6 Gram-negative CAZ 607 0 0 27 0 634
#> 7 Gram-negative CHL 1 0 0 30 0 31
#> 8 Gram-negative CIP 610 0 11 63 0 684
#> 9 Gram-negative CLI 18 0 1 709 0 728
#> 10 Gram-negative COL 309 0 0 78 0 387
#> # 70 more rows
#> Use 'format()' on this result to get a publishable/printable format.
bug_drug_combinations(example_isolates,
FUN = function(x) {
ifelse(x == as.mo("Escherichia coli"),
"E. coli",
"Others"
)
}
)
#> # A tibble: 80 × 8
#> mo ab S SDD I R NI total
#> <chr> <chr> <int> <int> <int> <int> <int> <int>
#> 1 E. coli AMC 332 0 74 61 0 467
#> 2 E. coli AMK 171 0 0 0 0 171
#> 3 E. coli AMP 196 0 0 196 0 392
#> 4 E. coli AMX 196 0 0 196 0 392
#> 5 E. coli AZM 0 0 0 467 0 467
#> 6 E. coli CAZ 449 0 0 11 0 460
#> 7 E. coli CHL 0 0 0 0 0 0
#> 8 E. coli CIP 398 0 1 57 0 456
#> 9 E. coli CLI 0 0 0 467 0 467
#> 10 E. coli COL 240 0 0 0 0 240
#> # 70 more rows
#> Use 'format()' on this result to get a publishable/printable format.
# }
```

View File

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

@@ -0,0 +1,173 @@
# Data Set with Clinical Breakpoints for SIR Interpretation
Data set containing clinical breakpoints to interpret MIC and disk
diffusion to SIR values, according to international guidelines. This
dataset contain breakpoints for humans, 7 different animal groups, and
ECOFFs.
These breakpoints are currently implemented:
- For **clinical microbiology**: EUCAST 2011-2025 and CLSI 2011-2025;
- For **veterinary microbiology**: EUCAST 2021-2025 and CLSI 2019-2025;
- For **ECOFFs** (Epidemiological Cut-off Values): EUCAST 2020-2025 and
CLSI 2022-2025.
Use [`as.sir()`](https://amr-for-r.org/reference/as.sir.md) to transform
MICs or disks measurements to SIR values.
## Usage
``` r
clinical_breakpoints
```
## Format
A [tibble](https://tibble.tidyverse.org/reference/tibble.html) with 40
217 observations and 14 variables:
- `guideline`
Name of the guideline
- `type`
Breakpoint type, either "ECOFF", "animal", or "human"
- `host`
Host of infectious agent. This is mostly useful for veterinary
breakpoints and is either "ECOFF", "aquatic", "cats", "cattle",
"dogs", "horse", "human", "poultry", or "swine"
- `method`
Testing method, either "DISK" or "MIC"
- `site`
Body site for which the breakpoint must be applied, e.g. "Oral" or
"Respiratory"
- `mo`
Microbial ID, see
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md)
- `rank_index`
Taxonomic rank index of `mo` from 1 (subspecies/infraspecies) to 5
(unknown microorganism)
- `ab`
Antimicrobial code as used by this package, EARS-Net and WHONET, see
[`as.ab()`](https://amr-for-r.org/reference/as.ab.md)
- `ref_tbl`
Info about where the guideline rule can be found
- `disk_dose`
Dose of the used disk diffusion method
- `breakpoint_S`
Lowest MIC value or highest number of millimetres that leads to "S"
- `breakpoint_R`
Highest MIC value or lowest number of millimetres that leads to "R",
can be `NA`
- `uti`
A [logical](https://rdrr.io/r/base/logical.html) value
(`TRUE`/`FALSE`) to indicate whether the rule applies to a urinary
tract infection (UTI)
- `is_SDD`
A [logical](https://rdrr.io/r/base/logical.html) value
(`TRUE`/`FALSE`) to indicate whether the intermediate range between
"S" and "R" should be interpreted as "SDD", instead of "I". This
currently applies to 48 breakpoints.
## Details
### Different Types of Breakpoints
Supported types of breakpoints are ECOFF, animal, and human. ECOFF
(Epidemiological cut-off) values are used in antimicrobial
susceptibility testing to differentiate between wild-type and
non-wild-type strains of bacteria or fungi.
The default is `"human"`, which can also be set with the package option
[`AMR_breakpoint_type`](https://amr-for-r.org/reference/AMR-options.md).
Use
[`as.sir(..., breakpoint_type = ...)`](https://amr-for-r.org/reference/as.sir.md)
to interpret raw data using a specific breakpoint type, e.g.
`as.sir(..., breakpoint_type = "ECOFF")` to use ECOFFs.
### Imported From WHONET
Clinical breakpoints in this package were validated through and imported
from [WHONET](https://whonet.org), a free desktop Windows application
developed and supported by the WHO Collaborating Centre for Surveillance
of Antimicrobial Resistance. More can be read on [their
website](https://whonet.org). The developers of WHONET and this `AMR`
package have been in contact about sharing their work. We highly
appreciate their great development on the WHONET software.
Our import and reproduction script can be found here:
<https://github.com/msberends/AMR/blob/main/data-raw/_reproduction_scripts/reproduction_of_clinical_breakpoints.R>.
### Response From CLSI and EUCAST
The CEO of CLSI and the chairman of EUCAST have endorsed the work and
public use of this `AMR` package (and consequently the use of their
breakpoints) in June 2023, when future development of distributing
clinical breakpoints was discussed in a meeting between CLSI, EUCAST,
WHO, developers of WHONET software, and developers of this `AMR`
package.
### Download Note
This `AMR` package (and the WHONET software as well) contains rather
complex internal methods to apply the guidelines. For example, some
breakpoints must be applied on certain species groups (which are in case
of this package available through the
[microorganisms.groups](https://amr-for-r.org/reference/microorganisms.groups.md)
data set). It is important that this is considered when implementing the
breakpoints for own use.
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## See also
[intrinsic_resistant](https://amr-for-r.org/reference/intrinsic_resistant.md)
## Examples
``` r
clinical_breakpoints
#> # A tibble: 40,217 × 14
#> guideline type host method site mo rank_index ab ref_tbl
#> <chr> <chr> <chr> <chr> <chr> <mo> <dbl> <ab> <chr>
#> 1 EUCAST 2025 human human DISK NA B_ACHRMB_XYLS 2 MEM A. xylo…
#> 2 EUCAST 2025 human human MIC NA B_ACHRMB_XYLS 2 MEM A. xylo…
#> 3 EUCAST 2025 human human DISK NA B_ACHRMB_XYLS 2 SXT A. xylo…
#> 4 EUCAST 2025 human human MIC NA B_ACHRMB_XYLS 2 SXT A. xylo…
#> 5 EUCAST 2025 human human DISK NA B_ACHRMB_XYLS 2 TZP A. xylo…
#> 6 EUCAST 2025 human human MIC NA B_ACHRMB_XYLS 2 TZP A. xylo…
#> 7 EUCAST 2025 human human DISK NA B_ACNTB 3 AMK Acineto…
#> 8 EUCAST 2025 human human DISK Uncomp… B_ACNTB 3 AMK Acineto…
#> 9 EUCAST 2025 human human MIC NA B_ACNTB 3 AMK Acineto…
#> 10 EUCAST 2025 human human MIC Uncomp… B_ACNTB 3 AMK Acineto…
#> # 40,207 more rows
#> # 5 more variables: disk_dose <chr>, breakpoint_S <dbl>, breakpoint_R <dbl>,
#> # uti <lgl>, is_SDD <lgl>
```

View File

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

270
reference/count.md Normal file
View File

@@ -0,0 +1,270 @@
# Count Available Isolates
These functions can be used to count resistant/susceptible microbial
isolates. All functions support quasiquotation with pipes, can be used
in [`summarise()`](https://dplyr.tidyverse.org/reference/summarise.html)
from the `dplyr` package and also support grouped variables, see
*Examples*.
`count_resistant()` should be used to count resistant isolates,
`count_susceptible()` should be used to count susceptible isolates.
## Usage
``` r
count_resistant(..., only_all_tested = FALSE)
count_susceptible(..., only_all_tested = FALSE)
count_S(..., only_all_tested = FALSE)
count_SI(..., only_all_tested = FALSE)
count_I(..., only_all_tested = FALSE)
count_IR(..., only_all_tested = FALSE)
count_R(..., only_all_tested = FALSE)
count_all(..., only_all_tested = FALSE)
n_sir(..., only_all_tested = FALSE)
count_df(data, translate_ab = "name", language = get_AMR_locale(),
combine_SI = TRUE)
```
## Arguments
- ...:
One or more vectors (or columns) with antibiotic interpretations. They
will be transformed internally with
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md) if needed.
- only_all_tested:
(for combination therapies, i.e. using more than one variable for
`...`): a [logical](https://rdrr.io/r/base/logical.html) to indicate
that isolates must be tested for all antimicrobials, see section
*Combination Therapy* below.
- data:
A [data.frame](https://rdrr.io/r/base/data.frame.html) containing
columns with class [`sir`](https://amr-for-r.org/reference/as.sir.md)
(see [`as.sir()`](https://amr-for-r.org/reference/as.sir.md)).
- translate_ab:
A column name of the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set to translate the antibiotic abbreviations to, using
[`ab_property()`](https://amr-for-r.org/reference/ab_property.md).
- language:
Language of the returned text - the default is the current system
language (see
[`get_AMR_locale()`](https://amr-for-r.org/reference/translate.md))
and can also be set with the package option
[`AMR_locale`](https://amr-for-r.org/reference/AMR-options.md). Use
`language = NULL` or `language = ""` to prevent translation.
- combine_SI:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
all values of S, SDD, and I must be merged into one, so the output
only consists of S+SDD+I vs. R (susceptible vs. resistant) - the
default is `TRUE`.
## Value
An [integer](https://rdrr.io/r/base/integer.html)
## Details
These functions are meant to count isolates. Use the
[`resistance()`](https://amr-for-r.org/reference/proportion.md)/[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
functions to calculate microbial resistance/susceptibility.
The function `count_resistant()` is equal to the function `count_R()`.
The function `count_susceptible()` is equal to the function
`count_SI()`.
The function `n_sir()` is an alias of `count_all()`. They can be used to
count all available isolates, i.e. where all input antimicrobials have
an available result (S, I or R). Their use is equal to
[`n_distinct()`](https://dplyr.tidyverse.org/reference/n_distinct.html).
Their function is equal to
`count_susceptible(...) + count_resistant(...)`.
The function `count_df()` takes any variable from `data` that has an
[`sir`](https://amr-for-r.org/reference/as.sir.md) class (created with
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md)) and counts the
number of S's, I's and R's. It also supports grouped variables. The
function [`sir_df()`](https://amr-for-r.org/reference/proportion.md)
works exactly like `count_df()`, but adds the percentage of S, I and R.
## Interpretation of SIR
In 2019, the European Committee on Antimicrobial Susceptibility Testing
(EUCAST) has decided to change the definitions of susceptibility testing
categories S, I, and R (<https://www.eucast.org/newsiandr>).
This AMR package follows insight; use
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
(equal to
[`proportion_SI()`](https://amr-for-r.org/reference/proportion.md)) to
determine antimicrobial susceptibility and `count_susceptible()` (equal
to `count_SI()`) to count susceptible isolates.
## Combination Therapy
When using more than one variable for `...` (= combination therapy), use
`only_all_tested` to only count isolates that are tested for all
antimicrobials/variables that you test them for. See this example for
two antimicrobials, Drug A and Drug B, about how
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md)
works to calculate the %SI:
--------------------------------------------------------------------
only_all_tested = FALSE only_all_tested = TRUE
----------------------- -----------------------
Drug A Drug B considered considered considered considered
susceptible tested susceptible tested
-------- -------- ----------- ---------- ----------- ----------
S or I S or I X X X X
R S or I X X X X
<NA> S or I X X - -
S or I R X X X X
R R - X - X
<NA> R - - - -
S or I <NA> X X - -
R <NA> - - - -
<NA> <NA> - - - -
--------------------------------------------------------------------
Please note that, in combination therapies, for `only_all_tested = TRUE`
applies that:
count_S() + count_I() + count_R() = count_all()
proportion_S() + proportion_I() + proportion_R() = 1
and that, in combination therapies, for `only_all_tested = FALSE`
applies that:
count_S() + count_I() + count_R() >= count_all()
proportion_S() + proportion_I() + proportion_R() >= 1
Using `only_all_tested` has no impact when only using one antibiotic as
input.
## See also
[`proportion_*`](https://amr-for-r.org/reference/proportion.md) to
calculate microbial resistance and susceptibility.
## Examples
``` r
# example_isolates is a data set available in the AMR package.
# run ?example_isolates for more info.
# base R ------------------------------------------------------------
count_resistant(example_isolates$AMX) # counts "R"
#> [1] 804
count_susceptible(example_isolates$AMX) # counts "S" and "I"
#> [1] 546
count_all(example_isolates$AMX) # counts "S", "I" and "R"
#> [1] 1350
# be more specific
count_S(example_isolates$AMX)
#> [1] 543
count_SI(example_isolates$AMX)
#> [1] 546
count_I(example_isolates$AMX)
#> [1] 3
count_IR(example_isolates$AMX)
#> [1] 807
count_R(example_isolates$AMX)
#> [1] 804
# Count all available isolates
count_all(example_isolates$AMX)
#> [1] 1350
n_sir(example_isolates$AMX)
#> [1] 1350
# n_sir() is an alias of count_all().
# Since it counts all available isolates, you can
# calculate back to count e.g. susceptible isolates.
# These results are the same:
count_susceptible(example_isolates$AMX)
#> [1] 546
susceptibility(example_isolates$AMX) * n_sir(example_isolates$AMX)
#> [1] 546
# dplyr -------------------------------------------------------------
# \donttest{
if (require("dplyr")) {
example_isolates %>%
group_by(ward) %>%
summarise(
R = count_R(CIP),
I = count_I(CIP),
S = count_S(CIP),
n1 = count_all(CIP), # the actual total; sum of all three
n2 = n_sir(CIP), # same - analogous to n_distinct
total = n()
) # NOT the number of tested isolates!
# Number of available isolates for a whole antibiotic class
# (i.e., in this data set columns GEN, TOB, AMK, KAN)
example_isolates %>%
group_by(ward) %>%
summarise(across(aminoglycosides(), n_sir))
# Count co-resistance between amoxicillin/clav acid and gentamicin,
# so we can see that combination therapy does a lot more than mono therapy.
# Please mind that `susceptibility()` calculates percentages right away instead.
example_isolates %>% count_susceptible(AMC) # 1433
example_isolates %>% count_all(AMC) # 1879
example_isolates %>% count_susceptible(GEN) # 1399
example_isolates %>% count_all(GEN) # 1855
example_isolates %>% count_susceptible(AMC, GEN) # 1764
example_isolates %>% count_all(AMC, GEN) # 1936
# Get number of S+I vs. R immediately of selected columns
example_isolates %>%
select(AMX, CIP) %>%
count_df(translate = FALSE)
# It also supports grouping variables
example_isolates %>%
select(ward, AMX, CIP) %>%
group_by(ward) %>%
count_df(translate = FALSE)
}
#> For `aminoglycosides()` using columns 'GEN' (gentamicin), 'TOB'
#> (tobramycin), 'AMK' (amikacin), and 'KAN' (kanamycin)
#> # A tibble: 12 × 4
#> ward antibiotic interpretation value
#> <chr> <chr> <ord> <int>
#> 1 Clinical AMX SI 357
#> 2 Clinical AMX R 487
#> 3 Clinical CIP SI 741
#> 4 Clinical CIP R 128
#> 5 ICU AMX SI 158
#> 6 ICU AMX R 270
#> 7 ICU CIP SI 362
#> 8 ICU CIP R 85
#> 9 Outpatient AMX SI 31
#> 10 Outpatient AMX R 47
#> 11 Outpatient CIP SI 78
#> 12 Outpatient CIP R 15
# }
```

View File

@@ -7,7 +7,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -151,16 +151,16 @@
<li><p>aminopenicillins<br>(amoxicillin and ampicillin)</p></li>
<li><p>antifungals<br>(amorolfine, amphotericin B, amphotericin B-high, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole, and voriconazole)</p></li>
<li><p>antimycobacterials<br>(4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide, p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/ethambutol/isoniazid, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone, thioacetazone/isoniazid, tiocarlide, and viomycin)</p></li>
<li><p>betalactams<br>(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam)</p></li>
<li><p>betalactams_with_inhibitor<br>(amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid)</p></li>
<li><p>carbapenems<br>(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, and tebipenem)</p></li>
<li><p>cephalosporins<br>(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)</p></li>
<li><p>betalactams<br>(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, taniborbactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam)</p></li>
<li><p>betalactams_with_inhibitor<br>(amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid)</p></li>
<li><p>carbapenems<br>(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, taniborbactam, and tebipenem)</p></li>
<li><p>cephalosporins<br>(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)</p></li>
<li><p>cephalosporins_1st<br>(cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin, cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, and cephradine)</p></li>
<li><p>cephalosporins_2nd<br>(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime, cefuroxime axetil, and loracarbef)</p></li>
<li><p>cephalosporins_3rd<br>(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, and latamoxef)</p></li>
<li><p>cephalosporins_4th<br>(cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome)</p></li>
<li><p>cephalosporins_4th<br>(cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome)</p></li>
<li><p>cephalosporins_5th<br>(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, and ceftolozane/tazobactam)</p></li>
<li><p>cephalosporins_except_caz<br>(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)</p></li>
<li><p>cephalosporins_except_caz<br>(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef)</p></li>
<li><p>fluoroquinolones<br>(besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole, ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test, norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin, pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and trovafloxacin)</p></li>
<li><p>glycopeptides<br>(avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, and vancomycin-macromethod)</p></li>
<li><p>glycopeptides_except_lipo<br>(avoparcin, bleomycin, norvancomycin, ramoplanin, teicoplanin, teicoplanin-macromethod, vancomycin, and vancomycin-macromethod)</p></li>
@@ -239,7 +239,8 @@
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #0000BB;">biapenem</span> (BIA), <span style="color: #0000BB;">doripenem</span> (DOR), <span style="color: #0000BB;">ertapenem</span> (ETP), <span style="color: #0000BB;">imipenem</span> (IPM),</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #0000BB;">imipenem/EDTA</span> (IPE), <span style="color: #0000BB;">imipenem/relebactam</span> (IMR), <span style="color: #0000BB;">meropenem</span> (MEM),</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #0000BB;">meropenem/nacubactam</span> (MNC), <span style="color: #0000BB;">meropenem/vaborbactam</span> (MEV), <span style="color: #0000BB;">panipenem</span> (PAN),</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #0000BB;">razupenem</span> (RZM), <span style="color: #0000BB;">ritipenem</span> (RIT), <span style="color: #0000BB;">ritipenem acoxil</span> (RIA), <span style="color: #0000BB;">tebipenem</span> (TBP)</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> <span style="color: #0000BB;">razupenem</span> (RZM), <span style="color: #0000BB;">ritipenem</span> (RIT), <span style="color: #0000BB;">ritipenem acoxil</span> (RIA), <span style="color: #0000BB;">taniborbactam</span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> (TAN), <span style="color: #0000BB;">tebipenem</span> (TBP)</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>

View File

@@ -0,0 +1,504 @@
# Define Custom EUCAST Rules
Define custom EUCAST rules for your organisation or specific analysis
and use the output of this function in
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md).
## Usage
``` r
custom_eucast_rules(...)
```
## Arguments
- ...:
Rules in [formula](https://rdrr.io/r/base/tilde.html) notation, see
below for instructions, and in *Examples*.
## Value
A [list](https://rdrr.io/r/base/list.html) containing the custom rules
## Details
Some organisations have their own adoption of EUCAST rules. This
function can be used to define custom EUCAST rules to be used in the
[`eucast_rules()`](https://amr-for-r.org/reference/eucast_rules.md)
function.
### Basics
If you are familiar with the
[`case_when()`](https://dplyr.tidyverse.org/reference/case_when.html)
function of the `dplyr` package, you will recognise the input method to
set your own rules. Rules must be set using what R considers to be the
'formula notation'. The rule itself is written *before* the tilde (`~`)
and the consequence of the rule is written *after* the tilde:
x <- custom_eucast_rules(TZP == "S" ~ aminopenicillins == "S",
TZP == "R" ~ aminopenicillins == "R")
These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is
"S", all aminopenicillins (ampicillin and amoxicillin) must be made "S",
and if TZP is "R", aminopenicillins must be made "R". These rules can
also be printed to the console, so it is immediately clear how they
work:
x
#> A set of custom EUCAST rules:
#>
#> 1. If TZP is "S" then set to S :
#> amoxicillin (AMX), ampicillin (AMP)
#>
#> 2. If TZP is "R" then set to R :
#> amoxicillin (AMX), ampicillin (AMP)
The rules (the part *before* the tilde, in above example `TZP == "S"`
and `TZP == "R"`) must be evaluable in your data set: it should be able
to run as a filter in your data set without errors. This means for the
above example that the column `TZP` must exist. We will create a sample
data set and test the rules set:
df <- data.frame(mo = c("Escherichia coli", "Klebsiella pneumoniae"),
TZP = as.sir("R"),
ampi = as.sir("S"),
cipro = as.sir("S"))
df
#> mo TZP ampi cipro
#> 1 Escherichia coli R S S
#> 2 Klebsiella pneumoniae R S S
eucast_rules(df,
rules = "custom",
custom_rules = x,
info = FALSE,
overwrite = TRUE)
#> mo TZP ampi cipro
#> 1 Escherichia coli R R S
#> 2 Klebsiella pneumoniae R R S
### Using taxonomic properties in rules
There is one exception in columns used for the rules: all column names
of the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md) data
set can also be used, but do not have to exist in the data set. These
column names are: "mo", "fullname", "status", "kingdom", "phylum",
"class", "order", "family", "genus", "species", "subspecies", "rank",
"ref", "oxygen_tolerance", "source", "lpsn", "lpsn_parent",
"lpsn_renamed_to", "mycobank", "mycobank_parent", "mycobank_renamed_to",
"gbif", "gbif_parent", "gbif_renamed_to", "prevalence", and "snomed".
Thus, this next example will work as well, despite the fact that the
`df` data set does not contain a column `genus`:
y <- custom_eucast_rules(
TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R"
)
eucast_rules(df,
rules = "custom",
custom_rules = y,
info = FALSE,
overwrite = TRUE)
#> mo TZP ampi cipro
#> 1 Escherichia coli R S S
#> 2 Klebsiella pneumoniae R R S
### Sharing rules among multiple users
The rules set (the `y` object in this case) could be exported to a
shared file location using
[`saveRDS()`](https://rdrr.io/r/base/readRDS.html) if you collaborate
with multiple users. The custom rules set could then be imported using
[`readRDS()`](https://rdrr.io/r/base/readRDS.html).
### Usage of multiple antimicrobials and antimicrobial group names
You can define antimicrobial groups instead of single antimicrobials for
the rule consequence, which is the part *after* the tilde (~). In the
examples above, the antimicrobial group `aminopenicillins` includes both
ampicillin and amoxicillin.
Rules can also be applied to multiple antimicrobials and antimicrobial
groups simultaneously. Use the [`c()`](https://rdrr.io/r/base/c.html)
function to combine multiple antimicrobials. For instance, the following
example sets all aminopenicillins and ureidopenicillins to "R" if column
TZP (piperacillin/tazobactam) is "R":
x <- custom_eucast_rules(TZP == "R" ~ c(aminopenicillins, ureidopenicillins) == "R")
x
#> A set of custom EUCAST rules:
#>
#> 1. If TZP is "R" then set to "R":
#> amoxicillin (AMX), ampicillin (AMP), azlocillin (AZL), mezlocillin (MEZ), piperacillin (PIP), piperacillin/tazobactam (TZP)
These 35 antimicrobial groups are allowed in the rules
(case-insensitive) and can be used in any combination:
- aminoglycosides
(amikacin, amikacin/fosfomycin, apramycin, arbekacin, astromicin,
bekanamycin, dibekacin, framycetin, gentamicin, gentamicin-high,
habekacin, hygromycin, isepamicin, kanamycin, kanamycin-high,
kanamycin/cephalexin, micronomicin, neomycin, netilmicin,
pentisomicin, plazomicin, propikacin, ribostamycin, sisomicin,
streptoduocin, streptomycin, streptomycin-high, tobramycin, and
tobramycin-high)
- aminopenicillins
(amoxicillin and ampicillin)
- antifungals
(amorolfine, amphotericin B, amphotericin B-high, anidulafungin,
butoconazole, caspofungin, ciclopirox, clotrimazole, econazole,
fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin,
ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole,
manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin,
posaconazole, rezafungin, ribociclib, sulconazole, terbinafine,
terconazole, and voriconazole)
- antimycobacterials
(4-aminosalicylic acid, calcium aminosalicylate, capreomycin,
clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid,
ethionamide, isoniazid,
isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide,
p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide,
rifabutin, rifampicin, rifampicin/ethambutol/isoniazid,
rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid,
rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium
aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone,
thioacetazone/isoniazid, tiocarlide, and viomycin)
- betalactams
(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam,
ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin,
azidocillin, azlocillin, aztreonam, aztreonam/avibactam,
aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin,
benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin
screening test, biapenem, carbenicillin, carindacillin, carumonam,
cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin,
cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene,
cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime,
cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam,
cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam,
cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol,
cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole,
cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam,
ceforanide, cefoselis, cefotaxime, cefotaxime screening test,
cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam,
cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test,
cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime,
cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil,
cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline,
ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam,
ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole,
ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil,
ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam,
ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime,
cefuroxime axetil, cephradine, ciclacillin, clometocillin,
cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem,
flucloxacillin, hetacillin, imipenem, imipenem/EDTA,
imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam,
meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin,
meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin,
oxacillin screening test, panipenem, penamecillin,
penicillin/novobiocin, penicillin/sulbactam, pheneticillin,
phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam,
piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam,
procaine benzylpenicillin, propicillin, razupenem, ritipenem,
ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin,
talampicillin, taniborbactam, tebipenem, temocillin, ticarcillin,
ticarcillin/clavulanic acid, and tigemonam)
- betalactams_with_inhibitor
(amoxicillin/clavulanic acid, amoxicillin/sulbactam,
ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam,
cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam,
cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam,
cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic
acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid,
ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic
acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor,
imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam,
mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam,
piperacillin/sulbactam, piperacillin/tazobactam, and
ticarcillin/clavulanic acid)
- carbapenems
(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA,
imipenem/relebactam, meropenem, meropenem/nacubactam,
meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem
acoxil, taniborbactam, and tebipenem)
- cephalosporins
(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine,
cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin,
cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren
pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid,
cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam,
cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet
pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime,
cefmetazole, cefodizime, cefonicid, cefoperazone,
cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime
screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam,
cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin
screening test, cefozopran, cefpimizole, cefpiramide, cefpirome,
cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid,
cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide,
ceftaroline, ceftaroline/avibactam, ceftazidime,
ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram
pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime
alapivoxil, ceftobiprole, ceftobiprole medocaril,
ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase
inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and
loracarbef)
- cephalosporins_1st
(cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin,
cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole,
and cephradine)
- cephalosporins_2nd
(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan,
cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime,
cefuroxime axetil, and loracarbef)
- cephalosporins_3rd
(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren
pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime,
cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime,
cefotaxime screening test, cefotaxime/clavulanic acid,
cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole,
cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic
acid, cefsulodin, ceftazidime, ceftazidime/avibactam,
ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten,
ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone,
ceftriaxone/beta-lactamase inhibitor, and latamoxef)
- cephalosporins_4th
(cefepime, cefepime/amikacin, cefepime/clavulanic acid,
cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam,
cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis,
cefozopran, cefpirome, and cefquinome)
- cephalosporins_5th
(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole
medocaril, and ceftolozane/tazobactam)
- cephalosporins_except_caz
(cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine,
cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin,
cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren
pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid,
cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam,
cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet
pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime,
cefmetazole, cefodizime, cefonicid, cefoperazone,
cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime
screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam,
cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin
screening test, cefozopran, cefpimizole, cefpiramide, cefpirome,
cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid,
cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide,
ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam,
ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole,
ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil,
ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam,
ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime,
cefuroxime axetil, cephradine, latamoxef, and loracarbef)
- fluoroquinolones
(besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole,
ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin,
danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin,
finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin,
grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole,
levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin,
moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline,
norfloxacin, norfloxacin screening test, norfloxacin/metronidazole,
norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin,
pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin,
premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin,
sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and
trovafloxacin)
- glycopeptides
(avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin,
ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin,
vancomycin, and vancomycin-macromethod)
- glycopeptides_except_lipo
(avoparcin, bleomycin, norvancomycin, ramoplanin, teicoplanin,
teicoplanin-macromethod, vancomycin, and vancomycin-macromethod)
- isoxazolylpenicillins
(cloxacillin, dicloxacillin, flucloxacillin, meticillin, oxacillin,
and oxacillin screening test)
- lincosamides
(clindamycin, lincomycin, and pirlimycin)
- lipoglycopeptides
(dalbavancin, oritavancin, and telavancin)
- macrolides
(acetylmidecamycin, acetylspiramycin, azithromycin, clarithromycin,
dirithromycin, erythromycin, flurithromycin, gamithromycin, josamycin,
kitasamycin, meleumycin, midecamycin, miocamycin, nafithromycin,
oleandomycin, rokitamycin, roxithromycin, solithromycin, spiramycin,
telithromycin, tildipirosin, tilmicosin, troleandomycin,
tulathromycin, tylosin, and tylvalosin)
- monobactams
(aztreonam, aztreonam/avibactam, aztreonam/nacubactam, carumonam, and
tigemonam)
- nitrofurans
(furazidin, furazolidone, nifurtoinol, nitrofurantoin, and
nitrofurazone)
- oxazolidinones
(cadazolid, cycloserine, linezolid, tedizolid, and thiacetazone)
- penicillins
(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam,
ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin,
azidocillin, azlocillin, bacampicillin, benzathine benzylpenicillin,
benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin
screening test, carbenicillin, carindacillin, ciclacillin,
clometocillin, cloxacillin, dicloxacillin, epicillin, flucloxacillin,
hetacillin, lenampicillin, mecillinam, metampicillin, meticillin,
mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin
screening test, penamecillin, penicillin/novobiocin,
penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin,
piperacillin, piperacillin/sulbactam, piperacillin/tazobactam,
piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin,
propicillin, sarmoxicillin, sulbenicillin, sultamicillin,
talampicillin, temocillin, ticarcillin, and ticarcillin/clavulanic
acid)
- phenicols
(chloramphenicol, florfenicol, and thiamphenicol)
- polymyxins
(colistin, polymyxin B, and polymyxin B/polysorbate 80)
- quinolones
(besifloxacin, cinoxacin, ciprofloxacin, ciprofloxacin/metronidazole,
ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin,
danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin,
finafloxacin, fleroxacin, flumequine, garenoxacin, gatifloxacin,
gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin,
levofloxacin/ornidazole, levonadifloxacin, lomefloxacin,
marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin,
nalidixic acid, nalidixic acid screening test, nemonoxacin,
nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test,
norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin,
ofloxacin/ornidazole, orbifloxacin, oxolinic acid, pazufloxacin,
pefloxacin, pefloxacin screening test, pipemidic acid, piromidic acid,
pradofloxacin, premafloxacin, prulifloxacin, rosoxacin, rufloxacin,
sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol,
tioxacin, tosufloxacin, and trovafloxacin)
- rifamycins
(rifabutin, rifampicin, rifampicin/ethambutol/isoniazid,
rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid,
rifampicin/pyrazinamide/isoniazid, rifamycin, and rifapentine)
- streptogramins
(pristinamycin and quinupristin/dalfopristin)
- sulfonamides
(brodimoprim, sulfadiazine, sulfadiazine/tetroxoprim,
sulfadimethoxine, sulfadimidine, sulfafurazole, sulfaisodimidine,
sulfalene, sulfamazone, sulfamerazine, sulfamethizole,
sulfamethoxazole, sulfamethoxypyridazine, sulfametomidine,
sulfametoxydiazine, sulfamoxole, sulfanilamide, sulfaperin,
sulfaphenazole, sulfapyridine, sulfathiazole, and sulfathiourea)
- tetracyclines
(cetocycline, chlortetracycline, clomocycline, demeclocycline,
doxycycline, eravacycline, lymecycline, metacycline, minocycline,
omadacycline, oxytetracycline, penimepicycline, rolitetracycline,
sarecycline, tetracycline, tetracycline screening test, and
tigecycline)
- tetracyclines_except_tgc
(cetocycline, chlortetracycline, clomocycline, demeclocycline,
doxycycline, eravacycline, lymecycline, metacycline, minocycline,
omadacycline, oxytetracycline, penimepicycline, rolitetracycline,
sarecycline, tetracycline, and tetracycline screening test)
- trimethoprims
(brodimoprim, sulfadiazine, sulfadiazine/tetroxoprim,
sulfadiazine/trimethoprim, sulfadimethoxine, sulfadimidine,
sulfadimidine/trimethoprim, sulfafurazole, sulfaisodimidine,
sulfalene, sulfamazone, sulfamerazine, sulfamerazine/trimethoprim,
sulfamethizole, sulfamethoxazole, sulfamethoxypyridazine,
sulfametomidine, sulfametoxydiazine, sulfametrole/trimethoprim,
sulfamoxole, sulfamoxole/trimethoprim, sulfanilamide, sulfaperin,
sulfaphenazole, sulfapyridine, sulfathiazole, sulfathiourea,
trimethoprim, and trimethoprim/sulfamethoxazole)
- ureidopenicillins
(azlocillin, mezlocillin, piperacillin, and piperacillin/tazobactam)
## Examples
``` r
x <- custom_eucast_rules(
AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R",
AMC == "I" & genus == "Klebsiella" ~ aminopenicillins == "I"
)
x
#> A set of custom EUCAST rules:
#>
#> 1. If AMC is R and genus is "Klebsiella" then set to R :
#> amoxicillin (AMX), ampicillin (AMP)
#>
#> 2. If AMC is I and genus is "Klebsiella" then set to I :
#> amoxicillin (AMX), ampicillin (AMP)
# run the custom rule set (verbose = TRUE will return a logbook instead of the data set):
eucast_rules(example_isolates,
rules = "custom",
custom_rules = x,
info = FALSE,
overwrite = TRUE,
verbose = TRUE
)
#> # A tibble: 8 × 9
#> row col mo_fullname old new rule rule_group rule_name rule_source
#> <int> <chr> <chr> <ord> <chr> <chr> <chr> <chr> <chr>
#> 1 33 AMP Klebsiella pne… R I "rep… Custom EU… Custom E… Object 'x'…
#> 2 33 AMX Klebsiella pne… R I "rep… Custom EU… Custom E… Object 'x'…
#> 3 34 AMP Klebsiella pne… R I "rep… Custom EU… Custom E… Object 'x'…
#> 4 34 AMX Klebsiella pne… R I "rep… Custom EU… Custom E… Object 'x'…
#> 5 531 AMP Klebsiella pne… R I "rep… Custom EU… Custom E… Object 'x'…
#> 6 531 AMX Klebsiella pne… R I "rep… Custom EU… Custom E… Object 'x'…
#> 7 1485 AMP Klebsiella oxy… R I "rep… Custom EU… Custom E… Object 'x'…
#> 8 1485 AMX Klebsiella oxy… R I "rep… Custom EU… Custom E… Object 'x'…
# combine rule sets
x2 <- c(
x,
custom_eucast_rules(TZP == "R" ~ carbapenems == "R")
)
x2
#> A set of custom EUCAST rules:
#>
#> 1. If AMC is R and genus is "Klebsiella" then set to R :
#> amoxicillin (AMX), ampicillin (AMP)
#>
#> 2. If AMC is I and genus is "Klebsiella" then set to I :
#> amoxicillin (AMX), ampicillin (AMP)
#>
#> 3. If TZP is R then set to R :
#> biapenem (BIA), doripenem (DOR), ertapenem (ETP), imipenem (IPM),
#> imipenem/EDTA (IPE), imipenem/relebactam (IMR), meropenem (MEM),
#> meropenem/nacubactam (MNC), meropenem/vaborbactam (MEV), panipenem (PAN),
#> razupenem (RZM), ritipenem (RIT), ritipenem acoxil (RIA), taniborbactam
#> (TAN), tebipenem (TBP)
```

View File

@@ -7,7 +7,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="">3.0.1.9002</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9003</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">
@@ -148,14 +148,14 @@
<li><p><code><a href="antimicrobial_selectors.html">aminopenicillins()</a></code> can select: <br> amoxicillin and ampicillin</p></li>
<li><p><code><a href="antimicrobial_selectors.html">antifungals()</a></code> can select: <br> amorolfine, amphotericin B, amphotericin B-high, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole, and voriconazole</p></li>
<li><p><code><a href="antimicrobial_selectors.html">antimycobacterials()</a></code> can select: <br> 4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide, p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/ethambutol/isoniazid, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone, thioacetazone/isoniazid, tiocarlide, and viomycin</p></li>
<li><p><code><a href="antimicrobial_selectors.html">betalactams()</a></code> can select: <br> amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam</p></li>
<li><p><code><a href="antimicrobial_selectors.html">betalactams_with_inhibitor()</a></code> can select: <br> amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid</p></li>
<li><p><code><a href="antimicrobial_selectors.html">carbapenems()</a></code> can select: <br> biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, and tebipenem</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins()</a></code> can select: <br> cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef</p></li>
<li><p><code><a href="antimicrobial_selectors.html">betalactams()</a></code> can select: <br> amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin screening test, biapenem, carbenicillin, carindacillin, carumonam, cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin screening test, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin, talampicillin, taniborbactam, tebipenem, temocillin, ticarcillin, ticarcillin/clavulanic acid, and tigemonam</p></li>
<li><p><code><a href="antimicrobial_selectors.html">betalactams_with_inhibitor()</a></code> can select: <br> amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor, imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam, mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam, piperacillin/sulbactam, piperacillin/tazobactam, and ticarcillin/clavulanic acid</p></li>
<li><p><code><a href="antimicrobial_selectors.html">carbapenems()</a></code> can select: <br> biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil, taniborbactam, and tebipenem</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins()</a></code> can select: <br> cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin, cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime, cefuroxime axetil, cephradine, latamoxef, and loracarbef</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins_1st()</a></code> can select: <br> cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin, cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, and cephradine</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins_2nd()</a></code> can select: <br> cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime, cefuroxime axetil, and loracarbef</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins_3rd()</a></code> can select: <br> cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime screening test, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone, ceftriaxone/beta-lactamase inhibitor, and latamoxef</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins_4th()</a></code> can select: <br> cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins_4th()</a></code> can select: <br> cefepime, cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis, cefozopran, cefpirome, and cefquinome</p></li>
<li><p><code><a href="antimicrobial_selectors.html">cephalosporins_5th()</a></code> can select: <br> ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, and ceftolozane/tazobactam</p></li>
<li><p><code><a href="antimicrobial_selectors.html">fluoroquinolones()</a></code> can select: <br> besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole, ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test, norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin, pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and trovafloxacin</p></li>
<li><p><code><a href="antimicrobial_selectors.html">glycopeptides()</a></code> can select: <br> avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin, and vancomycin-macromethod</p></li>

View File

@@ -0,0 +1,515 @@
# Define Custom MDRO Guideline
Define custom a MDRO guideline for your organisation or specific
analysis and use the output of this function in
[`mdro()`](https://amr-for-r.org/reference/mdro.md).
## Usage
``` r
custom_mdro_guideline(..., as_factor = TRUE)
# S3 method for class 'custom_mdro_guideline'
c(x, ..., as_factor = NULL)
```
## Arguments
- ...:
Guideline rules in [formula](https://rdrr.io/r/base/tilde.html)
notation, see below for instructions, and in *Examples*.
- as_factor:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
the returned value should be an ordered
[factor](https://rdrr.io/r/base/factor.html) (`TRUE`, default), or
otherwise a [character](https://rdrr.io/r/base/character.html) vector.
For combining rules sets (using
[`c()`](https://rdrr.io/r/base/c.html)) this value will be inherited
from the first set at default.
- x:
Existing custom MDRO rules
## Value
A [list](https://rdrr.io/r/base/list.html) containing the custom rules
## Details
Using a custom MDRO guideline is of importance if you have custom rules
to determine MDROs in your hospital, e.g., rules that are dependent on
ward, state of contact isolation or other variables in your data.
### Basics
If you are familiar with the
[`case_when()`](https://dplyr.tidyverse.org/reference/case_when.html)
function of the `dplyr` package, you will recognise the input method to
set your own rules. Rules must be set using what R considers to be the
'formula notation'. The rule itself is written *before* the tilde (`~`)
and the consequence of the rule is written *after* the tilde:
custom <- custom_mdro_guideline(CIP == "R" & age > 60 ~ "Elderly Type A",
ERY == "R" & age > 60 ~ "Elderly Type B")
If a row/an isolate matches the first rule, the value after the first
`~` (in this case *'Elderly Type A'*) will be set as MDRO value.
Otherwise, the second rule will be tried and so on. The number of rules
is unlimited.
You can print the rules set in the console for an overview. Colours will
help reading it if your console supports colours.
custom
#> A set of custom MDRO rules:
#> 1. If CIP is R and age is higher than 60 then: Elderly Type A
#> 2. If ERY is R and age is higher than 60 then: Elderly Type B
#> 3. Otherwise: Negative
#> Unmatched rows will return NA.
#> Results will be of class 'factor', with ordered levels: Negative < Elderly Type A < Elderly Type B
The outcome of the function can be used for the `guideline` argument in
the [`mdro()`](https://amr-for-r.org/reference/mdro.md) function:
x <- mdro(example_isolates, guideline = custom)
#> Determining MDROs based on custom rules, resulting in factor levels: Negative < Elderly Type A < Elderly Type B.
#> - Custom MDRO rule 1: CIP == "R" & age > 60 (198 rows matched)
#> - Custom MDRO rule 2: ERY == "R" & age > 60 (732 rows matched)
#> => Found 930 custom defined MDROs out of 2000 isolates (46.5%)
table(x)
#> x
#> Negative Elderly Type A Elderly Type B
#> 1070 198 732
Rules can also be combined with other custom rules by using
[`c()`](https://rdrr.io/r/base/c.html):
x <- mdro(example_isolates,
guideline = c(custom,
custom_mdro_guideline(ERY == "R" & age > 50 ~ "Elderly Type C")))
#> Determining MDROs based on custom rules, resulting in factor levels: Negative < Elderly Type A < Elderly Type B < Elderly Type C.
#> - Custom MDRO rule 1: CIP == "R" & age > 60 (198 rows matched)
#> - Custom MDRO rule 2: ERY == "R" & age > 60 (732 rows matched)
#> - Custom MDRO rule 3: ERY == "R" & age > 50 (109 rows matched)
#> => Found 1039 custom defined MDROs out of 2000 isolates (52.0%)
table(x)
#> x
#> Negative Elderly Type A Elderly Type B Elderly Type C
#> 961 198 732 109
### Sharing rules among multiple users
The rules set (the `custom` object in this case) could be exported to a
shared file location using
[`saveRDS()`](https://rdrr.io/r/base/readRDS.html) if you collaborate
with multiple users. The custom rules set could then be imported using
[`readRDS()`](https://rdrr.io/r/base/readRDS.html).
### Usage of multiple antimicrobials and antimicrobial group names
You can define antimicrobial groups instead of single antimicrobials for
the rule itself, which is the part *before* the tilde (~). Use
[`any()`](https://rdrr.io/r/base/any.html) or
[`all()`](https://rdrr.io/r/base/all.html) to specify the scope of the
antimicrobial group:
custom_mdro_guideline(
AMX == "R" ~ "My MDRO #1",
any(cephalosporins_2nd() == "R") ~ "My MDRO #2",
all(glycopeptides() == "R") ~ "My MDRO #3"
)
All 35 antimicrobial selectors are supported for use in the rules:
- [`aminoglycosides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
amikacin, amikacin/fosfomycin, apramycin, arbekacin, astromicin,
bekanamycin, dibekacin, framycetin, gentamicin, gentamicin-high,
habekacin, hygromycin, isepamicin, kanamycin, kanamycin-high,
kanamycin/cephalexin, micronomicin, neomycin, netilmicin,
pentisomicin, plazomicin, propikacin, ribostamycin, sisomicin,
streptoduocin, streptomycin, streptomycin-high, tobramycin, and
tobramycin-high
- [`aminopenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
amoxicillin and ampicillin
- [`antifungals()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
amorolfine, amphotericin B, amphotericin B-high, anidulafungin,
butoconazole, caspofungin, ciclopirox, clotrimazole, econazole,
fluconazole, flucytosine, fosfluconazole, griseofulvin, hachimycin,
ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole,
manogepix, micafungin, miconazole, nystatin, oteseconazole, pimaricin,
posaconazole, rezafungin, ribociclib, sulconazole, terbinafine,
terconazole, and voriconazole
- [`antimycobacterials()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
4-aminosalicylic acid, calcium aminosalicylate, capreomycin,
clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid,
ethionamide, isoniazid,
isoniazid/sulfamethoxazole/trimethoprim/pyridoxine, morinamide,
p-aminosalicylic acid, pretomanid, protionamide, pyrazinamide,
rifabutin, rifampicin, rifampicin/ethambutol/isoniazid,
rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid,
rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, sodium
aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone,
thioacetazone/isoniazid, tiocarlide, and viomycin
- [`betalactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam,
ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin,
azidocillin, azlocillin, aztreonam, aztreonam/avibactam,
aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin,
benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin
screening test, biapenem, carbenicillin, carindacillin, carumonam,
cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin,
cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene,
cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime,
cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam,
cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam,
cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol,
cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole,
cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam,
ceforanide, cefoselis, cefotaxime, cefotaxime screening test,
cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam,
cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test,
cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime,
cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil,
cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline,
ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam,
ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole,
ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil,
ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam,
ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime,
cefuroxime axetil, cephradine, ciclacillin, clometocillin,
cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem,
flucloxacillin, hetacillin, imipenem, imipenem/EDTA,
imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam,
meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin,
meticillin, mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin,
oxacillin screening test, panipenem, penamecillin,
penicillin/novobiocin, penicillin/sulbactam, pheneticillin,
phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam,
piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam,
procaine benzylpenicillin, propicillin, razupenem, ritipenem,
ritipenem acoxil, sarmoxicillin, sulbenicillin, sultamicillin,
talampicillin, taniborbactam, tebipenem, temocillin, ticarcillin,
ticarcillin/clavulanic acid, and tigemonam
- [`betalactams_with_inhibitor()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
amoxicillin/clavulanic acid, amoxicillin/sulbactam,
ampicillin/sulbactam, aztreonam/avibactam, aztreonam/nacubactam,
cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam,
cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam,
cefepime/zidebactam, cefoperazone/sulbactam, cefotaxime/clavulanic
acid, cefotaxime/sulbactam, cefpodoxime/clavulanic acid,
ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic
acid, ceftolozane/tazobactam, ceftriaxone/beta-lactamase inhibitor,
imipenem/relebactam, meropenem/nacubactam, meropenem/vaborbactam,
mezlocillin/sulbactam, penicillin/novobiocin, penicillin/sulbactam,
piperacillin/sulbactam, piperacillin/tazobactam, and
ticarcillin/clavulanic acid
- [`carbapenems()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA,
imipenem/relebactam, meropenem, meropenem/nacubactam,
meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem
acoxil, taniborbactam, and tebipenem
- [`cephalosporins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cefacetrile, cefaclor, cefadroxil, cefalexin, cefaloridine, cefalotin,
cefamandole, cefapirin, cefatrizine, cefazedone, cefazolin, cefcapene,
cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime,
cefepime/amikacin, cefepime/clavulanic acid, cefepime/enmetazobactam,
cefepime/nacubactam, cefepime/taniborbactam, cefepime/tazobactam,
cefepime/zidebactam, cefetamet, cefetamet pivoxil, cefetecol,
cefetrizole, cefiderocol, cefixime, cefmenoxime, cefmetazole,
cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam,
ceforanide, cefoselis, cefotaxime, cefotaxime screening test,
cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam,
cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening test,
cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime,
cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil,
cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline,
ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam,
ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole,
ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil,
ceftobiprole, ceftobiprole medocaril, ceftolozane/tazobactam,
ceftriaxone, ceftriaxone/beta-lactamase inhibitor, cefuroxime,
cefuroxime axetil, cephradine, latamoxef, and loracarbef
- [`cephalosporins_1st()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cefacetrile, cefadroxil, cefalexin, cefaloridine, cefalotin,
cefapirin, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole,
and cephradine
- [`cephalosporins_2nd()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan,
cefotiam, cefoxitin, cefoxitin screening test, cefprozil, cefuroxime,
cefuroxime axetil, and loracarbef
- [`cephalosporins_3rd()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren
pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime,
cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime,
cefotaxime screening test, cefotaxime/clavulanic acid,
cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole,
cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic
acid, cefsulodin, ceftazidime, ceftazidime/avibactam,
ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten,
ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone,
ceftriaxone/beta-lactamase inhibitor, and latamoxef
- [`cephalosporins_4th()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cefepime, cefepime/amikacin, cefepime/clavulanic acid,
cefepime/enmetazobactam, cefepime/nacubactam, cefepime/taniborbactam,
cefepime/tazobactam, cefepime/zidebactam, cefetecol, cefoselis,
cefozopran, cefpirome, and cefquinome
- [`cephalosporins_5th()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole
medocaril, and ceftolozane/tazobactam
- [`fluoroquinolones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
besifloxacin, ciprofloxacin, ciprofloxacin/metronidazole,
ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin,
danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin,
finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin,
grepafloxacin, lascufloxacin, levofloxacin, levofloxacin/ornidazole,
levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin,
moxifloxacin, nadifloxacin, nemonoxacin, nifuroquine, nitroxoline,
norfloxacin, norfloxacin screening test, norfloxacin/metronidazole,
norfloxacin/tinidazole, ofloxacin, ofloxacin/ornidazole, orbifloxacin,
pazufloxacin, pefloxacin, pefloxacin screening test, pradofloxacin,
premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin,
sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin, and
trovafloxacin
- [`glycopeptides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
avoparcin, bleomycin, dalbavancin, norvancomycin, oritavancin,
ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin,
vancomycin, and vancomycin-macromethod
- [`isoxazolylpenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cloxacillin, dicloxacillin, flucloxacillin, meticillin, oxacillin, and
oxacillin screening test
- [`lincosamides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
clindamycin, lincomycin, and pirlimycin
- [`lipoglycopeptides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
dalbavancin, oritavancin, and telavancin
- [`macrolides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
acetylmidecamycin, acetylspiramycin, azithromycin, clarithromycin,
dirithromycin, erythromycin, flurithromycin, gamithromycin, josamycin,
kitasamycin, meleumycin, midecamycin, miocamycin, nafithromycin,
oleandomycin, rokitamycin, roxithromycin, solithromycin, spiramycin,
telithromycin, tildipirosin, tilmicosin, troleandomycin,
tulathromycin, tylosin, and tylvalosin
- [`monobactams()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
aztreonam, aztreonam/avibactam, aztreonam/nacubactam, carumonam, and
tigemonam
- [`nitrofurans()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
furazidin, furazolidone, nifurtoinol, nitrofurantoin, and
nitrofurazone
- [`oxazolidinones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cadazolid, cycloserine, linezolid, tedizolid, and thiacetazone
- [`penicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam,
ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin,
azidocillin, azlocillin, bacampicillin, benzathine benzylpenicillin,
benzathine phenoxymethylpenicillin, benzylpenicillin, benzylpenicillin
screening test, carbenicillin, carindacillin, ciclacillin,
clometocillin, cloxacillin, dicloxacillin, epicillin, flucloxacillin,
hetacillin, lenampicillin, mecillinam, metampicillin, meticillin,
mezlocillin, mezlocillin/sulbactam, nafcillin, oxacillin, oxacillin
screening test, penamecillin, penicillin/novobiocin,
penicillin/sulbactam, pheneticillin, phenoxymethylpenicillin,
piperacillin, piperacillin/sulbactam, piperacillin/tazobactam,
piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin,
propicillin, sarmoxicillin, sulbenicillin, sultamicillin,
talampicillin, temocillin, ticarcillin, and ticarcillin/clavulanic
acid
- [`phenicols()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
chloramphenicol, florfenicol, and thiamphenicol
- [`polymyxins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
colistin, polymyxin B, and polymyxin B/polysorbate 80
- [`quinolones()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
besifloxacin, cinoxacin, ciprofloxacin, ciprofloxacin/metronidazole,
ciprofloxacin/ornidazole, ciprofloxacin/tinidazole, clinafloxacin,
danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin,
finafloxacin, fleroxacin, flumequine, garenoxacin, gatifloxacin,
gemifloxacin, grepafloxacin, lascufloxacin, levofloxacin,
levofloxacin/ornidazole, levonadifloxacin, lomefloxacin,
marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin,
nalidixic acid, nalidixic acid screening test, nemonoxacin,
nifuroquine, nitroxoline, norfloxacin, norfloxacin screening test,
norfloxacin/metronidazole, norfloxacin/tinidazole, ofloxacin,
ofloxacin/ornidazole, orbifloxacin, oxolinic acid, pazufloxacin,
pefloxacin, pefloxacin screening test, pipemidic acid, piromidic acid,
pradofloxacin, premafloxacin, prulifloxacin, rosoxacin, rufloxacin,
sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol,
tioxacin, tosufloxacin, and trovafloxacin
- [`rifamycins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
rifabutin, rifampicin, rifampicin/ethambutol/isoniazid,
rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid,
rifampicin/pyrazinamide/isoniazid, rifamycin, and rifapentine
- [`streptogramins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
pristinamycin and quinupristin/dalfopristin
- [`sulfonamides()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
brodimoprim, sulfadiazine, sulfadiazine/tetroxoprim, sulfadimethoxine,
sulfadimidine, sulfafurazole, sulfaisodimidine, sulfalene,
sulfamazone, sulfamerazine, sulfamethizole, sulfamethoxazole,
sulfamethoxypyridazine, sulfametomidine, sulfametoxydiazine,
sulfamoxole, sulfanilamide, sulfaperin, sulfaphenazole, sulfapyridine,
sulfathiazole, and sulfathiourea
- [`tetracyclines()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
cetocycline, chlortetracycline, clomocycline, demeclocycline,
doxycycline, eravacycline, lymecycline, metacycline, minocycline,
omadacycline, oxytetracycline, penimepicycline, rolitetracycline,
sarecycline, tetracycline, tetracycline screening test, and
tigecycline
- [`trimethoprims()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
brodimoprim, sulfadiazine, sulfadiazine/tetroxoprim,
sulfadiazine/trimethoprim, sulfadimethoxine, sulfadimidine,
sulfadimidine/trimethoprim, sulfafurazole, sulfaisodimidine,
sulfalene, sulfamazone, sulfamerazine, sulfamerazine/trimethoprim,
sulfamethizole, sulfamethoxazole, sulfamethoxypyridazine,
sulfametomidine, sulfametoxydiazine, sulfametrole/trimethoprim,
sulfamoxole, sulfamoxole/trimethoprim, sulfanilamide, sulfaperin,
sulfaphenazole, sulfapyridine, sulfathiazole, sulfathiourea,
trimethoprim, and trimethoprim/sulfamethoxazole
- [`ureidopenicillins()`](https://amr-for-r.org/reference/antimicrobial_selectors.md)
can select:
azlocillin, mezlocillin, piperacillin, and piperacillin/tazobactam
## Examples
``` r
x <- custom_mdro_guideline(
CIP == "R" & age > 60 ~ "Elderly Type A",
ERY == "R" & age > 60 ~ "Elderly Type B"
)
x
#> A set of custom MDRO rules:
#> 1. If CIP is R and age is higher than 60 then: Elderly Type A
#> 2. If ERY is R and age is higher than 60 then: Elderly Type B
#> 3. Otherwise: Negative
#>
#> Unmatched rows will return NA.
#> Results will be of class 'factor', with ordered levels: Negative < Elderly Type A < Elderly Type B
# run the custom rule set (verbose = TRUE will return a logbook instead of the data set):
out <- mdro(example_isolates, guideline = x)
table(out)
#> out
#> Negative Elderly Type A Elderly Type B
#> 1070 198 732
out <- mdro(example_isolates, guideline = x, verbose = TRUE)
head(out)
#> row_number microorganism MDRO
#> V1 1 <NA> Elderly Type B
#> V2 2 <NA> Elderly Type B
#> V3 3 <NA> Negative
#> V4 4 <NA> Negative
#> V5 5 <NA> Negative
#> V6 6 <NA> Negative
#> reason
#> V1 matched rule 2: ERY == "R" & age > 60
#> V2 matched rule 2: ERY == "R" & age > 60
#> V3 no rules matched
#> V4 no rules matched
#> V5 no rules matched
#> V6 no rules matched
#> all_nonsusceptible_columns guideline
#> V1 PEN, TMP, SXT, LNZ, VAN, TEC, TCY, ERY, CLI, AZM, RIF Custom guideline
#> V2 PEN, TMP, SXT, LNZ, VAN, TEC, TCY, ERY, CLI, AZM, RIF Custom guideline
#> V3 PEN, FLC, CXM, CAZ, ERY, AZM, COL Custom guideline
#> V4 PEN, FLC, CXM, CAZ, ERY, AZM, COL Custom guideline
#> V5 PEN, FLC, CXM, CAZ, TMP, ERY, AZM, COL Custom guideline
#> V6 PEN, FLC, CXM, CAZ, TMP, ERY, CLI, AZM, COL Custom guideline
# you can create custom guidelines using selectors (see ?antimicrobial_selectors)
my_guideline <- custom_mdro_guideline(
AMX == "R" ~ "Custom MDRO 1",
all(cephalosporins_2nd() == "R") ~ "Custom MDRO 2"
)
my_guideline
#> A set of custom MDRO rules:
#> 1. If AMX is R then: Custom MDRO 1
#> 2. If all of cephalosporins_2nd() is R then: Custom MDRO 2
#> 3. Otherwise: Negative
#>
#> Unmatched rows will return NA.
#> Results will be of class 'factor', with ordered levels: Negative < Custom MDRO 1 < Custom MDRO 2
out <- mdro(example_isolates, guideline = my_guideline)
#> Column 'esbl' is SIR eligible (despite only having empty values), since
#> it seems to be tazobactam (TAZ)
#> Column 'mecC' is SIR eligible (despite only having empty values), since
#> it seems to be mecillinam (MEC)
#> Column 'vanA' is SIR eligible (despite only having empty values), since
#> it seems to be lenampicillin (LEN)
#> Column 'vanB' is SIR eligible (despite only having empty values), since
#> it seems to be metronidazole (MTR)
#> For `cephalosporins_2nd()` using columns 'CXM' (cefuroxime) and 'FOX'
#> (cefoxitin)
#> Assuming a filter on all 2 cephalosporins_2nd. Wrap around `all()` or
#> `any()` to prevent this note.
table(out)
#> out
#> Negative Custom MDRO 1 Custom MDRO 2
#> 1144 804 52
```

View File

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

85
reference/dosage.md Normal file
View File

@@ -0,0 +1,85 @@
# Data Set with Treatment Dosages as Defined by EUCAST
EUCAST breakpoints used in this package are based on the dosages in this
data set. They can be retrieved with
[`eucast_dosage()`](https://amr-for-r.org/reference/eucast_rules.md).
## Usage
``` r
dosage
```
## Format
A [tibble](https://tibble.tidyverse.org/reference/tibble.html) with 759
observations and 9 variables:
- `ab`
Antimicrobial ID as used in this package (such as `AMC`), using the
official EARS-Net (European Antimicrobial Resistance Surveillance
Network) codes where available
- `name`
Official name of the antimicrobial drug as used by WHONET/EARS-Net or
the WHO
- `type`
Type of the dosage, either "high_dosage", "standard_dosage", or
"uncomplicated_uti"
- `dose`
Dose, such as "2 g" or "25 mg/kg"
- `dose_times`
Number of times a dose must be administered
- `administration`
Route of administration, either "", "im", "iv", or "oral"
- `notes`
Additional dosage notes
- `original_txt`
Original text in the PDF file of EUCAST
- `eucast_version`
Version number of the EUCAST Clinical Breakpoints guideline to which
these dosages apply, either 15, 14, 13.1, 12, or 11
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## Examples
``` r
dosage
#> # A tibble: 759 × 9
#> ab name type dose dose_times administration notes original_txt
#> <ab> <chr> <chr> <chr> <int> <chr> <chr> <chr>
#> 1 AMK Amikacin stan… 25-3… 1 iv "" "25-30 mg/k…
#> 2 AMX Amoxicillin high… 2 g 6 iv "" "2 g x 6 iv"
#> 3 AMX Amoxicillin stan… 1 g 3 iv "" "1 g x 3-4 …
#> 4 AMX Amoxicillin high… 0.75… 3 oral "" "0.75-1 g x…
#> 5 AMX Amoxicillin stan… 0.5 g 3 oral "" "0.5 g x 3 …
#> 6 AMX Amoxicillin unco… 0.5 g 3 oral "" "0.5 g x 3 …
#> 7 AMC Amoxicillin/cl… high… 2 g … 3 iv "" "(2 g amoxi…
#> 8 AMC Amoxicillin/cl… stan… 1 g … 3 iv "" "(1 g amoxi…
#> 9 AMC Amoxicillin/cl… high… 0.87… 3 oral "" "(0.875 g a…
#> 10 AMC Amoxicillin/cl… stan… 0.5 … 3 oral "" "(0.5 g amo…
#> # 749 more rows
#> # 1 more variable: eucast_version <dbl>
```

View File

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

358
reference/eucast_rules.md Normal file
View File

@@ -0,0 +1,358 @@
# Apply EUCAST Rules
Apply rules from clinical breakpoints notes and expected resistant
phenotypes as defined by the European Committee on Antimicrobial
Susceptibility Testing (EUCAST, <https://www.eucast.org>), see *Source*.
Use `eucast_dosage()` to get a
[data.frame](https://rdrr.io/r/base/data.frame.html) with advised
dosages of a certain bug-drug combination, which is based on the
[dosage](https://amr-for-r.org/reference/dosage.md) data set.
To improve the interpretation of the antibiogram before EUCAST rules are
applied, some non-EUCAST rules can applied at default, see *Details*.
## Usage
``` r
eucast_rules(x, col_mo = NULL, info = interactive(),
rules = getOption("AMR_eucastrules", default = c("breakpoints",
"expected_phenotypes")), verbose = FALSE, version_breakpoints = 15,
version_expected_phenotypes = 1.2, version_expertrules = 3.3,
ampc_cephalosporin_resistance = NA, only_sir_columns = any(is.sir(x)),
custom_rules = NULL, overwrite = FALSE, ...)
eucast_dosage(ab, administration = "iv", version_breakpoints = 15)
```
## Source
- EUCAST Expert Rules. Version 2.0, 2012.
Leclercq et al. **EUCAST expert rules in antimicrobial susceptibility
testing.** *Clin Microbiol Infect.* 2013;19(2):141-60;
[doi:10.1111/j.1469-0691.2011.03703.x](https://doi.org/10.1111/j.1469-0691.2011.03703.x)
- EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes
Tables. Version 3.1, 2016.
[(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf)
- EUCAST Intrinsic Resistance and Unusual Phenotypes. Version 3.2, 2020.
[(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/2020/Intrinsic_Resistance_and_Unusual_Phenotypes_Tables_v3.2_20200225.pdf)
- EUCAST Intrinsic Resistance and Unusual Phenotypes. Version 3.3, 2021.
[(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/2021/Intrinsic_Resistance_and_Unusual_Phenotypes_Tables_v3.3_20211018.pdf)
- EUCAST Breakpoint tables for interpretation of MICs and zone
diameters. Version 9.0, 2019.
[(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_9.0_Breakpoint_Tables.xlsx)
- EUCAST Breakpoint tables for interpretation of MICs and zone
diameters. Version 10.0, 2020.
[(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_10.0_Breakpoint_Tables.xlsx)
- EUCAST Breakpoint tables for interpretation of MICs and zone
diameters. Version 11.0, 2021.
[(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_11.0_Breakpoint_Tables.xlsx)
- EUCAST Breakpoint tables for interpretation of MICs and zone
diameters. Version 12.0, 2022.
[(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_12.0_Breakpoint_Tables.xlsx)
## Arguments
- x:
A data set with antimicrobials columns, such as `amox`, `AMX` and
`AMC`.
- col_mo:
Column name of the names or codes of the microorganisms (see
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md)) - the default
is the first column of class
[`mo`](https://amr-for-r.org/reference/as.mo.md). Values will be
coerced using [`as.mo()`](https://amr-for-r.org/reference/as.mo.md).
- info:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
progress should be printed to the console - the default is only print
while in interactive sessions.
- rules:
A [character](https://rdrr.io/r/base/character.html) vector that
specifies which rules should be applied. Must be one or more of
`"breakpoints"`, `"expected_phenotypes"`, `"expert"`, `"other"`,
`"custom"`, `"all"`, and defaults to
`c("breakpoints", "expected_phenotypes")`. The default value can be
set to another value using the package option
[`AMR_eucastrules`](https://amr-for-r.org/reference/AMR-options.md):
`options(AMR_eucastrules = "all")`. If using `"custom"`, be sure to
fill in argument `custom_rules` too. Custom rules can be created with
[`custom_eucast_rules()`](https://amr-for-r.org/reference/custom_eucast_rules.md).
- verbose:
A [logical](https://rdrr.io/r/base/logical.html) to turn Verbose mode
on and off (default is off). In Verbose mode, the function does not
apply rules to the data, but instead returns a data set in logbook
form with extensive info about which rows and columns would be
effected and in which way. Using Verbose mode takes a lot more time.
- version_breakpoints:
The version number to use for the EUCAST Clinical Breakpoints
guideline. Can be "15.0", "14.0", "13.1", "12.0", "11.0", or "10.0".
- version_expected_phenotypes:
The version number to use for the EUCAST Expected Phenotypes. Can be
"1.2".
- version_expertrules:
The version number to use for the EUCAST Expert Rules and Intrinsic
Resistance guideline. Can be "3.3", "3.2", or "3.1".
- ampc_cephalosporin_resistance:
(only applies when `rules` contains `"expert"` or `"all"`) a
[character](https://rdrr.io/r/base/character.html) value that should
be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC
de-repressed cephalosporin-resistant mutants - the default is `NA`.
Currently only works when `version_expertrules` is `3.2` and higher;
these versions of '*EUCAST Expert Rules on Enterobacterales*' state
that results of cefotaxime, ceftriaxone and ceftazidime should be
reported with a note, or results should be suppressed (emptied) for
these three drugs. A value of `NA` (the default) for this argument
will remove results for these three drugs, while e.g. a value of `"R"`
will make the results for these drugs resistant. Use `NULL` or `FALSE`
to not alter results for these three drugs of AmpC de-repressed
cephalosporin-resistant mutants. Using `TRUE` is equal to using
`"R"`.
For *EUCAST Expert Rules* v3.2, this rule applies to: *Citrobacter
braakii*, *Citrobacter freundii*, *Citrobacter gillenii*, *Citrobacter
murliniae*, *Citrobacter rodenticum*, *Citrobacter sedlakii*,
*Citrobacter werkmanii*, *Citrobacter youngae*, *Enterobacter*,
*Hafnia alvei*, *Klebsiella aerogenes*, *Morganella morganii*,
*Providencia*, and *Serratia*.
- only_sir_columns:
A [logical](https://rdrr.io/r/base/logical.html) to indicate whether
only antimicrobial columns must be included that were transformed to
class [sir](https://amr-for-r.org/reference/as.sir.md) on beforehand.
Defaults to `FALSE` if no columns of `x` have a class
[sir](https://amr-for-r.org/reference/as.sir.md).
- custom_rules:
Custom rules to apply, created with
[`custom_eucast_rules()`](https://amr-for-r.org/reference/custom_eucast_rules.md).
- overwrite:
A [logical](https://rdrr.io/r/base/logical.html) indicating whether to
overwrite existing SIR values (default: `FALSE`). When `FALSE`, only
non-SIR values are modified (i.e., any value that is not already S, I
or R). To ensure compliance with EUCAST guidelines, **this should
remain** `FALSE`, as EUCAST notes often state that an organism "should
be tested for susceptibility to individual agents or be reported
resistant".
- ...:
Column names of antimicrobials. To automatically detect antimicrobial
column names, do not provide any named arguments;
[`guess_ab_col()`](https://amr-for-r.org/reference/guess_ab_col.md)
will then be used for detection. To manually specify a column, provide
its name (case-insensitive) as an argument, e.g.
`AMX = "amoxicillin"`. To skip a specific antimicrobial, set it to
`NULL`, e.g. `TIC = NULL` to exclude ticarcillin. If a manually
defined column does not exist in the data, it will be skipped with a
warning.
- ab:
Any (vector of) text that can be coerced to a valid antimicrobial drug
code with [`as.ab()`](https://amr-for-r.org/reference/as.ab.md).
- administration:
Route of administration, either "", "im", "iv", or "oral".
## Value
The input of `x`, possibly with edited values of antimicrobials. Or, if
`verbose = TRUE`, a [data.frame](https://rdrr.io/r/base/data.frame.html)
with all original and new values of the affected bug-drug combinations.
## Details
**Note:** This function does not translate MIC values to SIR values. Use
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md) for that.
**Note:** When ampicillin (AMP, J01CA01) is not available but
amoxicillin (AMX, J01CA04) is, the latter will be used for all rules
where there is a dependency on ampicillin. These drugs are
interchangeable when it comes to expression of antimicrobial
resistance.
The file containing all EUCAST rules is located here:
<https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv>.
**Note:** Old taxonomic names are replaced with the current taxonomy
where applicable. For example, *Ochrobactrum anthropi* was renamed to
*Brucella anthropi* in 2020; the original EUCAST rules v3.1 and v3.2 did
not yet contain this new taxonomic name. The `AMR` package contains the
full microbial taxonomy updated until June 24th, 2024, see
[microorganisms](https://amr-for-r.org/reference/microorganisms.md).
### Custom Rules
Custom rules can be created using
[`custom_eucast_rules()`](https://amr-for-r.org/reference/custom_eucast_rules.md),
e.g.:
x <- custom_eucast_rules(AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R",
AMC == "I" & genus == "Klebsiella" ~ aminopenicillins == "I")
eucast_rules(example_isolates, rules = "custom", custom_rules = x)
### 'Other' Rules
Before further processing, two non-EUCAST rules about drug combinations
can be applied to improve the efficacy of the EUCAST rules, and the
reliability of your data (analysis). These rules are:
1. A drug **with** enzyme inhibitor will be set to S if the same drug
**without** enzyme inhibitor is S
2. A drug **without** enzyme inhibitor will be set to R if the same
drug **with** enzyme inhibitor is R
Important examples include amoxicillin and amoxicillin/clavulanic acid,
and trimethoprim and trimethoprim/sulfamethoxazole. Needless to say, for
these rules to work, both drugs must be available in the data set.
Since these rules are not officially approved by EUCAST, they are not
applied at default. To use these rules, include `"other"` to the `rules`
argument, or use `eucast_rules(..., rules = "all")`. You can also set
the package option
[`AMR_eucastrules`](https://amr-for-r.org/reference/AMR-options.md),
i.e. run `options(AMR_eucastrules = "all")`.
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## Examples
``` r
# \donttest{
a <- data.frame(
mo = c(
"Staphylococcus aureus",
"Enterococcus faecalis",
"Escherichia coli",
"Klebsiella pneumoniae",
"Pseudomonas aeruginosa"
),
VAN = "-", # Vancomycin
AMX = "-", # Amoxicillin
COL = "-", # Colistin
CAZ = "-", # Ceftazidime
CXM = "-", # Cefuroxime
PEN = "S", # Benzylpenicillin
FOX = "S", # Cefoxitin
stringsAsFactors = FALSE
)
head(a)
#> mo VAN AMX COL CAZ CXM PEN FOX
#> 1 Staphylococcus aureus - - - - - S S
#> 2 Enterococcus faecalis - - - - - S S
#> 3 Escherichia coli - - - - - S S
#> 4 Klebsiella pneumoniae - - - - - S S
#> 5 Pseudomonas aeruginosa - - - - - S S
# apply EUCAST rules: some results wil be changed
b <- eucast_rules(a, overwrite = TRUE)
#> Warning: in `eucast_rules()`: not all columns with antimicrobial results are of
#> class 'sir'. Transform them on beforehand, with e.g.:
#> - a %>% as.sir(CXM:AMX)
#> - a %>% mutate_if(is_sir_eligible, as.sir)
#> - a %>% mutate(across(where(is_sir_eligible), as.sir))
head(b)
#> mo VAN AMX COL CAZ CXM PEN FOX
#> 1 Staphylococcus aureus - S R R S S S
#> 2 Enterococcus faecalis - - R R R S R
#> 3 Escherichia coli R - - - - R S
#> 4 Klebsiella pneumoniae R R - - - R S
#> 5 Pseudomonas aeruginosa R R - - R R R
# do not apply EUCAST rules, but rather get a data.frame
# containing all details about the transformations:
c <- eucast_rules(a, overwrite = TRUE, verbose = TRUE)
#> Warning: in `eucast_rules()`: not all columns with antimicrobial results are of
#> class 'sir'. Transform them on beforehand, with e.g.:
#> - a %>% as.sir(CXM:AMX)
#> - a %>% mutate_if(is_sir_eligible, as.sir)
#> - a %>% mutate(across(where(is_sir_eligible), as.sir))
head(c)
#> row col mo_fullname old new rule rule_group
#> 1 1 AMX Staphylococcus aureus - S Breakpoints
#> 2 1 CXM Staphylococcus aureus - S Breakpoints
#> 3 1 CAZ Staphylococcus aureus - R Expected phenotypes
#> 4 1 COL Staphylococcus aureus - R Expected phenotypes
#> 5 2 CAZ Enterococcus faecalis - R Expected phenotypes
#> 6 2 COL Enterococcus faecalis - R Expected phenotypes
#> rule_name
#> 1 Staphylococcus
#> 2 Staphylococcus
#> 3 Table 4: Expected resistant phenotype in gram-positive bacteria
#> 4 Table 4: Expected resistant phenotype in gram-positive bacteria
#> 5 Table 4: Expected resistant phenotype in gram-positive bacteria
#> 6 Table 4: Expected resistant phenotype in gram-positive bacteria
#> rule_source
#> 1 'EUCAST Clinical Breakpoint Tables' v15.0, 2025
#> 2 'EUCAST Clinical Breakpoint Tables' v15.0, 2025
#> 3 'EUCAST Expected Resistant Phenotypes' v1.2, 2023
#> 4 'EUCAST Expected Resistant Phenotypes' v1.2, 2023
#> 5 'EUCAST Expected Resistant Phenotypes' v1.2, 2023
#> 6 'EUCAST Expected Resistant Phenotypes' v1.2, 2023
# }
# Dosage guidelines:
eucast_dosage(c("tobra", "genta", "cipro"), "iv")
#> Dosages for antimicrobial drugs, as meant for 'EUCAST Clinical Breakpoint
#> Tables' v15.0 (2025). This note will be shown once per session.
#> # A tibble: 3 × 5
#> ab name standard_dosage high_dosage eucast_version
#> <ab> <chr> <chr> <chr> <dbl>
#> 1 TOB Tobramycin 6-7 mg/kg x 1 iv NA 15
#> 2 GEN Gentamicin 6-7 mg/kg x 1 iv NA 15
#> 3 CIP Ciprofloxacin 0.4 g x 2 iv 0.4 g x 3 iv 15
eucast_dosage(c("tobra", "genta", "cipro"), "iv", version_breakpoints = 10)
#> # A tibble: 3 × 5
#> ab name standard_dosage high_dosage eucast_version
#> <ab> <chr> <chr> <chr> <dbl>
#> 1 TOB Tobramycin NA NA NA
#> 2 GEN Gentamicin NA NA NA
#> 3 CIP Ciprofloxacin NA NA NA
```

View File

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

@@ -0,0 +1,92 @@
# Data Set with 2 000 Example Isolates
A data set containing 2 000 microbial isolates with their full
antibiograms. This data set contains randomised fictitious data, but
reflects reality and can be used to practise AMR data analysis. For
examples, please read [the tutorial on our
website](https://amr-for-r.org/articles/AMR.html).
## Usage
``` r
example_isolates
```
## Format
A [tibble](https://tibble.tidyverse.org/reference/tibble.html) with 2
000 observations and 46 variables:
- `date`
Date of receipt at the laboratory
- `patient`
ID of the patient
- `age`
Age of the patient
- `gender`
Gender of the patient, either "F" or "M"
- `ward`
Ward type where the patient was admitted, either "Clinical", "ICU", or
"Outpatient"
- `mo`
ID of microorganism created with
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md), see also the
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
data set
- `PEN:RIF`
40 different antimicrobials with class
[`sir`](https://amr-for-r.org/reference/as.sir.md) (see
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md)); these column
names occur in the
[antimicrobials](https://amr-for-r.org/reference/antimicrobials.md)
data set and can be translated with
[`set_ab_names()`](https://amr-for-r.org/reference/ab_property.md) or
[`ab_name()`](https://amr-for-r.org/reference/ab_property.md)
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## Examples
``` r
example_isolates
#> # A tibble: 2,000 × 46
#> date patient age gender ward mo PEN OXA FLC AMX
#> <date> <chr> <dbl> <chr> <chr> <mo> <sir> <sir> <sir> <sir>
#> 1 2002-01-02 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 2 2002-01-03 A77334 65 F Clinical B_ESCHR_COLI R NA NA NA
#> 3 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 4 2002-01-07 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 5 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 6 2002-01-13 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 7 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 8 2002-01-14 462729 78 M Clinical B_STPHY_AURS R NA S R
#> 9 2002-01-16 067927 45 F ICU B_STPHY_EPDR R NA R NA
#> 10 2002-01-17 858515 79 F ICU B_STPHY_EPDR R NA S NA
#> # 1,990 more rows
#> # 36 more variables: AMC <sir>, AMP <sir>, TZP <sir>, CZO <sir>, FEP <sir>,
#> # CXM <sir>, FOX <sir>, CTX <sir>, CAZ <sir>, CRO <sir>, GEN <sir>,
#> # TOB <sir>, AMK <sir>, KAN <sir>, TMP <sir>, SXT <sir>, NIT <sir>,
#> # FOS <sir>, LNZ <sir>, CIP <sir>, MFX <sir>, VAN <sir>, TEC <sir>,
#> # TCY <sir>, TGC <sir>, DOX <sir>, ERY <sir>, CLI <sir>, AZM <sir>,
#> # IPM <sir>, MEM <sir>, MTR <sir>, CHL <sir>, COL <sir>, MUP <sir>, …
```

View File

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

@@ -0,0 +1,70 @@
# Data Set with Unclean Data
A data set containing 3 000 microbial isolates that are not cleaned up
and consequently not ready for AMR data analysis. This data set can be
used for practice.
## Usage
``` r
example_isolates_unclean
```
## Format
A [tibble](https://tibble.tidyverse.org/reference/tibble.html) with 3
000 observations and 8 variables:
- `patient_id`
ID of the patient
- `date`
date of receipt at the laboratory
- `hospital`
ID of the hospital, from A to C
- `bacteria`
info about microorganism that can be transformed with
[`as.mo()`](https://amr-for-r.org/reference/as.mo.md), see also
[microorganisms](https://amr-for-r.org/reference/microorganisms.md)
- `AMX:GEN`
4 different antimicrobials that have to be transformed with
[`as.sir()`](https://amr-for-r.org/reference/as.sir.md)
## Download Our Reference Data
All reference data sets in the AMR package - including information on
microorganisms, antimicrobials, and clinical breakpoints - are freely
available for download in multiple formats: R, MS Excel, Apache Feather,
Apache Parquet, SPSS, and Stata.
For maximum compatibility, we also provide machine-readable,
tab-separated plain text files suitable for use in any software,
including laboratory information systems.
Visit [our website for direct download
links](https://amr-for-r.org/articles/datasets.html), or explore the
actual files in [our GitHub
repository](https://github.com/msberends/AMR/tree/main/data-raw/datasets).
## Examples
``` r
example_isolates_unclean
#> # A tibble: 3,000 × 8
#> patient_id hospital date bacteria AMX AMC CIP GEN
#> <chr> <chr> <date> <chr> <chr> <chr> <chr> <chr>
#> 1 J3 A 2012-11-21 E. coli R I S S
#> 2 R7 A 2018-04-03 K. pneumoniae R I S S
#> 3 P3 A 2014-09-19 E. coli R S S S
#> 4 P10 A 2015-12-10 E. coli S I S S
#> 5 B7 A 2015-03-02 E. coli S S S S
#> 6 W3 A 2018-03-31 S. aureus R S R S
#> 7 J8 A 2016-06-14 E. coli R S S S
#> 8 M3 A 2015-10-25 E. coli R S S S
#> 9 J3 A 2019-06-19 E. coli S S S S
#> 10 G6 A 2015-04-27 S. aureus S S S S
#> # 2,990 more rows
```

Some files were not shown because too many files have changed in this diff Show More