+
+ Used in over 70 countries
+ Since its first public release in early 2018, this package has been downloaded over 25,000 times from 74 countries (as of November 2019, CRAN logs). Click the map to enlarge.
+
diff --git a/DESCRIPTION b/DESCRIPTION index d9a94b3d..4ff2a0b7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.8.0.9033 -Date: 2019-11-18 +Version: 0.8.0.9034 +Date: 2019-11-23 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index e8825b6b..1c63f884 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 0.8.0.9033 -## Last updated: 18-Nov-2019 +# AMR 0.8.0.9034 +## Last updated: 23-Nov-2019 ### Breaking * Adopted Adeolu *et al.* (2016), [PMID 27620848](https://www.ncbi.nlm.nih.gov/pubmed/27620848) for the `microorganisms` data set, which means that the new order Enterobacterales now consists of a part of the existing family Enterobacteriaceae, but that this family has been split into other families as well (like *Morganellaceae* and *Yersiniaceae*). Although published in 2016, this information is not yet in the Catalogue of Life version of 2019. All MDRO determinations with `mdro()` will now use the Enterobacterales order for all guidelines before 2016 that were dependent on the Enterobacteriaceae family. diff --git a/R/data.R b/R/data.R index f1fbb0a7..c7551b13 100755 --- a/R/data.R +++ b/R/data.R @@ -19,10 +19,11 @@ # Visit our website for more info: https://msberends.gitlab.io/AMR. # # ==================================================================== # -#' Data set with ~450 antibiotics +#' Data sets with ~550 antimicrobials #' -#' A data set containing all antibiotics. Use \code{\link{as.ab}} or one of the \code{\link{ab_property}} functions to retrieve values from this data set. Three identifiers are included in this data set: an antibiotic ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. -#' @format A \code{\link{data.frame}} with 453 observations and 13 variables: +#' Two data sets containing all antibiotics/antimycotics and antivirals. Use \code{\link{as.ab}} or one of the \code{\link{ab_property}} functions to retrieve values from the \code{antibiotics} data set. Three identifiers are included in this data set: an antibiotic ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. +#' @format +#' \strong{For the \code{antibiotics} data set: a \code{\link{data.frame}} with 452 observations and 13 variables:} #' \describe{ #' \item{\code{ab}}{Antibiotic ID as used in this package (like \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available} #' \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like \code{J01CR02}} @@ -38,7 +39,20 @@ #' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} #' \item{\code{iv_units}}{Units of \code{iv_ddd}} #' } -#' @details Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units} +#' +#' \strong{For the \code{antivirals} data set: a \code{\link{data.frame}} with 102 observations and 9 variables:} +#' \describe{ +#' \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC} +#' \item{\code{cid}}{Compound ID as found in PubChem} +#' \item{\code{name}}{Official name as used by WHONET/EARS-Net or the WHO} +#' \item{\code{atc_group}}{Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC} +#' \item{\code{synonyms}}{Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID} +#' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} +#' \item{\code{oral_units}}{Units of \code{oral_ddd}} +#' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} +#' \item{\code{iv_units}}{Units of \code{iv_ddd}} +#' } +#' @details Properties that are based on an ATC code are only available when an ATC is available. These properties are: \code{atc_group1}, \code{atc_group2}, \code{oral_ddd}, \code{oral_units}, \code{iv_ddd} and \code{iv_units}. #' #' Synonyms (i.e. trade names) are derived from the Compound ID (\code{cid}) and consequently only available where a CID is available. #' @source World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://www.whocc.no/atc_ddd_index/} @@ -48,26 +62,10 @@ #' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{http://ec.europa.eu/health/documents/community-register/html/atc.htm} #' @inheritSection WHOCC WHOCC #' @inheritSection AMR Read more on our website! -#' @seealso \code{\link{antivirals}} \code{\link{microorganisms}} +#' @seealso \code{\link{microorganisms}} "antibiotics" -#' Data set with ~100 antivirals -#' -#' A data set containing all antivirals, according to the ATC code group 'J05' (Antivirals for systemic use). -#' @format A \code{\link{data.frame}} with 102 observations and 7 variables: -#' \describe{ -#' \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC} -#' \item{\code{name}}{Official name as used by WHONET/EARS-Net or the WHO} -#' \item{\code{atc_group}}{Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC} -#' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} -#' \item{\code{oral_units}}{Units of \code{oral_ddd}} -#' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} -#' \item{\code{iv_units}}{Units of \code{iv_ddd}} -#' } -#' @source World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://www.whocc.no/atc_ddd_index/} -#' @inheritSection WHOCC WHOCC -#' @inheritSection AMR Read more on our website! -#' @seealso \code{\link{antibiotics}} \code{\link{microorganisms}} +#' @rdname antibiotics "antivirals" #' Data set with ~70,000 microorganisms diff --git a/R/misc.R b/R/misc.R index cfa1e8d6..37ae8870 100755 --- a/R/misc.R +++ b/R/misc.R @@ -29,6 +29,14 @@ addin_insert_like <- function() { rstudioapi::insertText(" %like% ") } +load_AMR_package <- function() { + if (!"package:AMR" %in% base::search()) { + require(AMR) + # check onLoad() in R/zzz.R: data tables are created there. + } + base::invisible() +} + #' @importFrom crayon blue bold red #' @importFrom dplyr %>% pull search_type_in_df <- function(x, type) { diff --git a/R/mo.R b/R/mo.R index 6e5eb645..b310c0c0 100755 --- a/R/mo.R +++ b/R/mo.R @@ -183,11 +183,14 @@ #' df <- df %>% #' mutate(mo = as.mo(paste(genus, species))) #' } -as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE, reference_df = get_mo_source(), ...) { - if (!"AMR" %in% base::.packages()) { - require("AMR") - # check onLoad() in R/zzz.R: data tables are created there. - } +as.mo <- function(x, + Becker = FALSE, + Lancefield = FALSE, + allow_uncertain = TRUE, + reference_df = get_mo_source(), + ...) { + + load_AMR_package() # WHONET: xxx = no growth x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_ @@ -293,10 +296,7 @@ exec_as.mo <- function(x, debug = FALSE, reference_data_to_use = microorganismsDT) { - if (!"AMR" %in% base::.packages()) { - require("AMR") - # check onLoad() in R/zzz.R: data tables are created there. - } + load_AMR_package() # WHONET: xxx = no growth x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_ diff --git a/R/mo_property.R b/R/mo_property.R index eb9083b2..7f5cabf3 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -396,6 +396,8 @@ mo_property <- function(x, property = "fullname", language = get_locale(), ...) } mo_validate <- function(x, property, ...) { + + load_AMR_package() dots <- list(...) Becker <- dots$Becker @@ -407,11 +409,6 @@ mo_validate <- function(x, property, ...) { Lancefield <- FALSE } - if (!"AMR" %in% base::.packages()) { - require("AMR") - # check .onLoad() in R/zzz.R: data tables are created there. - } - # try to catch an error when inputting an invalid parameter # so the 'call.' can be set to FALSE tryCatch(x[1L] %in% AMR::microorganisms[1, property], diff --git a/_pkgdown.yml b/_pkgdown.yml index f74f913b..0e1359b0 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -155,14 +155,10 @@ reference: 'like' function can be useful: `if (x %like% y) {...}`. contents: - "`get_locale`" - - "`like`" - - title: Extended functions - desc: > - These functions are extensions of functions in other packages. - contents: - "`extended-functions`" + - "`like`" - "`reexports`" - - title: functions + - title: Deprecated functions desc: > These functions are deprecated, meaning that they will still work but show a warning with every use and will be removed diff --git a/data-raw/reproduction_of_antivirals.R b/data-raw/reproduction_of_antivirals.R index 6f781161..230c24c1 100644 --- a/data-raw/reproduction_of_antivirals.R +++ b/data-raw/reproduction_of_antivirals.R @@ -57,6 +57,33 @@ for (i in 2:length(atc_groups)) { antivirals <- rbind(antivirals, get_atc_table(atc_groups[i])) } -# arrange on name, untibble it and save +# arrange on name, untibble it antivirals <- antivirals %>% arrange(name) %>% as.data.frame(stringsAsFactors = FALSE) + +# add PubChem Compound ID (cid) and their trade names - functions are in file to create `antibiotics` data set +CIDs <- get_CID(antivirals$name) +# these could not be found: +antivirals[is.na(CIDs),] %>% View() +# get brand names from PubChem +synonyms <- get_synonyms(CIDs) +synonyms <- lapply(synonyms, + function(x) { + if (length(x) == 0 | all(is.na(x))) { + "" + } else { + x + }}) + +antivirals <- antivirals %>% + transmute(atc, + cid = CIDs, + name, + atc_group, + synonyms = unname(synonyms), + oral_ddd, + oral_units, + iv_ddd, + iv_units) + +# save it usethis::use_data(antivirals, overwrite = TRUE) diff --git a/data/antivirals.rda b/data/antivirals.rda index 8217fe01..8cda4848 100644 Binary files a/data/antivirals.rda and b/data/antivirals.rda differ diff --git a/docs/404.html b/docs/404.html index ae0ed72b..c62e2344 100644 --- a/docs/404.html +++ b/docs/404.html @@ -84,7 +84,7 @@
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 1f557fd1..a8ddb657 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -84,7 +84,7 @@ diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 9e658236..897c734e 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -41,7 +41,7 @@ @@ -187,7 +187,7 @@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 18 November 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 23 November 2019.
Now, let’s start the cleaning and the analysis!
@@ -406,8 +406,8 @@ # # Item Count Percent Cum. Count Cum. Percent # --- ----- ------- -------- ----------- ------------- -# 1 M 10,413 52.06% 10,413 52.06% -# 2 F 9,587 47.94% 20,000 100.00% +# 1 M 10,451 52.26% 10,451 52.26% +# 2 F 9,549 47.75% 20,000 100.00%So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values M
and F
. From a researchers perspective: there are slightly more men. Nothing we didn’t already know.
The data is already quite clean, but we still need to transform some variables. The bacteria
column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The mutate()
function of the dplyr
package makes this really easy:
data <- data %>%
@@ -422,8 +422,8 @@
# Other rules by this AMR package
# Non-EUCAST: inherit amoxicillin results for unavailable ampicillin (no changes)
# Non-EUCAST: inherit ampicillin results for unavailable amoxicillin (no changes)
-# Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (2,986 values changed)
-# Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (176 values changed)
+# Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (2,952 values changed)
+# Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (155 values changed)
# Non-EUCAST: set piperacillin = R where piperacillin/tazobactam = R (no changes)
# Non-EUCAST: set piperacillin/tazobactam = S where piperacillin = S (no changes)
# Non-EUCAST: set trimethoprim = R where trimethoprim/sulfa = R (no changes)
@@ -448,14 +448,14 @@
# Pasteurella multocida (no changes)
# Staphylococcus (no changes)
# Streptococcus groups A, B, C, G (no changes)
-# Streptococcus pneumoniae (1,015 values changed)
+# Streptococcus pneumoniae (984 values changed)
# Viridans group streptococci (no changes)
#
# EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 01: Intrinsic resistance in Enterobacteriaceae (1,284 values changed)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1,309 values changed)
# Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)
# Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)
-# Table 04: Intrinsic resistance in Gram-positive bacteria (2,796 values changed)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2,719 values changed)
# Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)
# Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)
# Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)
@@ -463,15 +463,15 @@
# Table 13: Interpretive rules for quinolones (no changes)
#
# --------------------------------------------------------------------------
-# EUCAST rules affected 6,569 out of 20,000 rows, making a total of 8,257 edits
+# EUCAST rules affected 6,464 out of 20,000 rows, making a total of 8,119 edits
# => added 0 test results
#
-# => changed 8,257 test results
-# - 123 test results changed from S to I
-# - 4,779 test results changed from S to R
-# - 1,134 test results changed from I to S
-# - 369 test results changed from I to R
-# - 1,852 test results changed from R to S
+# => changed 8,119 test results
+# - 109 test results changed from S to I
+# - 4,710 test results changed from S to R
+# - 1,166 test results changed from I to S
+# - 348 test results changed from I to R
+# - 1,786 test results changed from R to S
# --------------------------------------------------------------------------
#
# Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.
So only 28.5% is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
So only 28.3% is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
For future use, the above two syntaxes can be shortened with the filter_first_isolate()
function:
We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient X7, sorted on date:
+We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient T6, sorted on date:
isolate | @@ -526,19 +526,19 @@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | -2010-03-18 | -X7 | +2010-02-28 | +T6 | B_ESCHR_COLI | S | S | S | -S | +R | TRUE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | -2010-04-28 | -X7 | +2010-03-01 | +T6 | B_ESCHR_COLI | S | S | @@ -548,32 +548,32 @@|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 | -2010-06-26 | -X7 | +2010-05-20 | +T6 | B_ESCHR_COLI | +S | +S | R | S | -S | -S | FALSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | -2010-08-06 | -X7 | +2010-06-21 | +T6 | B_ESCHR_COLI | S | S | -S | -S | +R | +R | FALSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 | -2010-08-31 | -X7 | +2010-09-24 | +T6 | B_ESCHR_COLI | -S | +R | S | S | S | @@ -581,19 +581,19 @@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6 | -2010-10-15 | -X7 | +2010-11-18 | +T6 | B_ESCHR_COLI | R | S | S | -S | +R | FALSE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
7 | -2010-11-19 | -X7 | +2011-02-07 | +T6 | B_ESCHR_COLI | R | S | @@ -603,30 +603,30 @@|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8 | -2011-01-20 | -X7 | +2011-03-09 | +T6 | B_ESCHR_COLI | S | S | +R | +S | +TRUE | +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
9 | +2011-03-23 | +T6 | +B_ESCHR_COLI | +R | +S | S | S | FALSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
9 | -2011-04-10 | -X7 | -B_ESCHR_COLI | -S | -S | -S | -S | -TRUE | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
10 | -2011-04-12 | -X7 | +2011-04-01 | +T6 | B_ESCHR_COLI | S | S | @@ -647,7 +647,7 @@ # NOTE: Using column `patient_id` as input for `col_patient_id`. # NOTE: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this. # [Criterion] Inclusion based on key antibiotics, ignoring I -# => Found 15,085 first weighted isolates (75.4% of total) +# => Found 15,096 first weighted isolates (75.5% of total)
isolate | @@ -664,68 +664,56 @@|||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | -2010-03-18 | -X7 | +2010-02-28 | +T6 | B_ESCHR_COLI | S | S | S | -S | +R | TRUE | TRUE | |
2 | -2010-04-28 | -X7 | +2010-03-01 | +T6 | B_ESCHR_COLI | S | S | S | S | FALSE | -FALSE | +TRUE | |
3 | -2010-06-26 | -X7 | +2010-05-20 | +T6 | B_ESCHR_COLI | +S | +S | R | S | -S | -S | FALSE | TRUE |
4 | -2010-08-06 | -X7 | +2010-06-21 | +T6 | B_ESCHR_COLI | S | S | -S | -S | +R | +R | FALSE | TRUE |
5 | -2010-08-31 | -X7 | -B_ESCHR_COLI | -S | -S | -S | -S | -FALSE | -FALSE | -||||
6 | -2010-10-15 | -X7 | +2010-09-24 | +T6 | B_ESCHR_COLI | R | S | @@ -734,61 +722,73 @@FALSE | TRUE | ||||
6 | +2010-11-18 | +T6 | +B_ESCHR_COLI | +R | +S | +S | +R | +FALSE | +TRUE | +||||
7 | -2010-11-19 | -X7 | +2011-02-07 | +T6 | B_ESCHR_COLI | R | S | S | S | FALSE | -FALSE | +TRUE | |
8 | -2011-01-20 | -X7 | +2011-03-09 | +T6 | B_ESCHR_COLI | S | S | +R | S | -S | -FALSE | +TRUE | TRUE |
9 | -2011-04-10 | -X7 | +2011-03-23 | +T6 | B_ESCHR_COLI | +R | S | S | S | -S | -TRUE | +FALSE | TRUE |
10 | -2011-04-12 | -X7 | +2011-04-01 | +T6 | B_ESCHR_COLI | S | S | S | S | FALSE | -FALSE | +TRUE |
Instead of 2, now 6 isolates are flagged. In total, 75.4% of all isolates are marked ‘first weighted’ - 46.9% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
+Instead of 2, now 10 isolates are flagged. In total, 75.5% of all isolates are marked ‘first weighted’ - 47.1% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
As with filter_first_isolate()
, there’s a shortcut for this new algorithm too:
So we end up with 15,085 isolates for analysis.
+So we end up with 15,096 isolates for analysis.
We can remove unneeded columns:
@@ -814,44 +814,12 @@Time for the analysis!
@@ -927,7 +927,7 @@Frequency table
Class: character
-Length: 15,085 (of which NA: 0 = 0%)
+Length: 15,096 (of which NA: 0 = 0%)
Unique: 4
Shortest: 16
Longest: 24
The functions resistance()
and susceptibility()
can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions proportion_S()
, proportion_SI()
, proportion_I()
, proportion_IR()
and proportion_R()
can be used to determine the proportion of a specific antimicrobial outcome.
As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (proportion_R()
, equal to resistance()
) and susceptibility as the proportion of S and I (proportion_SI()
, equal to susceptibility()
). These functions can be used on their own:
Or can be used in conjuction with group_by()
and summarise()
, both from the dplyr
package:
data_1st %>%
group_by(hospital) %>%
@@ -995,19 +995,19 @@ Longest: 24
Hospital A
-0.4666964
+0.4740061
Hospital B
-0.4711845
+0.4707669
Hospital C
-0.4627451
+0.4640934
Hospital D
-0.4704102
+0.4622766
@@ -1025,23 +1025,23 @@ Longest: 24
Hospital A
-0.4666964
-4489
+0.4740061
+4578
Hospital B
-0.4711845
-5327
+0.4707669
+5268
Hospital C
-0.4627451
-2295
+0.4640934
+2228
Hospital D
-0.4704102
-2974
+0.4622766
+3022
@@ -1061,27 +1061,27 @@ Longest: 24
Escherichia
-0.9243200
-0.8955023
-0.9934016
+0.9193042
+0.8966780
+0.9935914
Klebsiella
-0.9174194
-0.9019355
-0.9967742
+0.9285246
+0.8878689
+0.9940984
Staphylococcus
-0.9193420
-0.9211993
-0.9936323
+0.9166205
+0.9171745
+0.9919668
Streptococcus
-0.6128205
+0.6241901
0.0000000
-0.6128205
+0.6241901
diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png
index 157e8a6b..32ddf375 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png
index 81c7a283..146d8308 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png
index 6191bf74..462c348c 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png
index 39b50936..1c8dcc0b 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ
diff --git a/docs/articles/MDR.html b/docs/articles/MDR.html
index 1620590b..cf19b982 100644
--- a/docs/articles/MDR.html
+++ b/docs/articles/MDR.html
@@ -41,7 +41,7 @@
MDR.Rmd
The data set now looks like this:
head(my_TB_data)
# rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1 S R S S S S
-# 2 S S S S R S
-# 3 S R R S S R
-# 4 S R S S I S
-# 5 R S S I R S
-# 6 R R S S R R
+# 1 S R I S I S
+# 2 S I S S R R
+# 3 R I R R R I
+# 4 S S S R R R
+# 5 I S R S R I
+# 6 R S R R S R
# kanamycin
-# 1 R
-# 2 R
-# 3 R
-# 4 S
+# 1 S
+# 2 S
+# 3 S
+# 4 R
# 5 S
-# 6 S
We can now add the interpretation of MDR-TB to our data set. You can use:
or its shortcut mdr_tb()
:
Create a frequency table of the results:
Frequency table
@@ -357,40 +357,40 @@ Unique: 5AMR
(for R)?AMR
is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 25,000 times from more than 70 countries (source: CRAN logs, 2019).
After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.
+AMR
is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.
We created this package for both routine analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is actively maintained and is free software (see Copyright).
-Used to SPSS? Read our tutorial on how to import data from SPSS, SAS or Stata.
+
+
+ Used in over 70 countries
+ Since its first public release in early 2018, this package has been downloaded over 25,000 times from 74 countries (as of November 2019, CRAN logs). Click the map to enlarge.
as.mo(..., allow_uncertain = 3)
Contents
antibiotics.Rd
A data set containing all antibiotics. Use as.ab
or one of the ab_property
functions to retrieve values from this data set. Three identifiers are included in this data set: an antibiotic 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.
Two data sets containing all antibiotics/antimycotics and antivirals. Use as.ab
or one of the ab_property
functions to retrieve values from the antibiotics
data set. Three identifiers are included in this data set: an antibiotic 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.
antibiotics
+ antibiotics + +antivirals
A data.frame
with 453 observations and 13 variables:
For the antibiotics
data set: a data.frame
with 452 observations and 13 variables:
ab
Antibiotic ID as used in this package (like AMC
), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
atc
ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like J01CR02
cid
Compound ID as found in PubChem
iv_ddd
Defined Daily Dose (DDD), parenteral treatment
iv_units
Units of iv_ddd
For the antivirals
data set: a data.frame
with 102 observations and 9 variables:
atc
ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC
cid
Compound ID as found in PubChem
name
Official name as used by WHONET/EARS-Net or the WHO
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
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: http://ec.europa.eu/health/documents/community-register/html/atc.htm
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
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
.
Synonyms (i.e. trade names) are derived from the Compound ID (cid
) and consequently only available where a CID is available.
On our website https://msberends.gitlab.io/AMR you can find a 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.
antivirals
microorganisms
Data set with ~450 antibiotics
Data set with ~100 antivirals
Data sets with ~550 antimicrobials
Translate strings from AMR package
Pattern Matching
These functions are extensions of functions in other packages.
-Extended functions
Pattern Matching
These functions are deprecated, meaning that they will still work but show a warning with every use and will be removed in a future version.
+
+ Used in over 70 countries
+ Since its first public release in early 2018, this package has been downloaded over 25,000 times from 74 countries (as of November 2019, CRAN logs). Click the map to enlarge.