diff --git a/DESCRIPTION b/DESCRIPTION index 9f7891fd..1f54d386 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.4.0.9032 -Date: 2020-12-07 +Version: 1.4.0.9033 +Date: 2020-12-08 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index a999e024..d646153a 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 1.4.0.9032 -## Last updated: 7 December 2020 +# AMR 1.4.0.9033 +## Last updated: 8 December 2020 ### New * Function `is_new_episode()` to determine patient episodes which are not necessarily based on microorganisms. It also supports grouped variables with e.g. `mutate()`, `filter()` and `summarise()` of the `dplyr` package: diff --git a/R/ab_class_selectors.R b/R/ab_class_selectors.R index 0f932122..376e3a6d 100644 --- a/R/ab_class_selectors.R +++ b/R/ab_class_selectors.R @@ -25,11 +25,11 @@ #' Antibiotic class selectors #' -#' Use these selection helpers inside any function that allows [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html), like `dplyr::select()` or `tidyr::pivot_longer()`. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. +#' Use these selection helpers inside any function that allows [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html), such as [`select()`][dplyr::select()] and [`pivot_longer()`][tidyr::pivot_longer()]. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. #' @inheritParams filter_ab_class #' @details All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector like e.g. [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. #' -#' **N.B. These functions only work if the `tidyselect` package is installed**, that comes with the `dplyr` package. An error will be thrown if the `tidyselect` package is not installed, or if the functions are used outside a function that allows Tidyverse selections like `select()` or `pivot_longer()`. +#' **N.B. These functions require the `tidyselect` package to be installed**, that comes with the `dplyr` package. An error will be thrown if the `tidyselect` package is not installed, or if the functions are used outside a function that allows [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html) such as [`select()`][dplyr::select()] and [`pivot_longer()`][tidyr::pivot_longer()]`. #' @rdname antibiotic_class_selectors #' @seealso [filter_ab_class()] for the `filter()` equivalent. #' @name antibiotic_class_selectors diff --git a/R/catalogue_of_life.R b/R/catalogue_of_life.R index 525b4001..1d9f302e 100755 --- a/R/catalogue_of_life.R +++ b/R/catalogue_of_life.R @@ -23,20 +23,36 @@ # how to conduct AMR analysis: https://msberends.github.io/AMR/ # # ==================================================================== # +format_included_data_number <- function(data) { + if (is.data.frame(data)) { + n <- nrow(data) + } else { + n <- length(unique(data)) + } + if (n > 10000) { + rounder <- -3 # round on thousands + } else if (n > 1000) { + rounder <- -2 # round on hundreds + } else { + rounder <- -1 # round on tens + } + paste0("~", format(round(n, rounder), decimal.mark = ".", big.mark = ",")) +} + #' The Catalogue of Life #' #' This package contains the complete taxonomic tree of almost all microorganisms from the authoritative and comprehensive Catalogue of Life. #' @section Catalogue of Life: #' \if{html}{\figure{logo_col.png}{options: height=40px style=margin-bottom:5px} \cr} -#' This package contains the complete taxonomic tree of almost all microorganisms (~70,000 species) from the authoritative and comprehensive Catalogue of Life (). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available. +#' This package contains the complete taxonomic tree of almost all microorganisms (~70,000 species) from the authoritative and comprehensive Catalogue of Life (CoL, ). The CoL is the most comprehensive and authoritative global index of species currently available. Nonetheless, we supplemented the CoL data with data from the List of Prokaryotic names with Standing in Nomenclature (LPSN, [lpsn.dsmz.de](https://lpsn.dsmz.de)). This supplementation is needed until the [CoL+ project](https://github.com/Sp2000/colplus) is finished, which we await. #' -#' [Click here][catalogue_of_life] for more information about the included taxa. Check which version of the Catalogue of Life was included in this package with [catalogue_of_life_version()]. +#' [Click here][catalogue_of_life] for more information about the included taxa. Check which versions of the CoL and LSPN were included in this package with [catalogue_of_life_version()]. #' @section Included taxa: #' Included are: -#' - All ~61,000 (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa -#' - All ~8,500 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of *Aspergillus*, *Candida*, *Cryptococcus*, *Histplasma*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*). -#' - All ~150 (sub)species from ~100 other relevant genera from the kingdom of Animalia (like *Strongyloides* and *Taenia*) -#' - All ~23,000 previously accepted names of all included (sub)species (these were taxonomically renamed) +#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom %in% c("Archeae", "Bacteria", "Chromista", "Protozoa")), ])` (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa +#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), ])` (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & !microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), ])` other fungal (sub)species. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of *Aspergillus*, *Candida*, *Cryptococcus*, *Histplasma*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*). +#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), ])` (sub)species from `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), "genus"])` other relevant genera from the kingdom of Animalia (like *Strongyloides* and *Taenia*) +#' - All `r format_included_data_number(microorganisms.old)` previously accepted names of all included (sub)species (these were taxonomically renamed) #' - The complete taxonomic tree of all included (sub)species: from kingdom to subspecies #' - The responsible author(s) and year of scientific publication #' @@ -57,26 +73,26 @@ #' mo_shortname("Chlamydophila psittaci") #' # Note: 'Chlamydophila psittaci' (Everett et al., 1999) was renamed back to #' # 'Chlamydia psittaci' (Page, 1968) -#' # [1] "C. psittaci" +#' #> [1] "C. psittaci" #' #' # Get any property from the entire taxonomic tree for all included species #' mo_class("E. coli") -#' # [1] "Gammaproteobacteria" +#' #> [1] "Gammaproteobacteria" #' #' mo_family("E. coli") -#' # [1] "Enterobacteriaceae" +#' #> [1] "Enterobacteriaceae" #' #' mo_gramstain("E. coli") # based on kingdom and phylum, see ?mo_gramstain -#' # [1] "Gram negative" +#' #> [1] "Gram-negative" #' #' mo_ref("E. coli") -#' # [1] "Castellani et al., 1919" +#' #> [1] "Castellani et al., 1919" #' #' # Do not get mistaken - this package is about microorganisms #' mo_kingdom("C. elegans") -#' # [1] "Fungi" # Fungi?! +#' #> [1] "Fungi" # Fungi?! #' mo_name("C. elegans") -#' # [1] "Cladosporium elegans" # Because a microorganism was found +#' #> [1] "Cladosporium elegans" # Because a microorganism was found NULL #' Version info of included Catalogue of Life diff --git a/R/first_isolate.R b/R/first_isolate.R index e47707c1..ec5de8af 100755 --- a/R/first_isolate.R +++ b/R/first_isolate.R @@ -27,7 +27,7 @@ #' #' Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type. To determine patient episodes not necessarily based on microorganisms, use [is_new_episode()] that also supports grouping with the `dplyr` package. #' @inheritSection lifecycle Stable lifecycle -#' @param x a [data.frame] containing isolates. Can be omitted when used inside `dplyr` verbs, such as `filter()`, `mutate()` and `summarise()`. +#' @param x a [data.frame] containing isolates. Can be omitted when used inside `dplyr` verbs, such as [`filter()`][dplyr::filter()], [`mutate()`][dplyr::mutate()] and [`summarise()`][dplyr::summarise()]. #' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class #' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive) #' @param col_mo column name of the IDs of the microorganisms (see [as.mo()]), defaults to the first column of class [`mo`]. Values will be coerced using [as.mo()]. diff --git a/R/is_new_episode.R b/R/is_new_episode.R index 0ef4632c..14079031 100644 --- a/R/is_new_episode.R +++ b/R/is_new_episode.R @@ -43,7 +43,7 @@ #' #' is_new_episode(example_isolates$date) #' is_new_episode(example_isolates$date, episode_days = 60) -#' #' \donttest{ +#' \donttest{ #' if (require("dplyr")) { #' # is_new_episode() can also be used in dplyr verbs to determine patient #' # episodes based on any (combination of) grouping variables: diff --git a/R/mdro.R b/R/mdro.R index f1191cd8..0a5c0577 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -27,7 +27,7 @@ #' #' Determine which isolates are multidrug-resistant organisms (MDRO) according to international and national guidelines. #' @inheritSection lifecycle Stable lifecycle -#' @param x a [data.frame] with antibiotics columns, like `AMX` or `amox`. Can be omitted when used inside `dplyr` verbs, such as `filter()`, `mutate()` and `summarise()`. +#' @param x a [data.frame] with antibiotics columns, like `AMX` or `amox`. Can be omitted when used inside `dplyr` verbs, such as [`filter()`][dplyr::filter()], [`mutate()`][dplyr::mutate()] and [`summarise()`][dplyr::summarise()]. #' @param guideline a specific guideline to follow. When left empty, the publication by Magiorakos *et al.* (2012, Clinical Microbiology and Infection) will be followed, please see *Details*. #' @inheritParams eucast_rules #' @param pct_required_classes minimal required percentage of antimicrobial classes that must be available per isolate, rounded down. For example, with the default guideline, 17 antimicrobial classes must be available for *S. aureus*. Setting this `pct_required_classes` argument to `0.5` (default) means that for every *S. aureus* isolate at least 8 different classes must be available. Any lower number of available classes will return `NA` for that isolate. diff --git a/R/mo_property.R b/R/mo_property.R index 252302a7..a96263b0 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -27,8 +27,8 @@ #' #' Use these functions to return a specific property of a microorganism based on the latest accepted taxonomy. All input values will be evaluated internally with [as.mo()], which makes it possible to use microbial abbreviations, codes and names as input. Please see *Examples*. #' @inheritSection lifecycle Stable lifecycle -#' @param x any character (vector) that can be coerced to a valid microorganism code with [as.mo()] -#' @param property one of the column names of the [microorganisms] data set or `"shortname"` +#' @param x any character (vector) that can be coerced to a valid microorganism code with [as.mo()]. Can be omitted for auto-guessing in `mo_is_*()` functions when used inside `dplyr` verbs, such as [`filter()`][dplyr::filter()], [`mutate()`][dplyr::mutate()] and [`summarise()`][dplyr::summarise()], please see *Examples*. +#' @param property one of the column names of the [microorganisms] data set: `r paste0('"``', colnames(microorganisms), '\``"', collapse = ", ")`, or must be `"shortname"` #' @param language language of the returned text, defaults to system language (see [get_locale()]) and can be overwritten by setting the option `AMR_locale`, e.g. `options(AMR_locale = "de")`, see [translate]. Also used to translate text like "no growth". Use `language = NULL` or `language = ""` to prevent translation. #' @param ... other parameters passed on to [as.mo()], such as 'allow_uncertain' and 'ignore_pattern' #' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()] diff --git a/docs/404.html b/docs/404.html index faf804e7..003d67d6 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9032 + 1.4.0.9033 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index aba3301e..99243f25 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9032 + 1.4.0.9033 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 64e99be5..9a51909f 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -39,7 +39,7 @@ AMR (for R) - 1.4.0.9000 + 1.4.0.9032 @@ -193,7 +193,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

