diff --git a/DESCRIPTION b/DESCRIPTION index b1b7e060e..5f97fa71e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.4.0.9027 -Date: 2020-11-25 +Version: 1.4.0.9029 +Date: 2020-12-01 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index d9f573d59..b51ee5825 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 1.4.0.9027 -## Last updated: 25 November 2020 +# AMR 1.4.0.9029 +## Last updated: 1 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: @@ -8,7 +8,7 @@ group_by(patient_id, hospital_id) %>% filter(is_new_episode(date, episode_days = 60)) ``` -* 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. If you have the `dplyr` package installed, they can even determine the column with microorganisms themselves when used inside `dplyr` verbs: +* 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. They can even determine the column with microorganisms themselves when used inside `dplyr` verbs: ```r example_isolates %>% filter(mo_is_gram_positive()) diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index 348a8adcf..453d6d174 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -296,6 +296,10 @@ word_wrap <- function(..., # place back spaces msg <- gsub("*|*", "\n", msg, fixed = TRUE) + + # format backticks + msg <- gsub("(`.+?`)", font_grey_bg("\\1"), msg) + msg } @@ -467,7 +471,7 @@ meet_criteria <- function(object, stop_if(any(dim(object) == 0), "the data provided in argument `", obj_name, "` must contain rows and columns (current dimensions: ", - paste(dim(object), collapse = " x "), ")", + paste(dim(object), collapse = "x"), ")", call = call_depth) } } @@ -606,6 +610,9 @@ font_subtle <- function(..., collapse = " ") { font_grey <- function(..., collapse = " ") { try_colour(..., before = "\033[38;5;249m", after = "\033[39m", collapse = collapse) } +font_grey_bg <- function(..., collapse = " ") { + try_colour(..., before = "\033[48;5;253m", after = "\033[49m", collapse = collapse) +} font_green_bg <- function(..., collapse = " ") { try_colour(..., before = "\033[42m", after = "\033[49m", collapse = collapse) } diff --git a/docs/404.html b/docs/404.html index c506dc456..b032174b4 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 2166c262f..ce530dae0 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 diff --git a/docs/articles/index.html b/docs/articles/index.html index 2593fa727..c51e4bbe0 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 diff --git a/docs/authors.html b/docs/authors.html index 71cacecec..4be138d94 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 diff --git a/docs/index.html b/docs/index.html index 81b1b4d96..3a9abf899 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 diff --git a/docs/news/index.html b/docs/news/index.html index a7e2efae9..423bad782 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 @@ -236,13 +236,13 @@ Source: NEWS.md -
-

-AMR 1.4.0.9027 Unreleased +
+

+AMR 1.4.0.9029 Unreleased

-
+

-Last updated: 25 November 2020 +Last updated: 1 December 2020

@@ -252,21 +252,21 @@

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:

 example_isolates %>%
