AMR.Rmd
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. However, the methodology remains unchanged. This page was generated on 01 July 2019.
+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. However, the methodology remains unchanged. This page was generated on 06 August 2019.
As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the tidyverse packages dplyr
and ggplot2
by Dr Hadley Wickham. 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.
Our AMR
package depends on these packages and even extends their use and functions.
library(dplyr)
-library(ggplot2)
-library(AMR)
-
-# (if not yet installed, install with:)
-# install.packages(c("tidyverse", "AMR"))
library(dplyr)
+library(ggplot2)
+library(AMR)
+
+# (if not yet installed, install with:)
+# install.packages(c("tidyverse", "AMR"))
To start with patients, we need a unique list of patients.
- +The LETTERS
object is available in R - it’s a vector with 26 characters: A
to Z
. The patients
object we just created is now a vector of length 260, with values (patient IDs) varying from A1
to Z10
. Now we we also set the gender of our patients, by putting the ID and the gender in a table:
The first 135 patient IDs are now male, the other 125 are female.
Let’s pretend that our data consists of blood cultures isolates from between 1 January 2010 and 1 January 2018.
- +This dates
object now contains all days in our date range.
For this tutorial, we will uses four different microorganisms: Escherichia coli, Staphylococcus aureus, Streptococcus pneumoniae, and Klebsiella pneumoniae:
- +For completeness, we can also add the hospital where the patients was admitted and we need to define valid antibmicrobial results for our randomisation:
- +Using the sample()
function, we can randomly select items from all objects we defined earlier. To let our fake data reflect reality a bit, we will also approximately define the probabilities of bacteria and the antibiotic results with the prob
parameter.
sample_size <- 20000
-data <- data.frame(date = sample(dates, size = sample_size, replace = TRUE),
- patient_id = sample(patients, size = sample_size, replace = TRUE),
- hospital = sample(hospitals, size = sample_size, replace = TRUE,
- prob = c(0.30, 0.35, 0.15, 0.20)),
- bacteria = sample(bacteria, size = sample_size, replace = TRUE,
- prob = c(0.50, 0.25, 0.15, 0.10)),
- AMX = sample(ab_interpretations, size = sample_size, replace = TRUE,
- prob = c(0.60, 0.05, 0.35)),
- AMC = sample(ab_interpretations, size = sample_size, replace = TRUE,
- prob = c(0.75, 0.10, 0.15)),
- CIP = sample(ab_interpretations, size = sample_size, replace = TRUE,
- prob = c(0.80, 0.00, 0.20)),
- GEN = sample(ab_interpretations, size = sample_size, replace = TRUE,
- prob = c(0.92, 0.00, 0.08))
- )
sample_size <- 20000
+data <- data.frame(date = sample(dates, size = sample_size, replace = TRUE),
+ patient_id = sample(patients, size = sample_size, replace = TRUE),
+ hospital = sample(hospitals, size = sample_size, replace = TRUE,
+ prob = c(0.30, 0.35, 0.15, 0.20)),
+ bacteria = sample(bacteria, size = sample_size, replace = TRUE,
+ prob = c(0.50, 0.25, 0.15, 0.10)),
+ AMX = sample(ab_interpretations, size = sample_size, replace = TRUE,
+ prob = c(0.60, 0.05, 0.35)),
+ AMC = sample(ab_interpretations, size = sample_size, replace = TRUE,
+ prob = c(0.75, 0.10, 0.15)),
+ CIP = sample(ab_interpretations, size = sample_size, replace = TRUE,
+ prob = c(0.80, 0.00, 0.20)),
+ GEN = sample(ab_interpretations, size = sample_size, replace = TRUE,
+ prob = c(0.92, 0.00, 0.08))
+ )
Using the left_join()
function from the dplyr
package, we can ‘map’ the gender to the patient ID using the patients_table
object we created earlier:
The resulting data set contains 20,000 blood culture isolates. With the head()
function we can preview the first 6 values of this data set:
For the vancomycin resistance in Gram positive bacteria, a linear model might be more appropriate since no (left half of a) binomial distribution is to be expected based on the observed years:
-septic_patients %>%
- filter(mo_gramstain(mo, language = NULL) == "Gram-positive") %>%
- resistance_predict(col_ab = "VAN", year_min = 2010, info = FALSE, model = "linear") %>%
- ggplot_rsi_predict()
-# NOTE: Using column `date` as input for `col_date`.
septic_patients %>%
+ filter(mo_gramstain(mo, language = NULL) == "Gram-positive") %>%
+ resistance_predict(col_ab = "VAN", year_min = 2010, info = FALSE, model = "linear") %>%
+ ggplot_rsi_predict()
+# NOTE: Using column `date` as input for `col_date`.
This seems more likely, doesn’t it?
The model itself is also available from the object, as an attribute
:
(
This package is ready-to-use for a professional environment by specialists in the following fields:
Medical Microbiology
@@ -248,7 +240,7 @@This package is available on the official R network (CRAN), which has a peer-reviewed submission process. Install this package in R with:
- +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 development version.
The latest and unpublished development version can be installed with (precaution: may be unstable):
- +WHO Collaborating Centre for Drug Statistics Methodology
This package contains all ~450 antimicrobial drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD, oral and IV) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission.
+NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.
Read more about the data from WHOCC in our manual.
We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an example data set WHONET
with the exact same structure as a WHONET export file. Furthermore, this package also contains a data set antibiotics
with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.
Read our tutorial about how to work with WHONET data here.
@@ -314,7 +307,7 @@It cleanses existing data by providing new classes for microoganisms, antibiotics and antimicrobial results (both S/I/R and MIC). By installing this package, you teach R everything about microbiology that is needed for analysis. These functions all use intelligent rules to guess results that you would expect:
as.mo()
to get a microbial ID. The IDs are human readable for the trained eye - the ID of Klebsiella pneumoniae is “B_KLBSL_PNE” (B stands for Bacteria) and the ID of S. aureus is “B_STPHY_AUR”. The function takes almost any text as input that looks like the name or code of a microorganism like “E. coli”, “esco” or “esccol” and tries to find expected results using intelligent rules combined with the included Catalogue of Life data set. It only takes milliseconds to find results, please see our benchmarks. Moreover, it can group Staphylococci into coagulase negative and positive (CoNS and CoPS, see source) and can categorise Streptococci into Lancefield groups (like beta-haemolytic Streptococcus Group B, source).as.ab()
to get an antibiotic ID. Like microbial IDs, these IDs are also human readable based on those used by EARS-Net. For example, the ID of amoxicillin is AMX
and the ID of gentamicin is GEN
. The as.ab()
function also uses intelligent rules to find results like accepting misspelling, trade names and abbrevations used in many laboratory systems. For instance, the values “Furabid”, “Furadantin”, “nitro” all return the ID of Nitrofurantoine. To accomplish this, the package contains a database with most LIS codes, official names, trade names, DDDs and categories of antibiotics. The function as.atc()
will return the ATC code of an antibiotic as defined by the WHO.as.ab()
to get an antibiotic ID. Like microbial IDs, these IDs are also human readable based on those used by EARS-Net. For example, the ID of amoxicillin is AMX
and the ID of gentamicin is GEN
. The as.ab()
function also uses intelligent rules to find results like accepting misspelling, trade names and abbrevations used in many laboratory systems. For instance, the values “Furabid”, “Furadantin”, “nitro” all return the ID of Nitrofurantoine. To accomplish this, the package contains a database with most LIS codes, official names, trade names, ATC codes, defined daily doses (DDD) and drug categories of antibiotics.as.rsi()
to get antibiotic interpretations based on raw MIC values (in mg/L) or disk diffusion values (in mm), or transform existing values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like “<=0.002; S” (combined MIC/RSI) will result in “S”.as.mic()
to cleanse your MIC values. It produces a so-called factor (called ordinal in SPSS) with valid MIC values as levels. A value like “<=0.002; S” (combined MIC/RSI) will result in “<=0.002”.mdro()
(abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.microorganisms
contains the complete taxonomic tree of ~65,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like mo_genus()
, mo_family()
, mo_gramstain()
or even mo_phylum()
. As they use as.mo()
internally, they also use the same intelligent rules for determination. For example, mo_genus("MRSA")
and mo_genus("S. aureus")
will both return "Staphylococcus"
. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.antibiotics
contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like ab_name()
, ab_group()
and ab_tradenames()
to look up values. The ab_*
functions use as.ab()
internally so they support the same intelligent rules to guess the most probable result. For example, ab_name("Fluclox")
, ab_name("Floxapen")
and ab_name("J01CF05")
will all return "Flucloxacillin"
. These functions can again be used to add new variables to your data.antibiotics
contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. The function ab_atc()
will return the ATC code of an antibiotic as defined by the WHO. Use functions like ab_name()
, ab_group()
and ab_tradenames()
to look up values. The ab_*
functions use as.ab()
internally so they support the same intelligent rules to guess the most probable result. For example, ab_name("Fluclox")
, ab_name("Floxapen")
and ab_name("J01CF05")
will all return "Flucloxacillin"
. These functions can again be used to add new variables to your data.portion_R()
, portion_IR()
, portion_I()
, portion_SI()
and portion_S()
functions. Similarly, the number of isolates can be determined with the count_R()
, count_IR()
, count_I()
, count_SI()
and count_S()
functions. All these functions can be used with the dplyr
package (e.g. in conjunction with summarise()
)geom_rsi()
, a function made for the ggplot2
packageresistance_predict()
functionkurtosis()
, skewness()
and create frequency tables with freq()
-freq()
has moved to a new package, clean
(CRAN link). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the freq()
function. The clean
package is available on CRAN and will be installed automatically when updating the AMR
package, that now imports it. In a later stage, the skewness()
and kurtosis()
functions will be moved to the clean
package too.Additional way to calculate co-resistance, i.e. when using multiple antibiotics as input for portion_*
functions or count_*
functions. This can be used to determine the empiric susceptibily of a combination therapy. A new parameter only_all_tested
(which defaults to FALSE
) replaces the old also_single_tested
and can be used to select one of the two methods to count isolates and calculate portions. The difference can be seen in this example table (which is also on the portion
and count
help pages), where the %SI is being determined:
# -------------------------------------------------------------------------
-# only_all_tested = FALSE only_all_tested = TRUE
-# Antibiotic Antibiotic ----------------------- -----------------------
-# A B include as include as include as include as
-# numerator denominator numerator denominator
-# ---------- ---------- ---------- ----------- ---------- -----------
-# S S X X X X
-# I S X X X X
-# R S X X X X
-# not tested S X X - -
-# S I X X X X
-# I I X X X X
-# R I X X X X
-# not tested I X X - -
-# S R X X X X
-# I R X X X X
-# R R - X - X
-# not tested R - - - -
-# S not tested X X - -
-# I not tested X X - -
-# R not tested - - - -
-# not tested not tested - - - -
-# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
+# only_all_tested = FALSE only_all_tested = TRUE
+# Antibiotic Antibiotic ----------------------- -----------------------
+# A B include as include as include as include as
+# numerator denominator numerator denominator
+# ---------- ---------- ---------- ----------- ---------- -----------
+# S S X X X X
+# I S X X X X
+# R S X X X X
+# not tested S X X - -
+# S I X X X X
+# I I X X X X
+# R I X X X X
+# not tested I X X - -
+# S R X X X X
+# I R X X X X
+# R R - X - X
+# not tested R - - - -
+# S not tested X X - -
+# I not tested X X - -
+# R not tested - - - -
+# not tested not tested - - - -
+# -------------------------------------------------------------------------
Since this is a major change, usage of the old also_single_tested
will throw an informative error that it has been replaced by only_all_tested
.
eucast_rules()
that caused an error when the input was a specific kind of tibble
+atc
- using as.atc()
is now deprecated in favour of ab_atc()
and this will return a character, not the atc
class anymoreabname()
, ab_official()
, atc_name()
, atc_official()
, atc_property()
, atc_tradenames()
, atc_trivial_nl()
mo_shortname()
as.mo()
where misspelled input would not be understoodas.mo()
:
+mo_*
functions where the coercion uncertainties and failures would not be available through mo_uncertainties()
and mo_failures()
anymorecountry
parameter of mdro()
in favour of the already existing guideline
parameter to support multiple guidelines within one countrygroup_by()
)RIF
is now Rifampicin instead of Rifampinname
of RIF
is now Rifampicin instead of Rifampinantibiotics
data set is now sorted by nameeucast_rules(..., verbose = TRUE)
returns more informative and readable outputguess_ab_col()
which is now 30 times faster for antibiotic abbreviationsFunction rsi_df()
to transform a data.frame
to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions count_df()
and portion_df()
to immediately show resistance percentages and number of available isolates:
Support for all scientifically published pathotypes of E. coli to date (that we could find). Supported are:
@@ -322,12 +332,12 @@All these lead to the microbial ID of E. coli:
-as.mo("UPEC")
-# B_ESCHR_COL
-mo_name("UPEC")
-# "Escherichia coli"
-mo_gramstain("EHEC")
-# "Gram-negative"
as.mo("UPEC")
+# B_ESCHR_COL
+mo_name("UPEC")
+# "Escherichia coli"
+mo_gramstain("EHEC")
+# "Gram-negative"
mo_info()
as an analogy to ab_info()
. The mo_info()
prints a list with the full taxonomy, authors, and the URL to the online database of a microorganismFunction mo_synonyms()
to get all previously accepted taxonomic names of a microorganism
exact
to determine ages with decimals
guess_mo()
, guess_atc()
, EUCAST_rules()
, interpretive_reading()
, rsi()
freq()
):
+freq()
):
support for boxplots:
- +freq()
for when all values are NA
+freq()
for when all values are NA
first_isolate()
for when dates are missingguess_ab_col()
@@ -465,9 +475,9 @@ Please
+ New website!
We’ve got a new website: https://msberends.gitlab.io/AMR (built with the great pkgdown
)
mo
codes changed (e.g. Streptococcus changed from B_STRPTC
to B_STRPT
). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.mo
codes changed (e.g. Streptococcus changed from B_STRPTC
to B_STRPT
). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.mo_rank()
for the taxonomic rank (genus, species, infraspecies, etc.)mo_url()
to get the direct URL of a species from the Catalogue of LifeNew filters for antimicrobial classes. Use these functions to filter isolates on results in one of more antibiotics from a specific class:
-filter_aminoglycosides()
-filter_carbapenems()
-filter_cephalosporins()
-filter_1st_cephalosporins()
-filter_2nd_cephalosporins()
-filter_3rd_cephalosporins()
-filter_4th_cephalosporins()
-filter_fluoroquinolones()
-filter_glycopeptides()
-filter_macrolides()
-filter_tetracyclines()
filter_aminoglycosides()
+filter_carbapenems()
+filter_cephalosporins()
+filter_1st_cephalosporins()
+filter_2nd_cephalosporins()
+filter_3rd_cephalosporins()
+filter_4th_cephalosporins()
+filter_fluoroquinolones()
+filter_glycopeptides()
+filter_macrolides()
+filter_tetracyclines()
The antibiotics
data set will be searched, after which the input data will be checked for column names with a value in any abbreviations, codes or official names found in the antibiotics
data set. For example:
All ab_*
functions are deprecated and replaced by atc_*
functions:
ab_property -> atc_property()
-ab_name -> atc_name()
-ab_official -> atc_official()
-ab_trivial_nl -> atc_trivial_nl()
-ab_certe -> atc_certe()
-ab_umcg -> atc_umcg()
-ab_tradenames -> atc_tradenames()
as.atc()
internally. The old atc_property
has been renamed atc_online_property()
. This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc
or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo()
and e.g. mo_genus
.ab_property -> atc_property()
+ab_name -> atc_name()
+ab_official -> atc_official()
+ab_trivial_nl -> atc_trivial_nl()
+ab_certe -> atc_certe()
+ab_umcg -> atc_umcg()
+ab_tradenames -> atc_tradenames()
as.atc()
internally. The old atc_property
has been renamed atc_online_property()
. This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc
or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo()
and e.g. mo_genus
.
set_mo_source()
and get_mo_source()
to use your own predefined MO codes as input for as.mo()
and consequently all mo_*
functionsdplyr
version 0.8.0guess_ab_col()
to find an antibiotic column in a tableas.atc()New function age_groups()
to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
New function ggplot_rsi_predict()
as well as the base R plot()
function can now be used for resistance prediction calculated with resistance_predict()
:
-
+
Functions filter_first_isolate()
and filter_first_weighted_isolate()
to shorten and fasten filtering on data sets with antimicrobial results, e.g.:
-
+
is equal to:
-
+
New function availability()
to check the number of available (non-empty) results in a data.frame
@@ -597,33 +607,33 @@ These functions use as.atc()
Now handles incorrect spelling, like i
instead of y
and f
instead of ph
:
-
+
Uncertainty of the algorithm is now divided into four levels, 0 to 3, where the default allow_uncertain = TRUE
is equal to uncertainty level 2. Run ?as.mo
for more info about these levels.
-# equal:
-as.mo(..., allow_uncertain = TRUE)
-as.mo(..., allow_uncertain = 2)
-
-# also equal:
-as.mo(..., allow_uncertain = FALSE)
-as.mo(..., allow_uncertain = 0)
+# equal:
+as.mo(..., allow_uncertain = TRUE)
+as.mo(..., allow_uncertain = 2)
+
+# also equal:
+as.mo(..., allow_uncertain = FALSE)
+as.mo(..., allow_uncertain = 0)
Using as.mo(..., allow_uncertain = 3)
could lead to very unreliable results.
Implemented the latest publication of Becker et al. (2019), for categorising coagulase-negative Staphylococci
All microbial IDs that found are now saved to a local file ~/.Rhistory_mo
. Use the new function clean_mo_history()
to delete this file, which resets the algorithms.
Incoercible results will now be considered ‘unknown’, MO code UNKNOWN
. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:
-
+
Fix for vector containing only empty values
Finds better results when input is in other languages
@@ -665,23 +675,23 @@ Using as.mo(..., allow_uncertain = 3)
-Frequency tables (freq()
function):
+ Frequency tables (freq()
function):
-
Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:
-# Determine genus of microorganisms (mo) in `septic_patients` data set:
-# OLD WAY
-septic_patients %>%
- mutate(genus = mo_genus(mo)) %>%
- freq(genus)
-# NEW WAY
-septic_patients %>%
- freq(mo_genus(mo))
-
-# Even supports grouping variables:
-septic_patients %>%
- group_by(gender) %>%
- freq(mo_genus(mo))
+# Determine genus of microorganisms (mo) in `septic_patients` data set:
+# OLD WAY
+septic_patients %>%
+ mutate(genus = mo_genus(mo)) %>%
+ freq(genus)
+# NEW WAY
+septic_patients %>%
+ 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 parameter
header
is now set to TRUE
at default, even for markdown
@@ -712,9 +722,9 @@ Using as.mo(..., allow_uncertain = 3)
as.mo(..., allow_uncertain = 3)Fewer than 3 characters as input for as.mo
will return NA
Function as.mo
(and all mo_*
wrappers) now supports genus abbreviations with “species” attached
-
+
Added parameter combine_IR
(TRUE/FALSE) to functions portion_df
and count_df
, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)
Fix for portion_*(..., as_percent = TRUE)
when minimal number of isolates would not be met
@@ -768,21 +778,21 @@ Using as.mo(..., allow_uncertain = 3)Using portion_*
functions now throws a warning when total available isolate is below parameter 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:
-
+
-
Support for (un)selecting columns:
-
+
-- Check for
hms::is.hms
+ - Check for
hms::is.hms
- Now prints in markdown at default in non-interactive sessions
- No longer adds the factor level column and sorts factors on count again
@@ -800,7 +810,7 @@ Using as.mo(..., allow_uncertain = 3)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
parameter
@@ -839,9 +849,9 @@ Using as.mo(..., allow_uncertain = 3)
as.mo(..., allow_uncertain = 3)
They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:
-mo_gramstain("E. coli")
-# [1] "Gram negative"
-mo_gramstain("E. coli", language = "de") # German
-# [1] "Gramnegativ"
-mo_gramstain("E. coli", language = "es") # Spanish
-# [1] "Gram negativo"
-mo_fullname("S. group A", language = "pt") # Portuguese
-# [1] "Streptococcus grupo A"
+mo_gramstain("E. coli")
+# [1] "Gram negative"
+mo_gramstain("E. coli", language = "de") # German
+# [1] "Gramnegativ"
+mo_gramstain("E. coli", language = "es") # Spanish
+# [1] "Gram negativo"
+mo_fullname("S. group A", language = "pt") # Portuguese
+# [1] "Streptococcus grupo A"
Furthermore, former taxonomic names will give a note about the current taxonomic name:
-mo_gramstain("Esc blattae")
-# Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)
-# [1] "Gram negative"
+mo_gramstain("Esc blattae")
+# Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)
+# [1] "Gram negative"
Functions count_R
, count_IR
, count_I
, count_SI
and count_S
to selectively count resistant or susceptible isolates
@@ -882,18 +892,18 @@ Using as.mo(..., allow_uncertain = 3)
-
Functions as.mo
and is.mo
as replacements for as.bactid
and is.bactid
(since the microoganisms
data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The as.mo
function determines microbial IDs using intelligent rules:
-as.mo("E. coli")
-# [1] B_ESCHR_COL
-as.mo("MRSA")
-# [1] B_STPHY_AUR
-as.mo("S group A")
-# [1] B_STRPTC_GRA
+as.mo("E. coli")
+# [1] B_ESCHR_COL
+as.mo("MRSA")
+# [1] B_STPHY_AUR
+as.mo("S group A")
+# [1] B_STRPTC_GRA
And with great speed too - on a quite regular Linux server from 2007 it takes us less than 0.02 seconds to transform 25,000 items:
-
+
- Added parameter
reference_df
for as.mo
, so users can supply their own microbial IDs, name or codes as a reference table
- Renamed all previous references to
bactid
to mo
, like:
@@ -921,12 +931,12 @@ Using as.mo(..., allow_uncertain = 3)Added three antimicrobial agents to the antibiotics
data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)
-
Added 163 trade names to the antibiotics
data set, it now contains 298 different trade names in total, e.g.:
-
+
- For
first_isolate
, rows will be ignored when there’s no species available
- Function
ratio
is now deprecated and will be removed in a future release, as it is not really the scope of this package
@@ -937,13 +947,13 @@ Using as.mo(..., allow_uncertain = 3)
-
Support for quasiquotation in the functions series count_*
and portions_*
, and n_rsi
. This allows to check for more than 2 vectors or columns.
-
+
- Edited
ggplot_rsi
and geom_rsi
so they can cope with count_df
. The new fun
parameter has value portion_df
at default, but can be set to count_df
.
- Fix for
ggplot_rsi
when the ggplot2
package was not loaded
@@ -957,12 +967,12 @@ Using as.mo(..., allow_uncertain = 3)
-
Support for types (classes) list and matrix for freq
-
+
For lists, subsetting is possible:
-
+
as.mo(..., allow_uncertain = 3)
as.mo(..., allow_uncertain = 3)
A vignette to explain its usage
Support for rsi
(antimicrobial resistance) to use as input
-Support for table
to use as input: freq(table(x, y))
+ Support for table
to use as input: freq(table(x, y))
Support for existing functions hist
and plot
to use a frequency table as input: hist(freq(df$age))
Support for as.vector
, as.data.frame
, as_tibble
and format
-Support for quasiquotation: freq(mydata, mycolumn)
is the same as mydata %>% freq(mycolumn)
+ Support for quasiquotation: freq(mydata, mycolumn)
is the same as mydata %>% freq(mycolumn)
Function top_freq
function to return the top/below n items as vector
Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)
@@ -1081,7 +1091,7 @@ Using as.mo(..., allow_uncertain = 3)
-Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002")
now works
+Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002")
now works
Classes rsi
and mic
do not add the attribute package.version
anymore
Added "groups"
option for atc_property(..., property)
. It will return a vector of the ATC hierarchy as defined by the WHO. The new function atc_groups
is a convenient wrapper around this.
Build-in host check for atc_property
as it requires the host set by url
to be responsive
@@ -1111,9 +1121,9 @@ Using as.mo(..., allow_uncertain = 3)
as.mo(..., allow_uncertain = 3)
as.mo(..., allow_uncertain = 3)Added barplots for rsi
and mic
classes
as.mo(..., allow_uncertain = 3)
Contents
ITIS.Rd
All taxonomic names of all microorganisms are included in this package, using the authoritative Integrated Taxonomic Information System (ITIS).
- -
-This package contains the complete microbial taxonomic data (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, https://www.itis.gov).
All ~20,000 (sub)species from the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package, as well as all their ~2,500 previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since ITIS honours the taxonomic branching order of bacterial phyla according to Cavalier-Smith (2002), which defines that all bacteria are classified into either subkingdom Negibacteria or subkingdom Posibacteria.
-ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
- -
-On our website https://msberends.gitlab.io/AMR you can find a comprehensive tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data.
# NOT RUN { -# Get a note when a species was renamed -mo_shortname("Chlamydia psittaci") -# Note: 'Chlamydia psittaci' (Page, 1968) was renamed -# 'Chlamydophila psittaci' (Everett et al., 1999) -# [1] "C. psittaci" - -# Get any property from the entire taxonomic tree for all included species -mo_class("E. coli") -# [1] "Gammaproteobacteria" - -mo_family("E. coli") -# [1] "Enterobacteriaceae" - -mo_subkingdom("E. coli") -# [1] "Negibacteria" - -mo_gramstain("E. coli") # based on subkingdom -# [1] "Gram negative" - -mo_ref("E. coli") -# [1] "Castellani and Chalmers, 1919" - -# Do not get mistaken - the package only includes microorganisms -mo_phylum("C. elegans") -# [1] "Cyanobacteria" # Bacteria?! -mo_fullname("C. elegans") -# [1] "Chroococcus limneticus elegans" # Because a microorganism was found -# }-
-This package contains all ~450 antimicrobial 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://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/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.
diff --git a/docs/reference/WHONET.html b/docs/reference/WHONET.html index 205a3cd2f..8366c8c8a 100644 --- a/docs/reference/WHONET.html +++ b/docs/reference/WHONET.html @@ -80,7 +80,7 @@
-This package contains all ~450 antimicrobial 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://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/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.
diff --git a/docs/reference/as.ab.html b/docs/reference/as.ab.html index b2fb70b55..80e2ce26e 100644 --- a/docs/reference/as.ab.html +++ b/docs/reference/as.ab.html @@ -80,7 +80,7 @@
-This package contains all ~450 antimicrobial 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://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/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.
diff --git a/docs/reference/as.disk.html b/docs/reference/as.disk.html index b2aa1c906..2b43b8e6a 100644 --- a/docs/reference/as.disk.html +++ b/docs/reference/as.disk.html @@ -80,7 +80,7 @@# NOT RUN { library(dplyr) -microorganisms %>% freq(kingdom) -microorganisms %>% group_by(kingdom) %>% freq(phylum, nmax = NULL) +library(clean) +microorganisms %>% freq(kingdom) +microorganisms %>% group_by(kingdom) %>% freq(phylum, nmax = NULL) # }@@ -159,13 +159,6 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_ Get properties of an antibiotic
a logical to indicate whether extensive info should be returned as a data.frame
with info about which rows and columns are effected. It runs all EUCAST rules, but will not be applied to an output - only an informative data.frame
with changes will be returned as output.
a logical 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.frame
with extensive info about which rows and columns would be effected and in which way.
# NOT RUN { -a <- eucast_rules(septic_patients) - a <- data.frame(mo = c("Staphylococcus aureus", "Enterococcus faecalis", "Escherichia coli", @@ -418,7 +409,7 @@ # 5 Pseudomonas aeruginosa R R - - R R R -# do not apply EUCAST rules, but rather get a a data.frame +# do not apply EUCAST rules, but rather get a data.frame # with 18 rows, containing all details about the transformations: c <- eucast_rules(a, verbose = TRUE) # }diff --git a/docs/reference/extended-functions.html b/docs/reference/extended-functions.html index ce2e53b53..60d1a7c1e 100644 --- a/docs/reference/extended-functions.html +++ b/docs/reference/extended-functions.html @@ -80,7 +80,7 @@ @@ -158,13 +158,6 @@ Get properties of an antibiotic -
Functions for conducting AMR analysis, like counting isolates, calculating resistance or susceptibility, creating frequency tables or make plots.
+Functions for conducting AMR analysis, like counting isolates, calculating resistance or susceptibility, or make plots.
Filter isolates on result in antibiotic class
Frequency table
ITIS.Rd
All taxonomic names of all microorganisms are included in this package, using the authoritative Integrated Taxonomic Information System (ITIS).
- -
-This package contains the complete microbial taxonomic data (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, https://www.itis.gov).
All ~20,000 (sub)species from the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package, as well as all their ~2,500 previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since ITIS honours the taxonomic branching order of bacterial phyla according to Cavalier-Smith (2002), which defines that all bacteria are classified into either subkingdom Negibacteria or subkingdom Posibacteria.
-ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
- -
-On our website https://msberends.gitlab.io/AMR you can find a comprehensive tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data.
# NOT RUN { -# Get a note when a species was renamed -mo_shortname("Chlamydia psittaci") -# Note: 'Chlamydia psittaci' (Page, 1968) was renamed -# 'Chlamydophila psittaci' (Everett et al., 1999) -# [1] "C. psittaci" - -# Get any property from the entire taxonomic tree for all included species -mo_class("E. coli") -# [1] "Gammaproteobacteria" - -mo_family("E. coli") -# [1] "Enterobacteriaceae" - -mo_subkingdom("E. coli") -# [1] "Negibacteria" - -mo_gramstain("E. coli") # based on subkingdom -# [1] "Gram negative" - -mo_ref("E. coli") -# [1] "Castellani and Chalmers, 1919" - -# Do not get mistaken - the package only includes microorganisms -mo_phylum("C. elegans") -# [1] "Cyanobacteria" # Bacteria?! -mo_fullname("C. elegans") -# [1] "Chroococcus limneticus elegans" # Because a microorganism was found -# }-
mdro(x, guideline = NULL, col_mo = NULL, info = TRUE, verbose = FALSE, ...) -brmo(..., guideline = "BRMO") +brmo(x, guideline = "BRMO", ...) mrgn(x, guideline = "MRGN", ...) diff --git a/docs/reference/microorganisms.codes.html b/docs/reference/microorganisms.codes.html index 0bc2192b7..541e64c09 100644 --- a/docs/reference/microorganisms.codes.html +++ b/docs/reference/microorganisms.codes.html @@ -80,7 +80,7 @@ @@ -158,13 +158,6 @@ Get properties of an antibiotic
A data.frame
with 67,906 observations and 16 variables:
A data.frame
with 68,260 observations and 16 variables:
mo
ID of microorganism as used by this package
col_id
Catalogue of Life ID
fullname
Full name, like "Escherichia coli"
9 entries of Streptococcus (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)
2 entries of Staphylococcus (coagulase-negative [CoNS] and coagulase-positive [CoPS])
3 entries of Trichomonas (Trichomonas vaginalis, and its family and genus)
3 other 'undefined' entries (unknown, unknown Gram negatives and unknown Gram positives)
8,830 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life
5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)
8,970 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life
A data.frame
with 21,342 observations and 4 variables:
A data.frame
with 21,743 observations and 4 variables:
col_id
Catalogue of Life ID that was originally given
col_id_new
New Catalogue of Life ID that responds to an entry in the microorganisms
data set
fullname
Old full taxonomic name of the microorganism
the statistical model of choice. Defaults to a generalised linear regression model with binomial distribution, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See Details for valid options.
the statistical model of choice. Defaults to a generalised linear regression model with binomial distribution (i.e. using glm(..., family = binomial)
), assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See Details for valid options.
a logical to indicate whether values I
should be treated as S
a logical to indicate whether values I
should be treated as S
(will otherwise be treated as R
)