15 October 2020

+

08 December 2020

Source: vignettes/AMR.Rmd @@ -202,7 +202,7 @@ -

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 15 October 2020.

+

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 08 December 2020.

Introduction

@@ -233,21 +233,21 @@ -2020-10-15 +2020-12-08 abcd Escherichia coli S S -2020-10-15 +2020-12-08 abcd Escherichia coli S R -2020-10-15 +2020-12-08 efgh Escherichia coli R @@ -352,70 +352,70 @@ -2011-04-04 -A3 +2015-10-08 +Y10 +Hospital A +Escherichia coli +S +S +R +S +F + + +2014-04-05 +O10 +Hospital C +Escherichia coli +R +I +S +S +F + + +2012-07-06 +H9 +Hospital A +Escherichia coli +R +S +S +S +M + + +2016-09-05 +U3 Hospital C Staphylococcus aureus R -I S S -M - - -2011-10-13 -I4 -Hospital B -Escherichia coli -S -S -S -S -M - - -2015-11-20 -J6 -Hospital A -Escherichia coli -I -S -R -S -M - - -2017-02-04 -X3 -Hospital B -Klebsiella pneumoniae -S -I -S S F -2010-10-17 -N9 -Hospital D -Staphylococcus aureus +2017-05-23 +S5 +Hospital C +Escherichia coli +I I R S -R F -2014-06-04 -X3 -Hospital A -Escherichia coli +2013-11-30 +J2 +Hospital C +Streptococcus pneumoniae S S +R S -S -F +M @@ -449,16 +449,16 @@ Longest: 1

