From 4c114ff4b4b265dc3f7cf6b7d08f557695505cae Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Tue, 1 Dec 2020 16:59:57 +0100 Subject: [PATCH] (v1.4.0.9029) grey background for backticks, like readr pkg --- DESCRIPTION | 4 ++-- NEWS.md | 6 ++--- R/aa_helper_functions.R | 9 +++++++- docs/404.html | 2 +- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 22 +++++++++---------- docs/pkgdown.yml | 4 ++-- docs/reference/age_groups.html | 2 +- .../reference/antibiotic_class_selectors.html | 2 +- docs/reference/as.disk.html | 2 +- docs/reference/as.mo.html | 2 +- docs/reference/as.rsi.html | 2 +- docs/reference/first_isolate.html | 5 +++-- docs/reference/ggplot_rsi.html | 2 +- docs/reference/index.html | 2 +- docs/reference/intrinsic_resistant.html | 2 +- docs/reference/is_new_episode.html | 2 +- docs/reference/like.html | 2 +- docs/reference/mo_matching_score.html | 2 +- docs/reference/mo_property.html | 2 +- docs/survey.html | 2 +- man/first_isolate.Rd | 3 ++- 25 files changed, 49 insertions(+), 40 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b1b7e060..5f97fa71 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 d9f573d5..b51ee582 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 348a8adc..453d6d17 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 c506dc45..b032174b 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 2166c262..ce530dae 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 2593fa72..c51e4bbe 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 71cacece..4be138d9 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 81b1b4d9..3a9abf89 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 a7e2efae..423bad78 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 f2df8e12..8139726f 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 cfadbe73..ccd6a103 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 5a79aac5..d08c77b6 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 12c1c36c..55101ad0 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 33d1841a..68896d38 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 3a9633e8..6a6853e0 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 4d91c9e5..0fccd8fb 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 b48e8657..bfbf3f0d 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 ef39a782..3e78d4b5 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 9034d9af..5a31e6f4 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 5032c1c8..124c90bb 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 7c0403b2..ab54088d 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 ec9acd72..28d92e4b 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 94acf13a..345f8d74 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 344ae117..4dc402d2 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 fdd267a9..8f5bdba8 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, ...)) }