-  group_by(patient_id, hospital_id) %>%
-  filter(is_new_episode(date, episode_days = 60))
+ group_by(patient_id, hospital_id) %>% + filter(is_new_episode(date, episode_days = 60))

  • -

    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. If you have the dplyr package installed, they can even determine the column with microorganisms themselves when used inside dplyr verbs:

    +

    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. They can even determine the column with microorganisms themselves when used inside dplyr verbs:

     example_isolates %>%
    -  filter(mo_is_gram_positive())
    +  filter(mo_is_gram_positive())
     #> NOTE: Using column `mo` as input for mo_is_gram_positive()
  • Function mo_is_intrinsic_resistant() to test for intrinsic resistance, based on EUCAST Intrinsic Resistance and Unusual Phenotypes v3.2 from 2020. As with the new mo_is_gram_*() functions, if you have the dplyr package installed the column with microorganisms will be automatically determined when used inside dplyr verbs:

     example_isolates %>%
    -  filter(mo_is_intrinsic_resistant(ab = "Vancomycin"))
    +  filter(mo_is_intrinsic_resistant(ab = "Vancomycin"))
     #> NOTE: Using column `mo` as input for mo_is_intrinsic_resistant()
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index f2df8e123..8139726f1 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,4 +1,4 @@ -pandoc: 2.7.3 +pandoc: 2.9.2.1 pkgdown: 1.6.1 pkgdown_sha: ~ articles: @@ -12,7 +12,7 @@ articles: datasets: datasets.html resistance_predict: resistance_predict.html welcome_to_AMR: welcome_to_AMR.html -last_built: 2020-11-25T11:09Z +last_built: 2020-12-01T15:59Z urls: reference: https://msberends.github.io/AMR//reference article: https://msberends.github.io/AMR//articles diff --git a/docs/reference/age_groups.html b/docs/reference/age_groups.html index cfadbe738..ccd6a1036 100644 --- a/docs/reference/age_groups.html +++ b/docs/reference/age_groups.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9023 + 1.4.0.9029
    diff --git a/docs/reference/antibiotic_class_selectors.html b/docs/reference/antibiotic_class_selectors.html index 5a79aac5f..d08c77b63 100644 --- a/docs/reference/antibiotic_class_selectors.html +++ b/docs/reference/antibiotic_class_selectors.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9021 + 1.4.0.9029
    diff --git a/docs/reference/as.disk.html b/docs/reference/as.disk.html index 12c1c36cb..55101ad02 100644 --- a/docs/reference/as.disk.html +++ b/docs/reference/as.disk.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9023 + 1.4.0.9029
    diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index 33d1841a9..68896d381 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9021 + 1.4.0.9029

    diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 3a9633e8e..6a6853e08 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9020 + 1.4.0.9029 diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index 4d91c9e5f..0fccd8fb3 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9026 + 1.4.0.9029 @@ -370,13 +370,14 @@

    All isolates with a microbial ID of NA will be excluded as first isolate.

    Why this is so important

    -

    To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode (ref). If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all S. aureus isolates would be overestimated, because you included this MRSA more than once. It would be selection bias.

    +

    To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode (Hindler et al. 2007). If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all S. aureus isolates would be overestimated, because you included this MRSA more than once. It would be selection bias.

    filter_*() shortcuts

    The functions filter_first_isolate() and filter_first_weighted_isolate() are helper functions to quickly filter on first isolates.

    The function filter_first_isolate() is essentially equal to either:

      x[first_isolate(x, ...), ]
    +  
       x %>% filter(first_isolate(x, ...))
     
    diff --git a/docs/reference/ggplot_rsi.html b/docs/reference/ggplot_rsi.html index b48e86574..bfbf3f0db 100644 --- a/docs/reference/ggplot_rsi.html +++ b/docs/reference/ggplot_rsi.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9026 + 1.4.0.9029 diff --git a/docs/reference/index.html b/docs/reference/index.html index ef39a782f..3e78d4b5e 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 diff --git a/docs/reference/intrinsic_resistant.html b/docs/reference/intrinsic_resistant.html index 9034d9af5..5a31e6f4d 100644 --- a/docs/reference/intrinsic_resistant.html +++ b/docs/reference/intrinsic_resistant.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9020 + 1.4.0.9029 diff --git a/docs/reference/is_new_episode.html b/docs/reference/is_new_episode.html index 5032c1c80..124c90bbf 100644 --- a/docs/reference/is_new_episode.html +++ b/docs/reference/is_new_episode.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9026 + 1.4.0.9029 diff --git a/docs/reference/like.html b/docs/reference/like.html index 7c0403b28..ab54088d1 100644 --- a/docs/reference/like.html +++ b/docs/reference/like.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9025 + 1.4.0.9029 diff --git a/docs/reference/mo_matching_score.html b/docs/reference/mo_matching_score.html index ec9acd725..28d92e4bc 100644 --- a/docs/reference/mo_matching_score.html +++ b/docs/reference/mo_matching_score.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9019 + 1.4.0.9029 diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html index 94acf13aa..345f8d745 100644 --- a/docs/reference/mo_property.html +++ b/docs/reference/mo_property.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0.9021 + 1.4.0.9029 diff --git a/docs/survey.html b/docs/survey.html index 344ae1172..4dc402d2f 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.4.0.9027 + 1.4.0.9029 diff --git a/man/first_isolate.Rd b/man/first_isolate.Rd index fdd267a9e..8f5bdba88 100755 --- a/man/first_isolate.Rd +++ b/man/first_isolate.Rd @@ -98,7 +98,7 @@ The \code{\link[=first_isolate]{first_isolate()}} function is a wrapper around t All isolates with a microbial ID of \code{NA} will be excluded as first isolate. \subsection{Why this is so important}{ -To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode \href{https:/pubmed.ncbi.nlm.nih.gov/17304462/}{(ref)}. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all \emph{S. aureus} isolates would be overestimated, because you included this MRSA more than once. It would be \href{https://en.wikipedia.org/wiki/Selection_bias}{selection bias}. +To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode \href{https://pubmed.ncbi.nlm.nih.gov/17304462/}{(Hindler \emph{et al.} 2007)}. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all \emph{S. aureus} isolates would be overestimated, because you included this MRSA more than once. It would be \href{https://en.wikipedia.org/wiki/Selection_bias}{selection bias}. } \subsection{\verb{filter_*()} shortcuts}{ @@ -106,6 +106,7 @@ To conduct an analysis of antimicrobial resistance, you should only include the The functions \code{\link[=filter_first_isolate]{filter_first_isolate()}} and \code{\link[=filter_first_weighted_isolate]{filter_first_weighted_isolate()}} are helper functions to quickly filter on first isolates. The function \code{\link[=filter_first_isolate]{filter_first_isolate()}} is essentially equal to either:\preformatted{ x[first_isolate(x, ...), ] + x \%>\% filter(first_isolate(x, ...)) }