1 M -10,412 -52.06% -10,412 -52.06% +10,384 +51.92% +10,384 +51.92% 2 F -9,588 -47.94% +9,616 +48.08% 20,000 100.00% @@ -501,10 +501,10 @@ Longest: 1

 data <- data %>% 
   mutate(first = first_isolate(.))
-# NOTE: Using column `bacteria` as input for `col_mo`.
-# NOTE: Using column `date` as input for `col_date`.
-# NOTE: Using column `patient_id` as input for `col_patient_id`.
-

So only 28.4% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

+# NOTE: Using column 'bacteria' as input for `col_mo`. +# NOTE: Using column 'date' as input for `col_date`. +# NOTE: Using column 'patient_id' as input for `col_patient_id`.
+

So only 28.6% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

 data_1st <- data %>% 
   filter(first == TRUE)
@@ -516,7 +516,7 @@ Longest: 1

First weighted isolates

-

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 Z7, 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 A3, sorted on date:

@@ -532,21 +532,21 @@ Longest: 1

- - + + - - + + - - + + - + @@ -554,30 +554,30 @@ Longest: 1

- - + + - - - - - - - - - - - - + + + + + + + + + + + + - - + + @@ -587,8 +587,8 @@ Longest: 1

- - + + @@ -598,45 +598,45 @@ Longest: 1

- - + + - + + - - - + + - - + + - - + + - - + + - - + + - - - + + + @@ -648,11 +648,12 @@ Longest: 1

data<-data%>%mutate(keyab =key_antibiotics(.))%>%mutate(first_weighted =first_isolate(.)) -# NOTE: Using column `bacteria` as input for `col_mo`. -# NOTE: Using column `bacteria` as input for `col_mo`. -# NOTE: Using column `date` as input for `col_date`. -# 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. +# NOTE: Using column 'bacteria' as input for `col_mo`. +# NOTE: Using column 'bacteria' as input for `col_mo`. +# NOTE: Using column 'date' as input for `col_date`. +# 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.
isolate
12010-03-27Z72010-01-04A3 B_ESCHR_COLI RSS RRS TRUE
22010-06-10Z72010-01-05A3 B_ESCHR_COLISR S S S
32010-06-25Z72010-02-07A3 B_ESCHR_COLIISSSFALSE
42010-11-05Z7B_ESCHR_COLISR S R S FALSE
42010-06-17A3B_ESCHR_COLISSSSFALSE
52010-11-22Z72010-07-23A3 B_ESCHR_COLI S S
62011-02-06Z72010-11-16A3 B_ESCHR_COLI S S
72011-03-19Z72010-12-05A3 B_ESCHR_COLIRII SR S FALSE
82011-07-19Z72011-01-17A3 B_ESCHR_COLIRI S SRS TRUE
92011-08-15Z72011-01-26A3 B_ESCHR_COLIR S SRSS FALSE
102011-09-22Z72011-02-12A3 B_ESCHR_COLISSSRRR S FALSE
@@ -669,22 +670,22 @@ Longest: 1

- - + + - - + + - - + + - + @@ -693,32 +694,20 @@ Longest: 1

- - + + - - - - - - - - - - - - - + - - - - + + + + @@ -727,10 +716,22 @@ Longest: 1

+ + + + + + + + + + + + - - + + @@ -741,60 +742,60 @@ Longest: 1

- - + + - + + - - + - - + + - - + + - - + + - - + + - - + + - - - + + +
isolate
12010-03-27Z72010-01-04A3 B_ESCHR_COLI RSS RRS TRUE TRUE
22010-06-10Z72010-01-05A3 B_ESCHR_COLISR S S S
32010-06-25Z72010-02-07A3 B_ESCHR_COLIISSSFALSEFALSE
42010-11-05Z7B_ESCHR_COLISR S R S FALSE TRUE
52010-11-22Z7
42010-06-17A3 B_ESCHR_COLI S S FALSE TRUE
52010-07-23A3B_ESCHR_COLISSSSFALSEFALSE
62011-02-06Z72010-11-16A3 B_ESCHR_COLI S S
72011-03-19Z72010-12-05A3 B_ESCHR_COLIRII SR S FALSETRUEFALSE
82011-07-19Z72011-01-17A3 B_ESCHR_COLIRI S SRS TRUE TRUE
92011-08-15Z72011-01-26A3 B_ESCHR_COLIR S SRSS FALSE TRUE
102011-09-22Z72011-02-12A3 B_ESCHR_COLISSSRRR S FALSE TRUE
-

Instead of 2, now 8 isolates are flagged. In total, 78.6% of all isolates are marked ‘first weighted’ - 50.2% 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 7 isolates are flagged. In total, 79.1% of all isolates are marked ‘first weighted’ - 50.6% 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:

 data_1st <- data %>% 
   filter_first_weighted_isolate()
-

So we end up with 15,713 isolates for analysis.

+

So we end up with 15,822 isolates for analysis.

We can remove unneeded columns:

 data_1st <- data_1st %>% 
@@ -837,47 +838,15 @@ Longest: 1

-1 -2011-04-04 -A3 -Hospital C -B_STPHY_AURS -R -I -S -S -M -Gram-positive -Staphylococcus -aureus -TRUE - - -2 -2011-10-13 -I4 -Hospital B -B_ESCHR_COLI -S -S -S -S -M -Gram-negative -Escherichia -coli -TRUE - - 3 -2015-11-20 -J6 +2012-07-06 +H9 Hospital A B_ESCHR_COLI -I -S R S +S +S M Gram-negative Escherichia @@ -886,45 +855,77 @@ Longest: 1

