vignettes/datasets.Rmd
datasets.Rmd
AMR
(for R)
-Update: The latest EUCAST guideline for intrinsic resistance (v3.3, October 2021) is now supported, and our taxonomy tables has been updated as well (LPSN, 5 October 2021).
+Update: The latest EUCAST guideline for intrinsic resistance (v3.3, October 2021) is now supported, and our taxonomy tables has been updated as well (LPSN, 5 October 2021). A new version will be released after the EUCAST guideline for clinical breakpoints (v12.0, likely January 2022) are implemented, to be expected shortly after the official guideline release.
AMR
(for R)?
diff --git a/docs/news/index.html b/docs/news/index.html
index 768c9af5..802ff96e 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -17,7 +17,7 @@
AMR
1.7.1.9062AMR
1.7.1.9063p_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.Support for EUCAST Intrinsic Resistance and Unusual Phenotypes v3.3 (October 2021), effective in the eucast_rules()
function. This is now the default guideline (all other guidelines are still available).
Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese
Function 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:
@@ -178,10 +179,10 @@ example_isolates %>% set_ab_names(where(is.rsi)) example_isolates %>% set_ab_names(AMC:GEN, property = "atc")
Support for Danish, and also added missing translations of all antimicrobial drugs in Italian, French and Portuguese
antibiotics
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:
Added the selector 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.
Fix for using selectors multiple times in one call (e.g., using them in dplyr::filter()
and immediately after in dplyr::select()
)
Fix for using having multiple columns that are coerced to the same antibiotic agent
Added argument 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)
mo_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.as.ab()
and all ab_*()
functionsfortify()
extensions for plotting methodsfortify()
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 packagesget_episode()
and is_new_episode()
can now cope with NA
s
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()
+ggplot()
method for resistance_predict()
Support for custom MDRO guidelines, using the new custom_mdro_guideline()
function, please see mdro()
for additional info
ggplot()
generics for classes <mic>
and <disk>
ggplot()
generics for classes <mic>
and <disk>
Function mo_is_yeast()
, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:
@@ -427,7 +430,7 @@
translate
)plot()
and with ggplot2 using ggplot()
on any vector of MIC and disk diffusion valuesplot()
and with ggplot2 using ggplot()
on any vector of MIC and disk diffusion valuesmicroorganisms
data setis.rsi.eligible()
now detects if the column name resembles an antibiotic name or code and now returns TRUE
immediately if the input contains any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.get_episode()
and is_new_episode()
now support less than a day as value for argument episode_days
(e.g., to include one patient/test per hour)ampc_cephalosporin_resistance
in eucast_rules()
now also applies to value “I” (not only “S”)print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
+print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
guess_ab_col()
. As this also internally improves the reliability of first_isolate()
and mdro()
, this might have a slight impact on the results of those functions.mo_name()
when used in other languages than EnglishRemoved code dependency on all other R packages, making this package fully independent of the development process of others. This is a major code change, but will probably not be noticeable by most users.
Making this package independent of especially the tidyverse (e.g. packages dplyr
and tidyr
) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.
Negative effects of this change are:
-freq()
that was borrowed from the cleaner
package was removed. Use cleaner::freq()
, or run library("cleaner")
before you use freq()
.freq()
that was borrowed from the cleaner
package was removed. Use cleaner::freq()
, or run library("cleaner")
before you use freq()
.mo
or rsi
in a tibble will no longer be in colour and printing rsi
in a tibble will show the class <ord>
, not <rsi>
anymore. This is purely a visual effect.mo_*
family (like mo_name()
and mo_gramstain()
) are noticeably slower when running on hundreds of thousands of rows.mo
and ab
now both also inherit class character
, to support any data transformation. This change invalidates code that checks for class length == 1.This is important, because a value like "testvalue"
could never be understood by e.g. mo_name()
, although the class would suggest a valid microbial code.
Function freq()
has moved to a new package, clean
(CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq()
function still works, since it is re-exported from the clean
package (which will be installed automatically upon updating this AMR
package).
Function freq()
has moved to a new package, clean
(CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq()
function still works, since it is re-exported from the clean
package (which will be installed automatically upon updating this AMR
package).
Renamed data set septic_patients
to example_isolates
age()
function gained a new argument exact
to determine ages with decimalsguess_mo()
, guess_atc()
, EUCAST_rules()
, interpretive_reading()
, rsi()
freq()
):
+freq()
):
speed improvement for microbial IDs
fixed factor level names for R Markdown
when all values are unique it now shows a message instead of a warning
age_groups()
, to let groups of fives and tens end with 100+ instead of 120+freq()
for when all values are NA
+freq()
for when all values are NA
first_isolate()
for when dates are missingguess_ab_col()
@@ -1448,7 +1451,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
"HIGH S"
will return S
freq()
function):
+freq()
function):
Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:
@@ -1457,15 +1460,15 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ # OLD WAY septic_patients %>% mutate(genus = mo_genus(mo)) %>% - freq(genus) + freq(genus) # NEW WAY septic_patients %>% - freq(mo_genus(mo)) + freq(mo_genus(mo)) # Even supports grouping variables: septic_patients %>% group_by(gender) %>% - freq(mo_genus(mo))
Header info is now available as a list, with the header
function
The argument header
is now set to TRUE
at default, even for markdown
Using portion_*
functions now throws a warning when total available isolate is below argument minimum
Functions as.mo
, as.rsi
, as.mic
, as.atc
and freq
will not set package name as attribute anymore
Frequency tables - freq()
:
Frequency tables - freq()
:
Support for grouping variables, test with:
+ freq(gender)Support for (un)selecting columns:
Check for hms::is.hms
Removed diacritics from all authors (columns microorganisms$ref
and microorganisms.old$ref
) to comply with CRAN policy to only allow ASCII characters
Fix for mo_property
not working properly
Fix for eucast_rules
where some Streptococci would become ceftazidime R in EUCAST rule 4.5
Support for named vectors of class mo
, useful for top_freq()
Support for named vectors of class mo
, useful for top_freq()
ggplot_rsi
and scale_y_percent
have breaks
argument
AI improvements for as.mo
:
For lists, subsetting is possible:
my_list = list(age = septic_patients$age, gender = septic_patients$gender)
-my_list %>% freq(age)
-my_list %>% freq(gender)
R/ab_class_selectors.R
+ Source: R/ab_selectors.R
antibiotic_class_selectors.Rd
ignored, only in place to allow future extensions
an expression to be evaluated in the antibiotics data set, such as name %like% "trim"
column name of the IDs of the microorganisms (see as.mo()
), defaults to the first column of class mo
. Values will be coerced using as.mo()
.
the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.3", "3.2" or "3.1".
The ab_class()
function can be used to filter/select on a manually defined antibiotic class. It searches for results in the antibiotics data set within the columns group
, atc_group1
and atc_group2
.
The ab_selector()
function can be used to internally filter the antibiotics data set on any results, see Examples. It allows for filtering on a (part of) a certain name, and/or a group name or even a minimum of DDDs for oral treatment. This function yields the highest flexibility, but is also the least user-friendly, since it requires a hard-coded filter to set.
The administrable_per_os()
and administrable_iv()
functions also rely on the antibiotics data set - antibiotic columns will be matched where a DDD (defined daily dose) for resp. oral and IV treatment is available in the antibiotics data set.
The not_intrinsic_resistant()
function can be used to only select antibiotic columns that pose no intrinsic resistance for the microorganisms in the data set. 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. It currently applies 'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3 (2021) to determine intrinsic resistance, using the eucast_rules()
function internally. Because of this determination, this function is quite slow in terms of performance.
the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.3", "3.2" or "3.1".
a character value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to NA
. Currently only works when version_expertrules
is 3.2
; 'EUCAST Expert Rules v3.2 on Enterobacterales' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of NA
(the default) for this argument will remove results for these three agents, while e.g. a value of "R"
will make the results for these agents resistant. Use NULL
or FALSE
to not alter results for these three agents 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.
a character value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to NA
. Currently only works when version_expertrules
is 3.2
and higher; these version 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 agents. A value of NA
(the default) for this argument will remove results for these three agents, while e.g. a value of "R"
will make the results for these agents resistant. Use NULL
or FALSE
to not alter results for these three agents 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.
a logical to indicate whether only antibiotic columns must be detected that were transformed to class <rsi>
(see as.rsi()
) on beforehand (defaults to FALSE
)
Transform Input to a Microorganism Code
mo_name()
mo_fullname()
mo_shortname()
mo_subspecies()
mo_species()
mo_genus()
mo_family()
mo_order()
mo_class()
mo_phylum()
mo_kingdom()
mo_domain()
mo_type()
mo_gramstain()
mo_is_gram_negative()
mo_is_gram_positive()
mo_is_yeast()
mo_is_intrinsic_resistant()
mo_snomed()
mo_ref()
mo_authors()
mo_year()
mo_rank()
mo_taxonomy()
mo_synonyms()
mo_info()
mo_url()
mo_property()
mo_name()
mo_fullname()
mo_shortname()
mo_subspecies()
mo_species()
mo_genus()
mo_family()
mo_order()
mo_class()
mo_phylum()
mo_kingdom()
mo_domain()
mo_type()
mo_gramstain()
mo_is_gram_negative()
mo_is_gram_positive()
mo_is_yeast()
mo_is_intrinsic_resistant()
mo_snomed()
mo_ref()
mo_authors()
mo_year()
mo_lpsn()
mo_rank()
mo_taxonomy()
mo_synonyms()
mo_info()
mo_url()
mo_property()
Get Properties of a Microorganism
Determine Bug-Drug Combinations
ab_class()
ab_selector()
administrable_per_os()
administrable_iv()
aminoglycosides()
aminopenicillins()
antifungals()
antimycobacterials()
betalactams()
carbapenems()
cephalosporins()
cephalosporins_1st()
cephalosporins_2nd()
cephalosporins_3rd()
cephalosporins_4th()
cephalosporins_5th()
fluoroquinolones()
glycopeptides()
lincosamides()
lipoglycopeptides()
macrolides()
oxazolidinones()
penicillins()
polymyxins()
streptogramins()
quinolones()
tetracyclines()
trimethoprims()
ureidopenicillins()
ab_class()
ab_selector()
aminoglycosides()
aminopenicillins()
antifungals()
antimycobacterials()
betalactams()
carbapenems()
cephalosporins()
cephalosporins_1st()
cephalosporins_2nd()
cephalosporins_3rd()
cephalosporins_4th()
cephalosporins_5th()
fluoroquinolones()
glycopeptides()
lincosamides()
lipoglycopeptides()
macrolides()
oxazolidinones()
penicillins()
polymyxins()
streptogramins()
quinolones()
tetracyclines()
trimethoprims()
ureidopenicillins()
administrable_per_os()
administrable_iv()
not_intrinsic_resistant()
Antibiotic Selectors