Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by using evidence-based methods, as described in https://doi.org/10.18637/jss.v104.i03.
antibiotics
data set and updated to the latest version (LOINC v2.76)as.mic("1.28e-2")
)AMR_locale
is setclinical_breakpoints
data set for usage in as.sir()
. EUCAST 2023 (v13.0) is now the new default guideline for all MIC and disks diffusion interpretationsdosage
data setclinical_breakpoints
data set now also contains epidemiological cut-off (ECOFF) values and CLSI animal breakpoints. These two new breakpoint types can be used for MIC/disk interpretation using as.sir(..., breakpoint_type = "ECOFF")
oras.sir(..., breakpoint_type = "animal")
, which is an important new addition for veterinary microbiology.microorganisms.groups
and are used in clinical breakpoint interpretation. For example, CLSI 2023 contains breakpoints for the RGM group (Rapidly Growing Mycobacterium, containing over 80 species) which is now supported by our package.microorganisms
data set
mo_oxygen_tolerance()
to retrieve the valuesmo_is_anaerobic()
to determine which genera/species are obligate anaerobic bacteriamo_info()
.xpt
) to our download page to use in SAS softwareas.mo()
by giving more weight to fungimo_rank()
now returns NA
for 'unknown' microorganisms (B_ANAER
, B_ANAER-NEG
, B_ANAER-POS
, B_GRAMN
, B_GRAMP
, F_FUNGUS
, F_YEAST
, and UNKNOWN
)as.sir()
sir_interpretation_history()
clinical_breakpoints
as.mo()
that led to coercion of NA
values when using custom microorganism codesicu_exclude
in first_isolates()
as.mo()
algorithm:
keep_synonyms
argument when using MO codes as inputminimum_matching_score
argumentmicroorganisms.codes
reference_df
in as.mo()
as.sir()
as.sir()
This is a new major release of the AMR package, with great new additions but also some breaking changes for current users.
The full changelog can be read here.
as.sir()
instead of as.rsi()
) - all old functions still work for nowantibiogram()
(for generating traditional/combined/syndromic/WISCA antibiograms), sir_confidence_interval()
and mean_amr_distance()
, and add_custom_microorganisms()
to add custom microorganisms to this packagemicroorganisms
data set) updated to 2022 and now based on LPSN and GBIFantivirals
data set), with many new functionsAMR
1.8.1All functions in this package are considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months.
as.rsi()
on values containing capped values (such as >=
), sometimes leading to NA
"U"
for S ('susceptible urine'), "D"
for I ('susceptible dose-dependent')as.mo()
, especially for ignoring non-taxonomic text, such as:
mo_name("methicillin-resistant S. aureus (MRSA)")
#> [1] "Staphylococcus aureus"
All functions in this package are now all considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months from now on.
p_symbol()
and all filter_*()
functions (except for filter_first_isolate()
), which were all deprecated in a previous package versionkey_antibiotics()
and key_antibiotics_equal()
functions, which were deprecated and superseded by key_antimicrobials()
and antimicrobials_equal()
ggplot2::ggplot()
generics for classes <mic>
, <disk>
, <rsi>
and <resistance_predict>
as they did not follow the ggplot2
logic. They were replaced with ggplot2::autoplot()
generics.get_locale()
to get_AMR_locale()
to prevent conflicts with other packagesrsi_translation
data set. This data set now more strictly follows the WHONET software as well.eucast_rules()
, mo_is_intrinsic_resistant()
and mdro()
. The intrinsic_resistant
data set was also updated accordingly.set_ab_names()
to rename data set columns that resemble antimicrobial drugs. This allows for quickly renaming columns to official names, ATC codes, etc. Its second argument can be a tidyverse way of selecting:
example_isolates %>% set_ab_names(where(is.rsi))
example_isolates %>% set_ab_names(AMC:GEN, property = "atc")
mo_lpsn()
to retrieve the LPSN record IDab_ddd_units()
to get units of DDDs (daily defined doses), deprecating the use of ab_ddd(..., units = TRUE)
to be more consistent in data types of function outputantibiotics
data set now contains all ATC codes that are available through the WHOCC website, regardless of drugs being present in more than one ATC group. This means that:
antibiotics$atc
is now a list
containing character
vectors, and this atc
column was moved to the 5th position of the antibiotics
data setab_atc()
does not always return a character vector of length 1, and returns a list
if the input is larger than length 1ab_info()
has a slightly different outputaminopenicillins()
, antifungals()
, antimycobacterials()
, lincosamides()
, lipoglycopeptides()
, polymyxins()
, quinolones()
, streptogramins()
, trimethoprims()
and ureidopenicillins()
administrable_per_os()
and administrable_iv()
, which are based on available Defined Daily Doses (DDDs), as defined by the WHOCC. These are ideal for e.g. analysing pathogens in primary care where IV treatment is not an option. They can be combined with other AB selectors, e.g. to select penicillins that are only administrable per os (i.e., orally):
example_isolates[, penicillins() & administrable_per_os()] # base R
example_isolates %>% select(penicillins() & administrable_per_os()) # dplyr
ab_selector()
, which accepts a filter to be used internally on the antibiotics
data set, yielding great flexibility on drug properties, such as selecting antibiotic columns with an oral DDD of at least 1 gram:
example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")] # base R
example_isolates %>% select(ab_selector(oral_ddd > 1 & oral_units == "g")) # dplyr
not_intrinsic_resistant()
, which only keeps antibiotic columns that are not intrinsic resistant for all microorganisms in a data set, based on the latest EUCAST guideline on intrinsic resistance. For example, if a data set contains only microorganism codes or names of E. coli and K. pneumoniae and contains a column "vancomycin", this column will be removed (or rather, unselected) using this function.only_treatable
, which defaults to TRUE
and will exclude drugs that are only for laboratory tests and not for treating patients (such as imipenem/EDTA and gentamicin-high)dplyr::filter()
and immediately after in dplyr::select()
)all()
or any()
on antibiotic selectors in an R Markdown filemo_gramstain()
) determination of the taxonomic class Negativicutes within the phylum of Firmicutes - they were considered Gram-positives because of their phylum but are actually Gram-negative. This impacts 137 taxonomic species, genera and families, such as Negativicoccus and Veillonella.first_isolate()
NA
s for old MO codes when running as.mo()
on themproportion_*()
and count_*()
functions failas.mo()
col_*
arguments are left blank, e.g. in first_isolate()
random_mic()
, random_disk()
and random_rsi()
are now enforcedas.rsi()
has an improved algorithm and can now also correct for textual input (such as "Susceptible", "Resistant") in all supported languagesas.mic()
has an improved algorithmcount_*()
, proportion_*()
function (or resistant()
or susceptible()
), the dplyr
group will be shown, if availablescale_rsi_colours()
when using ggplot2
v3.3.4 or higher (this is ggplot2 bug 4511, soon to be fixed)as.mo()
random_mic()
as.ab()
and all ab_*()
functionsfortify()
extensions for plotting methodsNA
values of the classes <mic>
, <disk>
and <rsi>
are now exported objects of this package, e.g. NA_mic_
is an NA
of class mic
(just like the base R NA_character_
is an NA
of class character
)proportion_df()
, count_df()
and rsi_df()
functions now return with the additional S3 class 'rsi_df' so they can be extended by other packagesmdro()
function now returns NA
for all rows that have no test resultsspecies_id
column in the microorganisms
data set now only contains LPSN record numbers. For this reason, this column is now numeric instead of a character, and mo_url()
has been updated to reflect this change.get_episode()
and is_new_episode()
get_episode()
and is_new_episode()
can now cope with NA
scarbapenems()
, aminoglycosides()
) can now be used for filtering as well, making all their accompanying filter_*()
functions redundant (such as filter_carbapenems()
, filter_aminoglycosides()
). These functions are now deprecated and will be removed in a next release. Examples of how the selectors can be used for filtering:
# select columns with results for carbapenems
example_isolates[, carbapenems()] # base R
example_isolates %>% select(carbapenems()) # dplyr
# filter rows for resistance in any carbapenem
example_isolates[any(carbapenems() == "R"), ] # base R
example_isolates %>% filter(any(carbapenems() == "R")) # dplyr
example_isolates %>% filter(if_any(carbapenems(), ~.x == "R")) # dplyr (formal)
# filter rows for resistance in all carbapenems
example_isolates[all(carbapenems() == "R"), ] # base R
example_isolates[carbapenems() == "R", ]
example_isolates %>% filter(all(carbapenems() == "R")) # dplyr
example_isolates %>% filter(carbapenems() == "R")
as.rsi()
)custom_eucast_rules()
that brings support for custom AMR rules in eucast_rules()
italicise_taxonomy()
to make taxonomic names within a string italic, with support for markdown and ANSIfirst_isolate()
function gained the argument method
that has to be "phenotype-based", "episode-based", "patient-based", or "isolate-based". The old behaviour is equal to "episode-based". The new default is "phenotype-based" if antimicrobial test results are available, and "episode-based" otherwise. This new default will yield slightly more isolates for selection (which is a good thing).key_antibiotics()
and key_antibiotics_equal()
are now deprecated in favour of the key_antimicrobials()
and antimicrobials_equal()
functions. Also, the new all_antimicrobials()
function works like the old key_antibiotics()
function, but includes any column with antimicrobial test results. Using key_antimicrobials()
still only selects six preferred antibiotics for Gram-negatives, six for Gram-positives, and six universal antibiotics. It has a new antifungal
argument to set antifungal agents (antimycotics).type == "points"
in the first_isolate()
function for phenotype-based selection will now consider all antimicrobial drugs in the data set, using the new all_antimicrobials()
first_isolate()
function can now take a vector of values for col_keyantibiotics
and can have an episode length of Inf
filter_first_isolate()
renders the filter_first_weighted_isolate()
function redundant. For this reason, filter_first_weighted_isolate()
is now deprecated.first_isolate()
and key_antimicrobials()
functions has been completely rewritten.betalactams()
as additional antbiotic column selector and function filter_betalactams()
as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.ggplot()
method for resistance_predict()
bug_drug_combinations()
now supports grouping using the dplyr
packagemdro()
, custom_mdro_guideline()
):
c()
age_groups()
for persons aged zeroexample_isolates
data set now contains some (fictitious) zero-year old patientsdata.frame
or tibble
now gives a warning if the data contains old microbial codes (from a previous AMR package version)like()
functions:
pattern
is a valid regular expression%unlike%
and %unlike_case%
(as negations of the existing %like%
and %like_case%
). This greatly improves readability:
if (!grepl("EUCAST", guideline)) ...
# same:
if (guideline %unlike% "EUCAST") ...
%like%
-> %unlike%
-> %like_case%
-> %unlike_case%
if you keep pressing your keyboard shortcutinfo
argument to as.mo()
to turn on/off the progress barcol_mo
in some functions (esp. eucast_rules()
and mdro()
) could not be a column name of the microorganisms
data set as it would throw an erroras.rsi()
) when the vctrs
package is loaded (i.e., when using tidyverse)barplot()
on an RSI classmicroorganisms.codes
data setantibiotics
data setskimr::skim()
on classes mo
, mic
and disk
when using the just released dplyr
v1.0.6skimr::skim()
usage for MIC values to also include 25th and 75th percentilesdplyr
join functions if the dplyr
package is installed - now also preserving grouped variablescephalosporins()
) now maintain the column order from the original datafluoroquinolones()
age()
now vectorises over both x
and reference
tinytest
package, instead of the testthat
package. The testthat
package unfortunately requires tons of dependencies that are also heavy and only usable for recent R versions, disallowing developers to test a package under any R 3.* version. On the contrary, the tinytest
package is very lightweight and dependency-free.