diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R index 9f685d35..348a8adc 100755 --- a/R/aa_helper_functions.R +++ b/R/aa_helper_functions.R @@ -324,7 +324,7 @@ warning_ <- function(..., # - adds the function name where the error was thrown # - wraps text to never break lines within words stop_ <- function(..., call = TRUE) { - msg <- word_wrap(..., add_fn = list(), as_note = FALSE) + msg <- paste0(c(...), collapse = "") if (!isFALSE(call)) { if (isTRUE(call)) { call <- as.character(sys.call(-1)[1]) @@ -334,6 +334,7 @@ stop_ <- function(..., call = TRUE) { } msg <- paste0("in ", call, "(): ", msg) } + msg <- word_wrap(msg, add_fn = list(), as_note = FALSE) stop(msg, call. = FALSE) } @@ -409,6 +410,7 @@ dataset_UTF8_to_ASCII <- function(df) { df } +# for eucast_rules() and mdro(), creates markdown output with URLs and names create_ab_documentation <- function(ab) { ab_names <- ab_name(ab, language = NULL, tolower = TRUE) ab <- ab[order(ab_names)] diff --git a/R/first_isolate.R b/R/first_isolate.R index c4c2d3b7..cb73145a 100755 --- a/R/first_isolate.R +++ b/R/first_isolate.R @@ -50,7 +50,7 @@ #' 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)](https:/pubmed.ncbi.nlm.nih.gov/17304462/). 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](https://en.wikipedia.org/wiki/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)](https://pubmed.ncbi.nlm.nih.gov/17304462/). 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](https://en.wikipedia.org/wiki/Selection_bias). #' #' ### `filter_*()` shortcuts #' @@ -60,6 +60,7 @@ #' #' ``` #' x[first_isolate(x, ...), ] +#' #' x %>% filter(first_isolate(x, ...)) #' ``` #'