4 -2017-02-04 -X3 -Hospital B -B_KLBSL_PNMN -R -S -S -S -F -Gram-negative -Klebsiella -pneumoniae -TRUE - - -5 -2010-10-17 -N9 -Hospital D +2016-09-05 +U3 +Hospital C B_STPHY_AURS R -R S -R +S +S F Gram-positive Staphylococcus aureus TRUE - -7 -2011-06-10 -P2 -Hospital B -B_STRPT_PNMN + +5 +2017-05-23 +S5 +Hospital C +B_ESCHR_COLI I I +R +S +F +Gram-negative +Escherichia +coli +TRUE + + +8 +2016-07-20 +D2 +Hospital B +B_ESCHR_COLI +R +I S +S +M +Gram-negative +Escherichia +coli +TRUE + + +9 +2010-09-20 +H10 +Hospital D +B_STPHY_AURS +R +R +R +S +M +Gram-positive +Staphylococcus +aureus +TRUE + + +10 +2012-03-30 +Y4 +Hospital B +B_STRPT_PNMN +S +S +R R F Gram-positive @@ -953,8 +954,8 @@ Longest: 1

data_1st %>% freq(genus, species)

Frequency table

Class: character
-Length: 15,713
-Available: 15,713 (100%, NA: 0 = 0%)
+Length: 15,822
+Available: 15,822 (100%, NA: 0 = 0%)
Unique: 4

Shortest: 16
Longest: 24

@@ -971,33 +972,33 @@ Longest: 24

1 Escherichia coli -7,867 -50.07% -7,867 -50.07% +7,935 +50.15% +7,935 +50.15% 2 Staphylococcus aureus -3,842 -24.45% -11,709 -74.52% +3,933 +24.86% +11,868 +75.01% 3 Streptococcus pneumoniae -2,346 -14.93% -14,055 -89.45% +2,376 +15.02% +14,244 +90.03% 4 Klebsiella pneumoniae -1,658 -10.55% -15,713 +1,578 +9.97% +15,822 100.00% @@ -1011,7 +1012,7 @@ Longest: 24

data_1st %>% bug_drug_combinations() %>% head() # show first 6 rows
-
# NOTE: Using column `bacteria` as input for `col_mo`.
+
# NOTE: Using column 'bacteria' as input for `col_mo`.
@@ -1025,50 +1026,50 @@ Longest: 24

- - - - + + + + - - - - + + + + - + - - + + - + - - + + - - + + - - - - + + + +
mo
E. coli AMX380626237997867381125938657935
E. coli AMC622332113237867627829813597935
E. coli CIP60066070 01861786718657935
E. coli GEN70727138 079578677977935
K. pneumoniae AMX 0 01658165815781578
K. pneumoniae AMC12985630416581248572731578
@@ -1077,8 +1078,8 @@ Longest: 24

data_1st %>% select(bacteria, fluoroquinolones()) %>% bug_drug_combinations() -
# Selecting fluoroquinolones: `CIP` (ciprofloxacin)
-# NOTE: Using column `bacteria` as input for `col_mo`.
+
# Selecting fluoroquinolones: 'CIP' (ciprofloxacin)
+# NOTE: Using column 'bacteria' as input for `col_mo`.
@@ -1092,34 +1093,34 @@ Longest: 24

- + - - + + - + - - + + - + - - + + - + - - + +
mo
E. coli CIP60066070 01861786718657935
K. pneumoniae CIP12571219 040116583591578
S. aureus CIP29633015 087938429183933
S. pneumoniae CIP17851798 056123465782376
@@ -1132,7 +1133,7 @@ Longest: 24

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:

 data_1st %>% resistance(AMX)
-# [1] 0.5382168
+# [1] 0.535457

Or can be used in conjuction with group_by() and summarise(), both from the dplyr package:

 data_1st %>% 
@@ -1147,19 +1148,19 @@ Longest: 24

Hospital A -0.5459117 +0.5309604 Hospital B -0.5280457 +0.5345539 Hospital C -0.5268007 +0.5403226 Hospital D -0.5537583 +0.5401970 @@ -1179,23 +1180,23 @@ Longest: 24

Hospital A -0.5459117 -4574 +0.5309604 +4748 Hospital B -0.5280457 -5598 +0.5345539 +5571 Hospital C -0.5268007 -2388 +0.5403226 +2356 Hospital D -0.5537583 -3153 +0.5401970 +3147 @@ -1217,27 +1218,27 @@ Longest: 24

Escherichia -0.8318292 -0.8989450 -0.9853820 +0.8287335 +0.8995589 +0.9863894 Klebsiella -0.8166466 -0.8908323 -0.9782871 +0.8269962 +0.8941698 +0.9828897 Staphylococcus -0.8232691 -0.9190526 -0.9880271 +0.8245614 +0.9211798 +0.9839817 Streptococcus -0.5264280 +0.5366162 0.0000000 -0.5264280 +0.5366162 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 e78f6e21..a325c516 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 a6f2f57a..16af7178 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 8878ab97..db9649a4 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 dc78f980..1187798a 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 40463820..1b563f33 100644 --- a/docs/articles/MDR.html +++ b/docs/articles/MDR.html @@ -318,18 +318,18 @@ Unique: 2

 head(my_TB_data)
 #   rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
-# 1          S         I            R          S            R            R
-# 2          R         S            S          R            I            S
-# 3          I         R            I          S            R            S
-# 4          I         S            S          R            S            R
-# 5          R         R            S          S            R            R
-# 6          S         R            I          S            S            I
+# 1          S         S            R          R            R            R
+# 2          R         S            S          R            S            S
+# 3          S         R            R          R            S            S
+# 4          S         S            S          S            S            S
+# 5          R         S            R          S            R            S
+# 6          S         S            R          S            S            S
 #   kanamycin
 # 1         R
