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 @@
NEWS.md
-
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))
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()
All isolates with a microbial ID of NA
will be excluded as first isolate.
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_*()
shortcutsThe 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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, ...)) }