diff --git a/DESCRIPTION b/DESCRIPTION index be64ce6f..09bbd02f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.8.1.9013 -Date: 2022-06-10 +Version: 1.8.1.9014 +Date: 2022-08-12 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by @@ -90,5 +90,5 @@ BugReports: https://github.com/msberends/AMR/issues License: GPL-2 | file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.0 +RoxygenNote: 7.2.1 Roxygen: list(markdown = TRUE) diff --git a/NEWS.md b/NEWS.md index a638fee8..aaff4727 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# `AMR` 1.8.1.9013 -## Last updated: 10 June 2022 +# `AMR` 1.8.1.9014 +## Last updated: 12 August 2022 ### New * EUCAST 2022 and CLSI 2022 guidelines have been added for `as.rsi()`. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations. diff --git a/R/sysdata.rda b/R/sysdata.rda index 7c70bf86..89a94bc9 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index 298dca17..99e90ba0 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/data/microorganisms.rda b/data/microorganisms.rda index 86e741bf..6a9e2f1b 100644 Binary files a/data/microorganisms.rda and b/data/microorganisms.rda differ diff --git a/docs/404.html b/docs/404.html index abdbb5dd..0cd5bb7c 100644 --- a/docs/404.html +++ b/docs/404.html @@ -43,7 +43,7 @@ AMR (for R) - 1.8.1.9013 + 1.8.1.9014 @@ -210,7 +210,7 @@ Content not found. Please use links in the navbar.

-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.6.

diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 3ada8c72..62cbd6ba 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9013 + 1.8.1.9014 @@ -420,7 +420,7 @@ END OF TERMS AND CONDITIONS
-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.6.

diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index cf6a09c1..e57c7b72 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -44,7 +44,7 @@ AMR (for R) - 1.8.1.9013 + 1.8.1.9014 @@ -190,7 +190,7 @@ @@ -273,7 +273,7 @@ Antimicrobial Resistance Data. Journal of Statistical Software (accepted for pub
-

Site built with pkgdown 2.0.3.

+

Site built with pkgdown 2.0.6.

diff --git a/docs/index.html b/docs/index.html index 06e6834b..484adc4b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -47,7 +47,7 @@ AMR (for R) - 1.8.1.9013 + 1.8.1.9014 @@ -214,17 +214,17 @@
With AMR (for R), there’s always a knowledgeable microbiologist by your side!
-# AMR works great with dplyr, but it's not required or neccesary
-library(AMR)
-library(dplyr)
-
-example_isolates %>%
-  mutate(bacteria = mo_fullname()) %>%
-  filter(mo_is_gram_negative(),
-         mo_is_intrinsic_resistant(ab = "cefotax")) %>%
-  select(bacteria,
-         aminoglycosides(),
-         carbapenems())
+# AMR works great with dplyr, but it's not required or neccesary +library(AMR) +library(dplyr) + +example_isolates %>% + mutate(bacteria = mo_fullname()) %>% + filter(mo_is_gram_negative(), + mo_is_intrinsic_resistant(ab = "cefotax")) %>% + select(bacteria, + aminoglycosides(), + carbapenems())

With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (mo_is_gram_negative() and mo_is_intrinsic_resistant()) and a column selection on two antibiotic groups (aminoglycosides() and carbapenems()), the reference data about all microorganisms and all antibiotics in the AMR package make sure you get what you meant:

@@ -331,10 +331,10 @@

A base R equivalent would be, giving the exact same results:

-example_isolates$bacteria <- mo_fullname(example_isolates$mo)
-example_isolates[which(mo_is_gram_negative() &
-                         mo_is_intrinsic_resistant(ab = "cefotax")),
-                 c("bacteria", aminoglycosides(), carbapenems())]
+example_isolates$bacteria <- mo_fullname(example_isolates$mo) +example_isolates[which(mo_is_gram_negative() & + mo_is_intrinsic_resistant(ab = "cefotax")), + c("bacteria", aminoglycosides(), carbapenems())]

Partners @@ -377,7 +377,7 @@

CRAN CRANlogs

This package is available here on the official R network (CRAN). Install this package in R from CRAN by using the command:

+install.packages("AMR")

It will be downloaded and installed automatically. For RStudio, click on the menu Tools > Install Packages… and then type in “AMR” and press Install.

Note: Not all functions on this website may be available in this latest release. To use all functions and data sets mentioned on this website, install the latest development version.

@@ -390,14 +390,14 @@
  • Manually, using:

    -install.packages("remotes") # if you haven't already
    -remotes::install_github("msberends/AMR")
    +install.packages("remotes") # if you haven't already +remotes::install_github("msberends/AMR")
  • Automatically, using the rOpenSci R-universe platform, by adding our R-universe address to your list of repositories (‘repos’):

    -options(repos = c(getOption("repos"),
    -                  msberends = "https://msberends.r-universe.dev"))
    +options(repos = c(getOption("repos"), + msberends = "https://msberends.r-universe.dev"))

    After this, you can install and update this AMR package like any official release (e.g., using install.packages("AMR") or in RStudio via Tools > Check for Package Updates…).

  • @@ -562,7 +562,7 @@

    -

    Site built with pkgdown 2.0.3.

    +

    Site built with pkgdown 2.0.6.

    diff --git a/docs/news/index.html b/docs/news/index.html index 2b723f9a..27acd1be 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ AMR (for R) - 1.8.1.9013 + 1.8.1.9014 @@ -157,16 +157,16 @@
    - +
    -

    Last updated: 10 June 2022

    +

    Last updated: 12 August 2022

    -

    New

    +

    New

    • EUCAST 2022 and CLSI 2022 guidelines have been added for as.rsi(). EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.
    -

    Changed

    +

    Changed

    • Fix for as.rsi() on certain EUCAST breakpoints for MIC values
    • Removed as.integer() for MIC values, since MIC are not integer values and running table() on MIC values consequently failed for not being able to retrieve the level position (as that’s how normally as.integer() on factors work)
    • @@ -192,9 +192,9 @@
    • Improved algorithm of as.mo(), especially for ignoring non-taxonomic text, such as:

      -
      -mo_name("methicillin-resistant S. aureus (MRSA)")
      -#> [1] "Staphylococcus aureus"
      + +mo_name("methicillin-resistant S. aureus (MRSA)") +#> [1] "Staphylococcus aureus"
  • More informative warning messages

  • Added 192 as valid MIC

  • @@ -226,9 +226,9 @@
  • 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:

    -
    -example_isolates %>% set_ab_names(where(is.rsi))
    -example_isolates %>% set_ab_names(AMC:GEN, property = "atc")
    + +example_isolates %>% set_ab_names(where(is.rsi)) +example_isolates %>% set_ab_names(AMC:GEN, property = "atc")
  • Function mo_lpsn() to retrieve the LPSN record ID

  • Function ab_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 output

  • @@ -252,16 +252,16 @@
  • Added specific selectors for certain types for treatment: 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
    + +example_isolates[, penicillins() & administrable_per_os()] # base R +example_isolates %>% select(penicillins() & administrable_per_os()) # dplyr
  • Added the selector 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
    + +example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")] # base R +example_isolates %>% select(ab_selector(oral_ddd > 1 & oral_units == "g")) # dplyr
  • 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.

  • 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)

  • @@ -317,21 +317,21 @@
    @@ -372,10 +372,10 @@
  • Added %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") ...
    + +if (!grepl("EUCAST", guideline)) ... +# same: +if (guideline %unlike% "EUCAST") ...
  • Altered the RStudio addin, so it now iterates over %like% -> %unlike% -> %like_case% -> %unlike_case% if you keep pressing your keyboard shortcut

  • @@ -425,53 +425,53 @@
  • Functions oxazolidinones() (an antibiotic selector function) and filter_oxazolidinones() (an antibiotic filter function) to select/filter on e.g. linezolid and tedizolid

    -
    -library(dplyr)
    -x <- example_isolates %>% select(date, hospital_id, oxazolidinones())
    -#> Selecting oxazolidinones: column 'LNZ' (linezolid)
    -
    -x <- example_isolates %>% filter_oxazolidinones()
    -#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"
    + +library(dplyr) +x <- example_isolates %>% select(date, hospital_id, oxazolidinones()) +#> Selecting oxazolidinones: column 'LNZ' (linezolid) + +x <- example_isolates %>% filter_oxazolidinones() +#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"
  • 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>

  • Function mo_is_yeast(), which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:

    -
    -mo_kingdom(c("Aspergillus", "Candida"))
    -#> [1] "Fungi" "Fungi"
    -
    -mo_is_yeast(c("Aspergillus", "Candida"))
    -#> [1] FALSE  TRUE
    -
    -# usage for filtering data:
    -example_isolates[which(mo_is_yeast()), ]   # base R
    -example_isolates %>% filter(mo_is_yeast()) # dplyr
    + +mo_kingdom(c("Aspergillus", "Candida")) +#> [1] "Fungi" "Fungi" + +mo_is_yeast(c("Aspergillus", "Candida")) +#> [1] FALSE TRUE + +# usage for filtering data: +example_isolates[which(mo_is_yeast()), ] # base R +example_isolates %>% filter(mo_is_yeast()) # dplyr

    The mo_type() function has also been updated to reflect this change:

    -
    -mo_type(c("Aspergillus", "Candida"))
    -# [1] "Fungi"  "Yeasts"
    -mo_type(c("Aspergillus", "Candida"), language = "es") # also supported: de, nl, fr, it, pt
    -#> [1] "Hongos"    "Levaduras"
    + +mo_type(c("Aspergillus", "Candida")) +# [1] "Fungi" "Yeasts" +mo_type(c("Aspergillus", "Candida"), language = "es") # also supported: de, nl, fr, it, pt +#> [1] "Hongos" "Levaduras"
  • Added Pretomanid (PMD, J04AK08) to the antibiotics data set

  • MIC values (see as.mic()) can now be used in any mathematical processing, such as usage inside functions min(), max(), range(), and with binary operators (+, -, etc.). This allows for easy distribution analysis and fast filtering on MIC values:

    -
    -x <- random_mic(10)
    -x
    -#> Class <mic>
    -#>  [1] 128   0.5   2     0.125 64    0.25  >=256 8     16    4
    -x[x > 4]
    -#> Class <mic>
    -#> [1] 128   64    >=256 8     16
    -range(x)
    -#> [1]   0.125 256.000
    -range(log2(x))
    -#> [1] -3  8
    + +x <- random_mic(10) +x +#> Class <mic> +#> [1] 128 0.5 2 0.125 64 0.25 >=256 8 16 4 +x[x > 4] +#> Class <mic> +#> [1] 128 64 >=256 8 16 +range(x) +#> [1] 0.125 256.000 +range(log2(x)) +#> [1] -3 8
  • @@ -529,11 +529,11 @@
  • Functions mo_is_gram_negative() and mo_is_gram_positive() as wrappers around mo_gramstain(). They always return TRUE or FALSE (except when the input is NA or the MO code is UNKNOWN), thus always return FALSE for species outside the taxonomic kingdom of Bacteria.

  • Function mo_is_intrinsic_resistant() to test for intrinsic resistance, based on EUCAST Intrinsic Resistance and Unusual Phenotypes v3.2 from 2020.

  • @@ -574,22 +574,22 @@ mdr_cmi2012(),
  • eucast_exceptional_phenotypes()
  • -
    -# to select first isolates that are Gram-negative 
    -# and view results of cephalosporins and aminoglycosides:
    -library(dplyr)
    -example_isolates %>%
    -  filter(first_isolate(), mo_is_gram_negative()) %>% 
    -  select(mo, cephalosporins(), aminoglycosides()) %>% 
    -  as_tibble()
    + +# to select first isolates that are Gram-negative +# and view results of cephalosporins and aminoglycosides: +library(dplyr) +example_isolates %>% + filter(first_isolate(), mo_is_gram_negative()) %>% + select(mo, cephalosporins(), aminoglycosides()) %>% + as_tibble()
  • For antibiotic selection functions (such as cephalosporins(), aminoglycosides()) to select columns based on a certain antibiotic group, the dependency on the tidyselect package was removed, meaning that they can now also be used without the need to have this package installed and now also work in base R function calls (they rely on R 3.2 or later):

    -
    -# above example in base R:
    -example_isolates[which(first_isolate() & mo_is_gram_negative()),
    -                 c("mo", cephalosporins(), aminoglycosides())]
    + +# above example in base R: +example_isolates[which(first_isolate() & mo_is_gram_negative()), + c("mo", cephalosporins(), aminoglycosides())]
  • For all function arguments in the code, it is now defined what the exact type of user input should be (inspired by the typed package). If the user input for a certain function does not meet the requirements for a specific argument (such as the class or length), an informative error will be thrown. This makes the package more robust and the use of it more reproducible and reliable. In total, more than 420 arguments were defined.

  • Fix for set_mo_source(), that previously would not remember the file location of the original file

  • @@ -629,13 +629,13 @@

    Data set intrinsic_resistant. This data set contains all bug-drug combinations where the ‘bug’ is intrinsic resistant to the ‘drug’ according to the latest EUCAST insights. It contains just two columns: microorganism and antibiotic.

    Curious about which enterococci are actually intrinsic resistant to vancomycin?

    -
    -library(AMR)
    -library(dplyr)
    -intrinsic_resistant %>%
    -  filter(antibiotic == "Vancomycin", microorganism %like% "Enterococcus") %>% 
    -  pull(microorganism)
    -#> [1] "Enterococcus casseliflavus" "Enterococcus gallinarum"   
    + +library(AMR) +library(dplyr) +intrinsic_resistant %>% + filter(antibiotic == "Vancomycin", microorganism %like% "Enterococcus") %>% + pull(microorganism) +#> [1] "Enterococcus casseliflavus" "Enterococcus gallinarum"
  • Support for veterinary ATC codes

  • Support for skimming classes <rsi>, <mic>, <disk> and <mo> with the skimr package

  • @@ -648,14 +648,14 @@ @@ -937,12 +937,12 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ @@ -951,13 +951,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • Removed previously deprecated function as.atc() - this function was replaced by ab_atc() @@ -1022,25 +1022,25 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/

    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"
  • Function 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 microorganism

  • Function mo_synonyms() to get all previously accepted taxonomic names of a microorganism

  • @@ -1279,15 +1279,15 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • support for boxplots:

    -
    -septic_patients %>% 
    -  freq(age) %>% 
    -  boxplot()
    -# grouped boxplots:
    -septic_patients %>% 
    -  group_by(hospital_id) %>% 
    -  freq(age) %>%
    -  boxplot()
    + +septic_patients %>% + freq(age) %>% + boxplot() +# grouped boxplots: +septic_patients %>% + group_by(hospital_id) %>% + freq(age) %>% + boxplot()
  • Removed all hardcoded EUCAST rules and replaced them with a new reference file which can be viewed here @@ -1354,37 +1354,37 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • New 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:

    -
    -septic_patients %>% filter_glycopeptides(result = "R")
    -# Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R
    -septic_patients %>% filter_glycopeptides(result = "R", scope = "all")
    -# Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R
    + +septic_patients %>% filter_glycopeptides(result = "R") +# Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R +septic_patients %>% filter_glycopeptides(result = "R", scope = "all") +# Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R
  • 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()
    + +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()

    These functions use 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.

  • New functions set_mo_source() and get_mo_source() to use your own predefined MO codes as input for as.mo() and consequently all mo_* functions

  • @@ -1398,25 +1398,25 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • New function ggplot_rsi_predict() as well as the base R plot() function can now be used for resistance prediction calculated with resistance_predict():

    -
    -x <- resistance_predict(septic_patients, col_ab = "amox")
    -plot(x)
    -ggplot_rsi_predict(x)
    + +x <- resistance_predict(septic_patients, col_ab = "amox") +plot(x) +ggplot_rsi_predict(x)
  • Functions filter_first_isolate() and filter_first_weighted_isolate() to shorten and fasten filtering on data sets with antimicrobial results, e.g.:

    -
    -septic_patients %>% filter_first_isolate(...)
    -# or
    -filter_first_isolate(septic_patients, ...)
    + +septic_patients %>% filter_first_isolate(...) +# or +filter_first_isolate(septic_patients, ...)

    is equal to:

    -
    -septic_patients %>%
    -  mutate(only_firsts = first_isolate(septic_patients, ...)) %>%
    -  filter(only_firsts == TRUE) %>%
    -  select(-only_firsts)
    + +septic_patients %>% + mutate(only_firsts = first_isolate(septic_patients, ...)) %>% + filter(only_firsts == TRUE) %>% + select(-only_firsts)
  • New function availability() to check the number of available (non-empty) results in a data.frame

  • New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the G-test and more. These are also available (and even easier readable) on our website: https://msberends.gitlab.io/AMR.

  • @@ -1439,26 +1439,26 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/