-# 2         S
-# 3         S
-# 4         R
-# 5         R
+# 2         R
+# 3         R
+# 4         S
+# 5         S
 # 6         S

We can now add the interpretation of MDR-TB to our data set. You can use:

@@ -361,40 +361,40 @@ Unique: 5

1 Mono-resistant -3313 -66.26% -3313 -66.26% +3327 +66.54% +3327 +66.54% 2 Negative -631 -12.62% -3944 -78.88% +632 +12.64% +3959 +79.18% 3 Multi-drug-resistant -575 -11.50% -4519 -90.38% +536 +10.72% +4495 +89.90% 4 Poly-resistant -275 -5.50% -4794 -95.88% +277 +5.54% +4772 +95.44% 5 Extensively drug-resistant -206 -4.12% +228 +4.56% 5000 100.00% diff --git a/docs/articles/PCA.html b/docs/articles/PCA.html index bff885c4..4d2400ae 100644 --- a/docs/articles/PCA.html +++ b/docs/articles/PCA.html @@ -39,7 +39,7 @@ AMR (for R) - 1.4.0.9008 + 1.4.0.9032
@@ -187,8 +187,7 @@ - -
+

The result can be reviewed with the good old summary() function:

 summary(pca_result)
diff --git a/docs/articles/PCA_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/PCA_files/figure-html/unnamed-chunk-5-1.png
index 54c1ec0a..8ef39602 100644
Binary files a/docs/articles/PCA_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/PCA_files/figure-html/unnamed-chunk-5-1.png differ
diff --git a/docs/articles/PCA_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/PCA_files/figure-html/unnamed-chunk-6-1.png
index 2d168e58..b6de2dee 100644
Binary files a/docs/articles/PCA_files/figure-html/unnamed-chunk-6-1.png and b/docs/articles/PCA_files/figure-html/unnamed-chunk-6-1.png differ
diff --git a/docs/articles/PCA_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/PCA_files/figure-html/unnamed-chunk-7-1.png
index c98890e5..0ad9620c 100644
Binary files a/docs/articles/PCA_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/PCA_files/figure-html/unnamed-chunk-7-1.png differ
diff --git a/docs/articles/PCA_files/header-attrs-2.4/header-attrs.js b/docs/articles/PCA_files/header-attrs-2.4/header-attrs.js
new file mode 100644
index 00000000..dd57d92e
--- /dev/null
+++ b/docs/articles/PCA_files/header-attrs-2.4/header-attrs.js
@@ -0,0 +1,12 @@
+// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
+// be compatible with the behavior of Pandoc < 2.8).
+document.addEventListener('DOMContentLoaded', function(e) {
+  var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
+  var i, h, a;
+  for (i = 0; i < hs.length; i++) {
+    h = hs[i];
+    if (!/^h[1-6]$/i.test(h.tagName)) continue;  // it should be a header h1-h6
+    a = h.attributes;
+    while (a.length > 0) h.removeAttribute(a[0].name);
+  }
+});
diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html
index a482d9a9..c3c45e98 100644
--- a/docs/articles/SPSS.html
+++ b/docs/articles/SPSS.html
@@ -39,7 +39,7 @@
       
       
         AMR (for R)
-        1.4.0.9008
+        1.4.0.9032
       
     
@@ -187,14 +187,13 @@ - -
+

You can now import files as follows:

@@ -345,21 +344,21 @@

To read files from SPSS into R:

 # read any SPSS file based on file extension (best way):
-read_spss(file = "path/to/file")
+read_spss(file = "path/to/file")
 
 # read .sav or .zsav file:
-read_sav(file = "path/to/file")
+read_sav(file = "path/to/file")
 
 # read .por file:
-read_por(file = "path/to/file")
-

Do not forget about as_factor(), as mentioned above.

+read_por(file = "path/to/file")

+

Do not forget about as_factor(), as mentioned above.

To export your R objects to the SPSS file format:

 # save as .sav file:
-write_sav(data = yourdata, path = "path/to/file")
+write_sav(data = yourdata, path = "path/to/file")
 
 # save as compressed .zsav file:
-write_sav(data = yourdata, path = "path/to/file", compress = TRUE)
+write_sav(data = yourdata, path = "path/to/file", compress = TRUE)

@@ -367,18 +366,18 @@

To read files from SAS into R:

 # read .sas7bdat + .sas7bcat files:
-read_sas(data_file = "path/to/file", catalog_file = NULL)
+read_sas(data_file = "path/to/file", catalog_file = NULL)
 
 # read SAS transport files (version 5 and version 8):
-read_xpt(file = "path/to/file")
+read_xpt(file = "path/to/file")

To export your R objects to the SAS file format:

 # save as regular SAS file:
-write_sas(data = yourdata, path = "path/to/file")
+write_sas(data = yourdata, path = "path/to/file")
 
 # the SAS transport format is an open format 
 # (required for submission of the data to the FDA)
-write_xpt(data = yourdata, path = "path/to/file", version = 8)
+write_xpt(data = yourdata, path = "path/to/file", version = 8)

@@ -386,15 +385,15 @@

To read files from Stata into R:

 # read .dta file:
-read_stata(file = "/path/to/file")
+read_stata(file = "/path/to/file")
 
 # works exactly the same:
-read_dta(file = "/path/to/file")
+read_dta(file = "/path/to/file")

To export your R objects to the Stata file format:

 # save as .dta file, Stata version 14:
 # (supports Stata v8 until v15 at the time of writing)
-write_dta(data = yourdata, path = "/path/to/file", version = 14)
+write_dta(data = yourdata, path = "/path/to/file", version = 14) diff --git a/docs/articles/SPSS_files/header-attrs-2.4/header-attrs.js b/docs/articles/SPSS_files/header-attrs-2.4/header-attrs.js new file mode 100644 index 00000000..dd57d92e --- /dev/null +++ b/docs/articles/SPSS_files/header-attrs-2.4/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html index 273f3e19..08e00195 100644 --- a/docs/articles/WHONET.html +++ b/docs/articles/WHONET.html @@ -39,7 +39,7 @@ AMR (for R) - 1.4.0.9008 + 1.4.0.9032 @@ -187,8 +187,7 @@ - -
+
@@ -227,20 +227,20 @@ times = 10) print(S.aureus, unit = "ms", signif = 2) # Unit: milliseconds -# expr min lq mean median uq max -# as.mo("sau") 11.0 12 16.0 14.0 15.0 40.0 -# as.mo("stau") 110.0 120 140.0 140.0 150.0 160.0 -# as.mo("STAU") 110.0 120 140.0 140.0 140.0 150.0 -# as.mo("staaur") 12.0 13 20.0 15.0 16.0 45.0 -# as.mo("STAAUR") 15.0 15 26.0 16.0 41.0 58.0 -# as.mo("S. aureus") 31.0 35 50.0 59.0 62.0 65.0 -# as.mo("S aureus") 27.0 33 59.0 59.0 62.0 160.0 -# as.mo("Staphylococcus aureus") 1.9 2 2.4 2.4 2.7 2.9 -# as.mo("Staphylococcus aureus (MRSA)") 910.0 960 980.0 970.0 1000.0 1100.0 -# as.mo("Sthafilokkockus aaureuz") 400.0 410 430.0 420.0 440.0 560.0 -# as.mo("MRSA") 12.0 13 19.0 15.0 15.0 42.0 -# as.mo("VISA") 20.0 22 31.0 24.0 47.0 54.0 -# as.mo("VRSA") 22.0 23 35.0 24.0 52.0 56.0 +# expr min lq mean median uq max +# as.mo("sau") 13.0 13.0 17.0 15.0 16.0 43.0 +# as.mo("stau") 120.0 120.0 140.0 150.0 150.0 160.0 +# as.mo("STAU") 120.0 150.0 150.0 150.0 160.0 160.0 +# as.mo("staaur") 13.0 13.0 17.0 14.0 16.0 44.0 +# as.mo("STAAUR") 13.0 14.0 19.0 16.0 16.0 48.0 +# as.mo("S. aureus") 34.0 58.0 61.0 63.0 68.0 86.0 +# as.mo("S aureus") 33.0 34.0 46.0 36.0 63.0 63.0 +# as.mo("Staphylococcus aureus") 2.3 2.5 2.5 2.5 2.6 2.7 +# as.mo("Staphylococcus aureus (MRSA)") 980.0 980.0 1000.0 1000.0 1000.0 1100.0 +# as.mo("Sthafilokkockus aaureuz") 430.0 430.0 440.0 440.0 440.0 460.0 +# as.mo("MRSA") 13.0 14.0 18.0 16.0 17.0 43.0 +# as.mo("VISA") 21.0 22.0 23.0 22.0 24.0 25.0 +# as.mo("VRSA") 22.0 23.0 35.0 27.0 52.0 55.0 # neval # 10 # 10 @@ -284,8 +284,8 @@ print(run_it, unit = "ms", signif = 3) # Unit: milliseconds # expr min lq mean median uq max neval -# mo_name(x) 165 176 223 202 274 318 10
-

So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.202 seconds. You only lose time on your unique input values.

+# mo_name(x) 145 190 221 213 248 313 10
+

So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.213 seconds. You only lose time on your unique input values.

@@ -299,10 +299,10 @@ print(run_it, unit = "ms", signif = 3) # Unit: milliseconds # expr min lq mean median uq max neval -# A 7.83 8.05 9.56 9.43 10.90 12.90 10 -# B 23.50 24.40 30.20 25.50 26.80 74.50 10 -# C 2.00 2.19 2.42 2.41 2.56 3.06 10

-

So going from mo_name("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0024 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

+# A 8.36 8.59 8.99 9.07 9.29 9.62 10 +# B 26.80 27.50 28.10 28.00 29.10 29.80 10 +# C 2.06 2.15 6.68 2.50 2.69 45.20 10 +

So going from mo_name("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0025 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

 run_it <- microbenchmark(A = mo_species("aureus"),
                          B = mo_genus("Staphylococcus"),
@@ -316,14 +316,14 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #  expr  min   lq mean median   uq  max neval
-#     A 1.69 1.75 1.90   1.86 2.00 2.25    10
-#     B 1.69 1.72 1.86   1.79 1.87 2.43    10
-#     C 1.67 1.75 1.89   1.81 1.93 2.67    10
-#     D 1.64 1.73 1.87   1.87 1.94 2.23    10
-#     E 1.65 1.75 1.90   1.83 1.92 2.35    10
-#     F 1.70 1.75 1.87   1.85 1.93 2.20    10
-#     G 1.73 1.83 1.93   1.93 2.01 2.25    10
-#     H 1.65 1.73 1.85   1.77 2.06 2.11    10
+# A 1.68 1.91 2.13 2.08 2.43 2.62 10 +# B 1.89 1.99 2.16 2.05 2.30 2.69 10 +# C 1.87 1.91 2.09 2.00 2.28 2.46 10 +# D 1.65 1.71 1.92 1.87 1.98 2.58 10 +# E 1.64 1.74 1.90 1.87 1.98 2.34 10 +# F 1.86 1.92 2.05 2.05 2.16 2.27 10 +# G 1.73 1.80 1.99 1.97 2.14 2.29 10 +# H 1.85 1.93 2.08 1.98 2.15 2.93 10

Of course, when running mo_phylum("Firmicutes") the function has zero knowledge about the actual microorganism, namely S. aureus. But since the result would be "Firmicutes" anyway, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.

@@ -351,13 +351,13 @@ print(run_it, unit = "ms", signif = 4) # Unit: milliseconds # expr min lq mean median uq max neval -# en 16.23 16.62 21.00 17.00 18.51 59.06 100 -# de 19.27 19.96 22.73 20.36 21.08 69.70 100 -# nl 31.40 32.54 38.76 33.16 35.34 82.43 100 -# es 19.36 19.75 23.61 20.26 20.88 67.39 100 -# it 19.24 19.64 21.23 20.00 20.72 62.92 100 -# fr 19.19 19.82 25.12 20.16 21.49 70.00 100 -# pt 19.18 19.64 22.44 20.23 21.47 60.56 100
+# en 16.16 17.85 22.42 18.54 19.61 68.28 100 +# de 19.55 21.38 24.37 21.96 22.95 61.55 100 +# nl 31.64 35.08 40.58 36.34 37.88 79.00 100 +# es 18.03 21.46 25.61 22.09 23.30 64.97 100 +# it 17.82 21.01 23.29 21.80 22.82 58.47 100 +# fr 18.19 21.29 25.63 21.93 23.20 60.48 100 +# pt 17.76 21.07 24.81 21.83 23.39 65.00 100

Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.

diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png index 707e0abc..34c903fe 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index 6fe0f739..ffe3cc27 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -39,7 +39,7 @@ AMR (for R) - 1.4.0.9000 + 1.4.0.9032 @@ -807,7 +807,7 @@ If you are reading this page from within R, please

Source

-

This data set contains all defined intrinsic resistance by EUCAST of all bug-drug combinations, and is based on ‘EUCAST Expert Rules / EUCAST Intrinsic Resistance and Unusual Phenotypes’, v3.2 from 2020.

+

This data set contains all defined intrinsic resistance by EUCAST of all bug-drug combinations, and is based on ‘’EUCAST Expert Rules’ and ‘EUCAST Intrinsic Resistance and Unusual Phenotypes’’, v3.2 from 2020.

diff --git a/docs/articles/index.html b/docs/articles/index.html index 20d49cb0..c23a520e 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9032 + 1.4.0.9033

diff --git a/docs/articles/resistance_predict.html b/docs/articles/resistance_predict.html index a7866c12..fc3ce962 100644 --- a/docs/articles/resistance_predict.html +++ b/docs/articles/resistance_predict.html @@ -39,7 +39,7 @@ AMR (for R) - 1.4.0.9008 + 1.4.0.9032 @@ -187,8 +187,7 @@ - -
+

The function will look for a date column itself if col_date is not set.

When running any of these commands, a summary of the regression model will be printed unless using resistance_predict(..., info = FALSE).

-
# NOTE: Using column `date` as input for `col_date`.
+
# NOTE: Using column 'date' as input for `col_date`.

This text is only a printed summary - the actual result (output) of the function is a data.frame containing for each year: the number of observations, the actual observed resistance, the estimated resistance and the standard error below and above the estimation:

 predict_TZP
@@ -290,7 +289,7 @@
   filter(mo_gramstain(mo, language = NULL) == "Gram-positive") %>%
   resistance_predict(col_ab = "VAN", year_min = 2010, info = FALSE, model = "binomial") %>% 
   ggplot_rsi_predict()
-# NOTE: Using column `date` as input for `col_date`.
+# NOTE: Using column 'date' as input for `col_date`.

Vancomycin resistance could be 100% in ten years, but might also stay around 0%.

You can define the model with the model parameter. The model chosen above is a generalised linear regression model using a binomial distribution, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance.

@@ -336,7 +335,7 @@ 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`.
+# 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:

diff --git a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-4-1.png index edb9c138..a3349966 100644 Binary files a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-1.png index e33de999..b00c262a 100644 Binary files a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-2.png b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-2.png index a307bc84..78fea131 100644 Binary files a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-2.png and b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-5-2.png differ diff --git a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png index 53cd4e5c..79674e91 100644 Binary files a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png and b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png index 32dc5c24..dc772519 100644 Binary files a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png differ diff --git a/docs/articles/resistance_predict_files/header-attrs-2.4/header-attrs.js b/docs/articles/resistance_predict_files/header-attrs-2.4/header-attrs.js new file mode 100644 index 00000000..dd57d92e --- /dev/null +++ b/docs/articles/resistance_predict_files/header-attrs-2.4/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/docs/articles/welcome_to_AMR.html b/docs/articles/welcome_to_AMR.html index d02b2993..9bf67ed4 100644 --- a/docs/articles/welcome_to_AMR.html +++ b/docs/articles/welcome_to_AMR.html @@ -39,7 +39,7 @@ AMR (for R) - 1.4.0.9008 + 1.4.0.9032 @@ -187,8 +187,7 @@ - -
+
diff --git a/docs/extra.css b/docs/extra.css index 71d10122..e8218271 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -229,6 +229,11 @@ table a:not(.btn):hover, .table a:not(.btn):hover { padding-top: 40px !important; font-weight: bold !important; } +.template-home h5 { + font-weight: normal; + font-style: italic; + font-size: 16px; +} /* logos on index page */ .logo_img { diff --git a/docs/index.html b/docs/index.html index d0957299..11fa6196 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.4.0.9032 + 1.4.0.9033
@@ -208,12 +208,120 @@ Since you are one of our users, we would like to know how you use the package an

AMR is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.

After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.

This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice and University Medical Center Groningen. This R package is actively maintained and is free software (see Copyright).

-
+

- Used in 135 countries
Since its first public release in early 2018, this package has been downloaded from 135 countries. Click the map to enlarge and to also see the names of the countries. + Used in 135 countries
Since its first public release in early 2018, this package has been downloaded from 135 countries. Click the map to enlarge.



+
+
+With AMR (for R), you’ll always have a knowledgeable microbiologist at your side!
+
+# AMR works great with dplyr, but it's not required or neccesary
+library(AMR)
+library(dplyr)
+
+example_isolates %>%
+  mutate(mo = mo_fullname(mo)) %>%
+  filter(mo_is_gram_positive()) %>%
+  select(mo, carbapenems(), glycopeptides())
+#> NOTE: Using column 'mo' as input for mo_is_gram_positive()
+#> Selecting cephalosporins: 'CAZ' (ceftazidime), 'CRO' (ceftriaxone),
+#>                           'CTX' (cefotaxime), 'CXM' (cefuroxime), 
+#>                           'CZO' (cefazolin), 'FEP' (cefepime),
+#>                           'FOX' (cefoxitin)
+#> Selecting glycopeptides: 'TEC' (teicoplanin), 'VAN' (vancomycin)
+

With only having defined a filter on Gram-positive micro-organisms (mo_is_gram_positive()) and a selection of two antibiotic groups (carbapenems() and glycopeptides()), the reference data about all bugs and drugs in the AMR package make sure you get what you meant:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
moCAZCROCTXCXMCZOFEPFOXTECVAN
Enterococcus faecalisRRRRRRRS
Enterococcus faecalisRRRRRRS
Enterococcus faecalisRRRRRRRS
+Streptococcus group BRSSSSSSS
Staphylococcus epidermidisRSS
Enterococcus faeciumRRRRRRRS
+

Partners

@@ -281,7 +390,7 @@ Since you are one of our users, we would like to know how you use the package an Latest released version

This package is available here on the official R network (CRAN), which has a peer-reviewed submission process. Install this package in R from CRAN by using the command:

-
+
 

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.

@@ -290,7 +399,7 @@ Since you are one of our users, we would like to know how you use the package an

Latest development version

The latest and unpublished development version can be installed from GitHub using:

-
+
 install.packages("remotes") 
 remotes::install_github("msberends/AMR")
@@ -353,7 +462,7 @@ Since you are one of our users, we would like to know how you use the package an
  • It analyses the data with convenient functions that use well-known methods.

    diff --git a/docs/news/index.html b/docs/news/index.html index c2b10a6b..9f63d7a8 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9032 + 1.4.0.9033
  • @@ -236,13 +236,13 @@ Source: NEWS.md
    -
    -

    -AMR 1.4.0.9032 Unreleased +
    +

    +AMR 1.4.0.9033 Unreleased

    -
    +

    -Last updated: 7 December 2020 +Last updated: 8 December 2020

    @@ -496,7 +496,7 @@

    Making this package independent of especially the tidyverse (e.g. packages dplyr and tidyr) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.

    Negative effects of this change are:

      -
    • Function freq() that was borrowed from the cleaner package was removed. Use cleaner::freq(), or run library("cleaner") before you use freq().
    • +
    • Function freq() that was borrowed from the cleaner package was removed. Use cleaner::freq(), or run library("cleaner") before you use freq().
    • Printing values of class mo or rsi in a tibble will no longer be in colour and printing rsi in a tibble will show the class <ord>, not <rsi> anymore. This is purely a visual effect.
    • All functions from the mo_* family (like mo_name() and mo_gramstain()) are noticeably slower when running on hundreds of thousands of rows.
    • For developers: classes mo and ab now both also inherit class character, to support any data transformation. This change invalidates code that checks for class length == 1.
    • @@ -824,7 +824,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ #> invalid microorganism code, NA generated

    This is important, because a value like "testvalue" could never be understood by e.g. mo_name(), although the class would suggest a valid microbial code.

    -
  • Function freq() has moved to a new package, clean (CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq() function still works, since it is re-exported from the clean package (which will be installed automatically upon updating this AMR package).

  • +
  • Function freq() has moved to a new package, clean (CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq() function still works, since it is re-exported from the clean package (which will be installed automatically upon updating this AMR package).

  • Renamed data set septic_patients to example_isolates

  • @@ -1087,7 +1087,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • The age() function gained a new parameter exact to determine ages with decimals
  • Removed deprecated functions guess_mo(), guess_atc(), EUCAST_rules(), interpretive_reading(), rsi()
  • -
  • Frequency tables (freq()): +
  • Frequency tables (freq()):
    • speed improvement for microbial IDs

    • fixed factor level names for R Markdown

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

      support for boxplots:

       septic_patients %>% 
      -  freq(age) %>% 
      +  freq(age) %>% 
         boxplot()
       # grouped boxplots:
       septic_patients %>% 
         group_by(hospital_id) %>% 
      -  freq(age) %>%
      +  freq(age) %>%
         boxplot()
    @@ -1111,7 +1111,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • Added ceftazidim intrinsic resistance to Streptococci
  • Changed default settings for age_groups(), to let groups of fives and tens end with 100+ instead of 120+
  • -
  • Fix for freq() for when all values are NA +
  • Fix for freq() for when all values are NA
  • Fix for first_isolate() for when dates are missing
  • Improved speed of guess_ab_col() @@ -1343,7 +1343,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • -
  • Frequency tables (freq() function): +
  • Frequency tables (freq() function):
    • Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:

      @@ -1352,15 +1352,15 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ # OLD WAY septic_patients %>% mutate(genus = mo_genus(mo)) %>% - freq(genus) + freq(genus) # NEW WAY septic_patients %>% - freq(mo_genus(mo)) + freq(mo_genus(mo)) # Even supports grouping variables: septic_patients %>% group_by(gender) %>% - freq(mo_genus(mo))
  • + 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

  • @@ -1442,20 +1442,20 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • 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:

       septic_patients %>% 
         group_by(hospital_id) %>% 
      -  freq(gender)
      + freq(gender)
  • Support for (un)selecting columns:

     septic_patients %>% 
    -  freq(hospital_id) %>% 
    +  freq(hospital_id) %>% 
       select(-count, -cum_count) # only get item, percent, cum_percent
  • Check for hms::is.hms

  • @@ -1473,7 +1473,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
  • 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

  • AI improvements for as.mo:

    @@ -1634,12 +1634,12 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/

    Support for types (classes) list and matrix for freq

     my_matrix = with(septic_patients, matrix(c(age, gender), ncol = 2))
    -freq(my_matrix)
    +freq(my_matrix)
  • For lists, subsetting is possible:

     my_list = list(age = septic_patients$age, gender = septic_patients$gender)
    -my_list %>% freq(age)
    -my_list %>% freq(gender)
    +my_list %>% freq(age) +my_list %>% freq(gender)
    @@ -1713,13 +1713,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/