1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 06:06:12 +01:00

(v1.6.0.9001) support Inf for episodes

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-04-12 12:35:13 +02:00
parent 7a3139f7cc
commit 6ff5448192
29 changed files with 144 additions and 104 deletions

View File

@ -151,6 +151,8 @@ jobs:
if: matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2' if: matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2'
env: env:
_R_CHECK_CRAN_INCOMING_: false _R_CHECK_CRAN_INCOMING_: false
_R_CHECK_LENGTH_1_CONDITION_: verbose
_R_CHECK_LENGTH_1_LOGIC2_: verbose
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0} shell: Rscript {0}
@ -159,6 +161,7 @@ jobs:
env: env:
_R_CHECK_CRAN_INCOMING_: false _R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_: false _R_CHECK_FORCE_SUGGESTS_: false
_R_CHECK_DEPENDS_ONLY_: true
_R_CHECK_LENGTH_1_CONDITION_: verbose _R_CHECK_LENGTH_1_CONDITION_: verbose
_R_CHECK_LENGTH_1_LOGIC2_: verbose _R_CHECK_LENGTH_1_LOGIC2_: verbose
run: | run: |

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.6.0.9000 Version: 1.6.0.9001
Date: 2021-04-07 Date: 2021-04-12
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),

View File

@ -1,10 +1,10 @@
# AMR 1.6.0.9000 # AMR 1.6.0.9001
## <small>Last updated: 7 April 2021</small> ## <small>Last updated: 12 April 2021</small>
### New ### New
* Function `custom_eucast_rules()` that brings support for custom AMR rules in `eucast_rules()` * Function `custom_eucast_rules()` that brings support for custom AMR rules in `eucast_rules()`
# Changed ### Changed
* Custom MDRO guidelines (`mdro()`, `custom_mdro_guideline()`): * Custom MDRO guidelines (`mdro()`, `custom_mdro_guideline()`):
* Custom MDRO guidelines can now be combined with other custom MDRO guidelines using `c()` * Custom MDRO guidelines can now be combined with other custom MDRO guidelines using `c()`
* Fix for applying the rules; in previous versions, rows were interpreted according to the last matched rule. Now, rows are interpreted according to the first matched rule * Fix for applying the rules; in previous versions, rows were interpreted according to the last matched rule. Now, rows are interpreted according to the first matched rule
@ -12,6 +12,7 @@
* The `example_isolates` data set now contains some (fictitious) zero-year old patients * The `example_isolates` data set now contains some (fictitious) zero-year old patients
* Fix for minor translation errors * Fix for minor translation errors
* Printing of microbial codes in a `data.frame` or `tibble` now gives a warning if the data contains old microbial codes (from a previous AMR package version) * Printing of microbial codes in a `data.frame` or `tibble` now gives a warning if the data contains old microbial codes (from a previous AMR package version)
* `first_isolate()` can now take a vector of values for `col_keyantibiotics` and can have an episode length of `Inf`
# AMR 1.6.0 # AMR 1.6.0

View File

@ -591,7 +591,7 @@ meet_criteria <- function(object,
ifelse(allow_NA == TRUE, ", or NA", ""), ifelse(allow_NA == TRUE, ", or NA", ""),
call = call_depth) call = call_depth)
} }
if (!is.null(is_positive)) { if (isTRUE(is_positive)) {
stop_if(is.numeric(object) && !all(object > 0, na.rm = TRUE), "argument `", obj_name, stop_if(is.numeric(object) && !all(object > 0, na.rm = TRUE), "argument `", obj_name,
"` must ", "` must ",
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1, ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
@ -599,7 +599,7 @@ meet_criteria <- function(object,
"all be numbers higher than zero"), "all be numbers higher than zero"),
call = call_depth) call = call_depth)
} }
if (!is.null(is_positive_or_zero)) { if (isTRUE(is_positive_or_zero)) {
stop_if(is.numeric(object) && !all(object >= 0, na.rm = TRUE), "argument `", obj_name, stop_if(is.numeric(object) && !all(object >= 0, na.rm = TRUE), "argument `", obj_name,
"` must ", "` must ",
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1, ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
@ -607,7 +607,7 @@ meet_criteria <- function(object,
"all be zero or numbers higher than zero"), "all be zero or numbers higher than zero"),
call = call_depth) call = call_depth)
} }
if (!is.null(is_finite)) { if (isTRUE(is_finite)) {
stop_if(is.numeric(object) && !all(is.finite(object[!is.na(object)]), na.rm = TRUE), "argument `", obj_name, stop_if(is.numeric(object) && !all(is.finite(object[!is.na(object)]), na.rm = TRUE), "argument `", obj_name,
"` must ", "` must ",
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1, ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,

3
R/ab.R
View File

@ -155,7 +155,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
} }
if (initial_search == TRUE) { if (initial_search == TRUE) {
progress <- progress_ticker(n = length(x), n_min = ifelse(isTRUE(info), 25, length(x) + 1)) # start if n >= 25 progress <- progress_ticker(n = length(x),
n_min = ifelse(isTRUE(info) & isFALSE(fast_mode), 25, length(x) + 1)) # start if n >= 25
on.exit(close(progress)) on.exit(close(progress))
} }

View File

@ -28,7 +28,7 @@
#' These functions determine which items in a vector can be considered (the start of) a new episode, based on the argument `episode_days`. This can be used to determine clinical episodes for any epidemiological analysis. The [get_episode()] function returns the index number of the episode per group, while the [is_new_episode()] function returns values `TRUE`/`FALSE` to indicate whether an item in a vector is the start of a new episode. #' These functions determine which items in a vector can be considered (the start of) a new episode, based on the argument `episode_days`. This can be used to determine clinical episodes for any epidemiological analysis. The [get_episode()] function returns the index number of the episode per group, while the [is_new_episode()] function returns values `TRUE`/`FALSE` to indicate whether an item in a vector is the start of a new episode.
#' @inheritSection lifecycle Stable Lifecycle #' @inheritSection lifecycle Stable Lifecycle
#' @param x vector of dates (class `Date` or `POSIXt`) #' @param x vector of dates (class `Date` or `POSIXt`)
#' @param episode_days required episode length in days, can also be less than a day, see *Details* #' @param episode_days required episode length in days, can also be less than a day or `Inf`, see *Details*
#' @param ... currently not used #' @param ... currently not used
#' @details #' @details
#' Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least `episode_days` days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least `episode_days` days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored. #' Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least `episode_days` days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least `episode_days` days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored.
@ -88,7 +88,7 @@
#' # grouping on patients and microorganisms leads to the same results #' # grouping on patients and microorganisms leads to the same results
#' # as first_isolate(): #' # as first_isolate():
#' x <- example_isolates %>% #' x <- example_isolates %>%
#' filter(first_isolate(., include_unknown = TRUE)) #' filter_first_isolate(include_unknown = TRUE)
#' #'
#' y <- example_isolates %>% #' y <- example_isolates %>%
#' group_by(patient_id, mo) %>% #' group_by(patient_id, mo) %>%
@ -105,7 +105,7 @@
#' } #' }
get_episode <- function(x, episode_days, ...) { get_episode <- function(x, episode_days, ...) {
meet_criteria(x, allow_class = c("Date", "POSIXt")) meet_criteria(x, allow_class = c("Date", "POSIXt"))
meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE) meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = FALSE)
exec_episode(type = "sequential", exec_episode(type = "sequential",
x = x, x = x,
@ -117,7 +117,7 @@ get_episode <- function(x, episode_days, ...) {
#' @export #' @export
is_new_episode <- function(x, episode_days, ...) { is_new_episode <- function(x, episode_days, ...) {
meet_criteria(x, allow_class = c("Date", "POSIXt")) meet_criteria(x, allow_class = c("Date", "POSIXt"))
meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE) meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = FALSE)
exec_episode(type = "logical", exec_episode(type = "logical",
x = x, x = x,

View File

@ -339,7 +339,7 @@ eucast_rules <- function(x,
strsplit(",") %pm>% strsplit(",") %pm>%
unlist() %pm>% unlist() %pm>%
trimws() %pm>% trimws() %pm>%
vapply(FUN.VALUE = character(1), function(x) if (x %in% antibiotics$ab) ab_name(x, language = NULL, tolower = TRUE) else x) %pm>% vapply(FUN.VALUE = character(1), function(x) if (x %in% antibiotics$ab) ab_name(x, language = NULL, tolower = TRUE, fast_mode = TRUE) else x) %pm>%
sort() %pm>% sort() %pm>%
paste(collapse = ", ") paste(collapse = ", ")
x <- gsub("_", " ", x, fixed = TRUE) x <- gsub("_", " ", x, fixed = TRUE)
@ -448,29 +448,43 @@ eucast_rules <- function(x,
font_red(paste0("v", utils::packageDescription("AMR")$Version, ", ", font_red(paste0("v", utils::packageDescription("AMR")$Version, ", ",
format(as.Date(utils::packageDescription("AMR")$Date), format = "%Y"))), "), see ?eucast_rules\n")))) format(as.Date(utils::packageDescription("AMR")$Date), format = "%Y"))), "), see ?eucast_rules\n"))))
} }
ab_enzyme <- subset(antibiotics, name %like% "/")[, c("ab", "name")] ab_enzyme <- subset(antibiotics, name %like% "/")[, c("ab", "name")]
ab_enzyme$base_name <- gsub("^([a-zA-Z0-9]+).*", "\\1", ab_enzyme$name) colnames(ab_enzyme) <- c("enzyme_ab", "enzyme_name")
ab_enzyme$base_ab <- as.ab(ab_enzyme$base_name) ab_enzyme$base_name <- gsub("^([a-zA-Z0-9]+).*", "\\1", ab_enzyme$enzyme_name)
ab_enzyme$base_ab <- antibiotics[match(ab_enzyme$base_name, antibiotics$name), "ab", drop = TRUE]
ab_enzyme <- subset(ab_enzyme, !is.na(base_ab))
# make ampicillin and amoxicillin interchangable
ampi <- subset(ab_enzyme, base_ab == "AMX")
ampi$base_ab <- "AMP"
ampi$base_name <- ab_name("AMP", language = NULL)
amox <- subset(ab_enzyme, base_ab == "AMP")
amox$base_ab <- "AMX"
amox$base_name <- ab_name("AMX", language = NULL)
# merge and sort
ab_enzyme <- rbind(ab_enzyme, ampi, amox)
ab_enzyme <- ab_enzyme[order(ab_enzyme$enzyme_name), ]
for (i in seq_len(nrow(ab_enzyme))) { for (i in seq_len(nrow(ab_enzyme))) {
if (all(c(ab_enzyme[i, ]$ab, ab_enzyme[i, ]$base_ab) %in% names(cols_ab), na.rm = TRUE)) { # check if both base and base + enzyme inhibitor are part of the data set
ab_name_base <- ab_name(cols_ab[ab_enzyme[i, ]$base_ab], language = NULL, tolower = TRUE) if (all(c(ab_enzyme$base_ab[i], ab_enzyme$enzyme_ab[i]) %in% names(cols_ab), na.rm = TRUE)) {
ab_name_enzyme <- ab_name(cols_ab[ab_enzyme[i, ]$ab], language = NULL, tolower = TRUE) col_base <- unname(cols_ab[ab_enzyme$base_ab[i]])
col_enzyme <- unname(cols_ab[ab_enzyme$enzyme_ab[i]])
# Set base to R where base + enzyme inhibitor is R ---- # Set base to R where base + enzyme inhibitor is R ----
rule_current <- paste0("Set ", ab_name_base, " (", cols_ab[ab_enzyme[i, ]$base_ab], ") = R where ", rule_current <- paste0(ab_enzyme$base_name[i], " ('", font_bold(col_base), "') = R if ",
ab_name_enzyme, " (", cols_ab[ab_enzyme[i, ]$ab], ") = R") tolower(ab_enzyme$enzyme_name[i]), " ('", font_bold(col_enzyme), "') = R")
if (info == TRUE) { if (info == TRUE) {
cat(word_wrap(rule_current)) cat(word_wrap(rule_current,
cat("\n") width = getOption("width") - 30,
extra_indent = 6))
} }
run_changes <- edit_rsi(x = x, run_changes <- edit_rsi(x = x,
col_mo = col_mo, col_mo = col_mo,
to = "R", to = "R",
rule = c(rule_current, "Other rules", "", rule = c(rule_current, "Other rules", "",
paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)), paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)),
rows = which(as.rsi_no_warning(x[, cols_ab[ab_enzyme[i, ]$ab]]) == "R"), rows = which(as.rsi_no_warning(x[, col_enzyme, drop = TRUE]) == "R"),
cols = cols_ab[ab_enzyme[i, ]$base_ab], cols = col_base,
last_verbose_info = verbose_info, last_verbose_info = verbose_info,
original_data = x.bak, original_data = x.bak,
warned = warned, warned = warned,
@ -491,19 +505,21 @@ eucast_rules <- function(x,
} }
# Set base + enzyme inhibitor to S where base is S ---- # Set base + enzyme inhibitor to S where base is S ----
rule_current <- paste0("Set ", ab_name_enzyme, " (", cols_ab[ab_enzyme[i, ]$ab], ") = S where ", rule_current <- paste0(ab_enzyme$enzyme_name[i], " ('", font_bold(col_enzyme), "') = S if ",
ab_name_base, " (", cols_ab[ab_enzyme[i, ]$base_ab], ") = S") tolower(ab_enzyme$base_name[i]), " ('", font_bold(col_base), "') = S")
if (info == TRUE) { if (info == TRUE) {
cat(word_wrap(rule_current)) cat(word_wrap(rule_current,
cat("\n") width = getOption("width") - 30,
extra_indent = 6))
} }
run_changes <- edit_rsi(x = x, run_changes <- edit_rsi(x = x,
col_mo = col_mo, col_mo = col_mo,
to = "S", to = "S",
rule = c(rule_current, "Other rules", "", rule = c(rule_current, "Other rules", "",
paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)), paste0("Non-EUCAST: AMR package v", utils::packageDescription("AMR")$Version)),
rows = which(as.rsi_no_warning(x[, cols_ab[ab_enzyme[i, ]$base_ab]]) == "S"), rows = which(as.rsi_no_warning(x[, col_base, drop = TRUE]) == "S"),
cols = cols_ab[ab_enzyme[i, ]$ab], cols = col_enzyme,
last_verbose_info = verbose_info, last_verbose_info = verbose_info,
original_data = x.bak, original_data = x.bak,
warned = warned, warned = warned,
@ -580,6 +596,14 @@ eucast_rules <- function(x,
rule_next <- eucast_rules_df[min(nrow(eucast_rules_df), i + 1), "reference.rule", drop = TRUE] rule_next <- eucast_rules_df[min(nrow(eucast_rules_df), i + 1), "reference.rule", drop = TRUE]
rule_group_previous <- eucast_rules_df[max(1, i - 1), "reference.rule_group", drop = TRUE] rule_group_previous <- eucast_rules_df[max(1, i - 1), "reference.rule_group", drop = TRUE]
rule_group_current <- eucast_rules_df[i, "reference.rule_group", drop = TRUE] rule_group_current <- eucast_rules_df[i, "reference.rule_group", drop = TRUE]
# don't apply rules if user doesn't want to apply them
if (rule_group_current %like% "breakpoint" & !any(c("all", "breakpoints") %in% rules)) {
next
}
if (rule_group_current %like% "expert" & !any(c("all", "expert") %in% rules)) {
next
}
if (isFALSE(info) | isFALSE(verbose)) { if (isFALSE(info) | isFALSE(verbose)) {
rule_text <- "" rule_text <- ""
} else { } else {
@ -600,14 +624,6 @@ eucast_rules <- function(x,
rule_next <- "" rule_next <- ""
} }
# don't apply rules if user doesn't want to apply them
if (rule_group_current %like% "breakpoint" & !any(c("all", "breakpoints") %in% rules)) {
next
}
if (rule_group_current %like% "expert" & !any(c("all", "expert") %in% rules)) {
next
}
if (info == TRUE) { if (info == TRUE) {
# Print EUCAST intro ------------------------------------------------------ # Print EUCAST intro ------------------------------------------------------
if (!rule_group_current %like% "other" & eucast_notification_shown == FALSE) { if (!rule_group_current %like% "other" & eucast_notification_shown == FALSE) {

View File

@ -34,7 +34,7 @@
#' @param col_testcode column name of the test codes. Use `col_testcode = NULL` to **not** exclude certain test codes (such as test codes for screening). In that case `testcodes_exclude` will be ignored. #' @param col_testcode column name of the test codes. Use `col_testcode = NULL` to **not** exclude certain test codes (such as test codes for screening). In that case `testcodes_exclude` will be ignored.
#' @param col_specimen column name of the specimen type or group #' @param col_specimen column name of the specimen type or group
#' @param col_icu column name of the logicals (`TRUE`/`FALSE`) whether a ward or department is an Intensive Care Unit (ICU) #' @param col_icu column name of the logicals (`TRUE`/`FALSE`) whether a ward or department is an Intensive Care Unit (ICU)
#' @param col_keyantibiotics column name of the key antibiotics to determine first (weighted) isolates, see [key_antibiotics()]. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use `col_keyantibiotics = FALSE` to prevent this. #' @param col_keyantibiotics column name of the key antibiotics to determine first (weighted) isolates, see [key_antibiotics()]. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use `col_keyantibiotics = FALSE` to prevent this. Can also be the output of [key_antibiotics()].
#' @param episode_days episode in days after which a genus/species combination will be determined as 'first isolate' again. The default of 365 days is based on the guideline by CLSI, see *Source*. #' @param episode_days episode in days after which a genus/species combination will be determined as 'first isolate' again. The default of 365 days is based on the guideline by CLSI, see *Source*.
#' @param testcodes_exclude character vector with test codes that should be excluded (case-insensitive) #' @param testcodes_exclude character vector with test codes that should be excluded (case-insensitive)
#' @param icu_exclude logical to indicate whether ICU isolates should be excluded (rows with value `TRUE` in the column set with `col_icu`) #' @param icu_exclude logical to indicate whether ICU isolates should be excluded (rows with value `TRUE` in the column set with `col_icu`)
@ -177,11 +177,17 @@ first_isolate <- function(x = NULL,
} }
meet_criteria(col_specimen, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_specimen, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
meet_criteria(col_icu, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_icu, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
if (length(col_keyantibiotics) > 1) {
meet_criteria(col_keyantibiotics, allow_class = "character", has_length = nrow(x))
x$keyabcol <- col_keyantibiotics
col_keyantibiotics <- "keyabcol"
} else {
if (isFALSE(col_keyantibiotics)) { if (isFALSE(col_keyantibiotics)) {
col_keyantibiotics <- NULL col_keyantibiotics <- NULL
} }
meet_criteria(col_keyantibiotics, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_keyantibiotics, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE) }
meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = FALSE)
meet_criteria(testcodes_exclude, allow_class = "character", allow_NULL = TRUE) meet_criteria(testcodes_exclude, allow_class = "character", allow_NULL = TRUE)
meet_criteria(icu_exclude, allow_class = "logical", has_length = 1) meet_criteria(icu_exclude, allow_class = "logical", has_length = 1)
meet_criteria(specimen_group, allow_class = "character", has_length = 1, allow_NULL = TRUE) meet_criteria(specimen_group, allow_class = "character", has_length = 1, allow_NULL = TRUE)

View File

@ -173,10 +173,16 @@ key_antibiotics <- function(x = NULL,
# -- mo # -- mo
if (is.null(col_mo)) { if (is.null(col_mo)) {
col_mo <- search_type_in_df(x = x, type = "mo") col_mo <- search_type_in_df(x = x, type = "mo")
stop_if(is.null(col_mo), "`col_mo` must be set")
} else { } else {
stop_ifnot(col_mo %in% colnames(x), "column '", col_mo, "' (`col_mo`) not found") stop_ifnot(col_mo %in% colnames(x), "column '", col_mo, "' (`col_mo`) not found")
} }
if (is.null(col_mo)) {
warning_("No column found for `col_mo`, ignoring antimicrobial agents set for Gram-negative and Gram-positive bacteria", call = FALSE)
x$gramstain <- NA_character_
} else {
x$gramstain <- mo_gramstain(as.mo(x[, col_mo, drop = TRUE]), language = NULL)
}
x$key_ab <- NA_character_
# check columns # check columns
col.list <- c(universal_1, universal_2, universal_3, universal_4, universal_5, universal_6, col.list <- c(universal_1, universal_2, universal_3, universal_4, universal_5, universal_6,
@ -239,7 +245,7 @@ key_antibiotics <- function(x = NULL,
GramPos_4, GramPos_5, GramPos_6) GramPos_4, GramPos_5, GramPos_6)
gram_positive <- gram_positive[!is.null(gram_positive)] gram_positive <- gram_positive[!is.null(gram_positive)]
gram_positive <- gram_positive[!is.na(gram_positive)] gram_positive <- gram_positive[!is.na(gram_positive)]
if (length(gram_positive) < 12 & message_not_thrown_before("key_antibiotics.grampos")) { if (length(gram_positive) < 12 & !all(is.na(x$gramstain)) & message_not_thrown_before("key_antibiotics.grampos")) {
warning_("Only using ", length(gram_positive), " different antibiotics as key antibiotics for Gram-positives. See ?key_antibiotics.", call = FALSE) warning_("Only using ", length(gram_positive), " different antibiotics as key antibiotics for Gram-positives. See ?key_antibiotics.", call = FALSE)
remember_thrown_message("key_antibiotics.grampos") remember_thrown_message("key_antibiotics.grampos")
} }
@ -249,22 +255,18 @@ key_antibiotics <- function(x = NULL,
GramNeg_4, GramNeg_5, GramNeg_6) GramNeg_4, GramNeg_5, GramNeg_6)
gram_negative <- gram_negative[!is.null(gram_negative)] gram_negative <- gram_negative[!is.null(gram_negative)]
gram_negative <- gram_negative[!is.na(gram_negative)] gram_negative <- gram_negative[!is.na(gram_negative)]
if (length(gram_negative) < 12 & message_not_thrown_before("key_antibiotics.gramneg")) { if (length(gram_negative) < 12 & !all(is.na(x$gramstain)) & message_not_thrown_before("key_antibiotics.gramneg")) {
warning_("Only using ", length(gram_negative), " different antibiotics as key antibiotics for Gram-negatives. See ?key_antibiotics.", call = FALSE) warning_("Only using ", length(gram_negative), " different antibiotics as key antibiotics for Gram-negatives. See ?key_antibiotics.", call = FALSE)
remember_thrown_message("key_antibiotics.gramneg") remember_thrown_message("key_antibiotics.gramneg")
} }
x[, col_mo] <- as.mo(x[, col_mo, drop = TRUE])
x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL)
x$key_ab <- NA_character_
# Gram + # Gram +
x$key_ab <- pm_if_else(x$gramstain == "Gram-positive", x$key_ab <- pm_if_else(x$gramstain == "Gram-positive",
tryCatch(apply(X = x[, gram_positive], tryCatch(apply(X = x[, gram_positive],
MARGIN = 1, MARGIN = 1,
FUN = function(x) paste(x, collapse = "")), FUN = function(x) paste(x, collapse = "")),
error = function(e) paste0(rep(".", 12), collapse = "")), error = function(e) paste0(rep(".", 12), collapse = "")),
x$key_ab) as.character(x$key_ab))
# Gram - # Gram -
x$key_ab <- pm_if_else(x$gramstain == "Gram-negative", x$key_ab <- pm_if_else(x$gramstain == "Gram-negative",
@ -272,10 +274,10 @@ key_antibiotics <- function(x = NULL,
MARGIN = 1, MARGIN = 1,
FUN = function(x) paste(x, collapse = "")), FUN = function(x) paste(x, collapse = "")),
error = function(e) paste0(rep(".", 12), collapse = "")), error = function(e) paste0(rep(".", 12), collapse = "")),
x$key_ab) as.character(x$key_ab))
# format # format
key_abs <- toupper(gsub("[^SIR]", ".", gsub("(NA|NULL)", ".", x$key_ab))) key_abs <- toupper(gsub("(NA|NULL|[^RSIrsi])", ".", x$key_ab))
if (pm_n_distinct(key_abs) == 1) { if (pm_n_distinct(key_abs) == 1) {
warning_("No distinct key antibiotics determined.", call = FALSE) warning_("No distinct key antibiotics determined.", call = FALSE)

Binary file not shown.

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -42,7 +42,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>
@ -197,15 +197,11 @@
<a href="#amr-for-r-" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px"> <a href="#amr-for-r-" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px">
</h1></div> </h1></div>
<p><em>Note: the rules of EUCAST Clinical Breakpoints v11.0 (2021) are now implemented.</em></p> <p><em>Note: the rules of EUCAST Clinical Breakpoints v11.0 (2021) are now implemented.</em></p>
<blockquote>
<p><span class="fa fa-clipboard-list" style="color: #128f76; font-size: 20pt; margin-right: 5px;"></span> <strong>PLEASE TAKE PART IN OUR SURVEY!</strong><br>
Since you are one of our users, we would like to know how you use the package and what it brought you or your organisation. <strong>If you have a minute, please <a href="./survey.html">anonymously fill in this short questionnaire</a></strong>. Your valuable input will help to improve the package and its functionalities. You can answer the open questions in either English, Spanish, French, Dutch, or German. Thank you very much in advance! <br><a class="btn btn-info btn-amr" href="./survey.html">Take me to the 5-min survey!</a></p>
</blockquote>
<div id="what-is-amr-for-r" class="section level3"> <div id="what-is-amr-for-r" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#what-is-amr-for-r" class="anchor"></a>What is <code>AMR</code> (for R)?</h3> <a href="#what-is-amr-for-r" class="anchor"></a>What is <code>AMR</code> (for R)?</h3>
<p><em>(To find out how to conduct AMR data analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.)</em></p> <p><em>(To find out how to conduct AMR data analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.)</em></p>
<p><code>AMR</code> is a free, open-source and independent <a href="https://www.r-project.org">R package</a> 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. <strong>Our aim is to provide a standard</strong> for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p> <p><code>AMR</code> is a free, open-source and independent <a href="https://www.r-project.org">R package</a> 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. <strong>Our aim is to provide a standard</strong> for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p> <p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
<p>This package is <a href="https://en.wikipedia.org/wiki/Dependency_hell">fully independent of any other R package</a> and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). <strong>It was designed to work in any setting, including those with very limited resources</strong>. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the <a href="https://www.rug.nl">University of Groningen</a>, in collaboration with non-profit organisations <a href="https://www.certe.nl">Certe Medical Diagnostics and Advice Foundation</a> and <a href="https://www.umcg.nl">University Medical Center Groningen</a>. This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p> <p>This package is <a href="https://en.wikipedia.org/wiki/Dependency_hell">fully independent of any other R package</a> and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). <strong>It was designed to work in any setting, including those with very limited resources</strong>. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the <a href="https://www.rug.nl">University of Groningen</a>, in collaboration with non-profit organisations <a href="https://www.certe.nl">Certe Medical Diagnostics and Advice Foundation</a> and <a href="https://www.umcg.nl">University Medical Center Groningen</a>. This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p>
<div class="main-content" style="display: inline-block;"> <div class="main-content" style="display: inline-block;">

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>
@ -236,13 +236,13 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small> <small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div> </div>
<div id="amr-1609000" class="section level1"> <div id="amr-1609001" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9000"> <h1 class="page-header" data-toc-text="1.6.0.9001">
<a href="#amr-1609000" class="anchor"></a>AMR 1.6.0.9000<small> Unreleased </small> <a href="#amr-1609001" class="anchor"></a>AMR 1.6.0.9001<small> Unreleased </small>
</h1> </h1>
<div id="last-updated-7-april-2021" class="section level2"> <div id="last-updated-12-april-2021" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#last-updated-7-april-2021" class="anchor"></a><small>Last updated: 7 April 2021</small> <a href="#last-updated-12-april-2021" class="anchor"></a><small>Last updated: 12 April 2021</small>
</h2> </h2>
<div id="new" class="section level3"> <div id="new" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
@ -252,6 +252,26 @@
</li> </li>
</ul> </ul>
</div> </div>
<div id="changed" class="section level3">
<h3 class="hasAnchor">
<a href="#changed" class="anchor"></a>Changed</h3>
<ul>
<li>Custom MDRO guidelines (<code><a href="../reference/mdro.html">mdro()</a></code>, <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code>):
<ul>
<li>Custom MDRO guidelines can now be combined with other custom MDRO guidelines using <code><a href="https://rdrr.io/r/base/c.html">c()</a></code>
</li>
<li>Fix for applying the rules; in previous versions, rows were interpreted according to the last matched rule. Now, rows are interpreted according to the first matched rule</li>
</ul>
</li>
<li>Fix for <code><a href="../reference/age_groups.html">age_groups()</a></code> for persons aged zero</li>
<li>The <code>example_isolates</code> data set now contains some (fictitious) zero-year old patients</li>
<li>Fix for minor translation errors</li>
<li>Printing of microbial codes in a <code>data.frame</code> or <code>tibble</code> now gives a warning if the data contains old microbial codes (from a previous AMR package version)</li>
<li>
<code><a href="../reference/first_isolate.html">first_isolate()</a></code> can now take a vector of values for <code>col_keyantibiotics</code> and can have an episode length of <code>Inf</code>
</li>
</ul>
</div>
</div> </div>
</div> </div>
<div id="amr-160" class="section level1"> <div id="amr-160" class="section level1">

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html datasets: datasets.html
resistance_predict: resistance_predict.html resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html welcome_to_AMR: welcome_to_AMR.html
last_built: 2021-04-07T06:37Z last_built: 2021-04-12T10:33Z
urls: urls:
reference: https://msberends.github.io/AMR//reference reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles article: https://msberends.github.io/AMR//articles

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9040</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>
@ -314,7 +314,7 @@
</tr> </tr>
<tr> <tr>
<th>col_keyantibiotics</th> <th>col_keyantibiotics</th>
<td><p>column name of the key antibiotics to determine first (weighted) isolates, see <code><a href='key_antibiotics.html'>key_antibiotics()</a></code>. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use <code>col_keyantibiotics = FALSE</code> to prevent this.</p></td> <td><p>column name of the key antibiotics to determine first (weighted) isolates, see <code><a href='key_antibiotics.html'>key_antibiotics()</a></code>. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use <code>col_keyantibiotics = FALSE</code> to prevent this. Can also be the output of <code><a href='key_antibiotics.html'>key_antibiotics()</a></code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>episode_days</th> <th>episode_days</th>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>
@ -255,7 +255,7 @@
</tr> </tr>
<tr> <tr>
<th>episode_days</th> <th>episode_days</th>
<td><p>required episode length in days, can also be less than a day, see <em>Details</em></p></td> <td><p>required episode length in days, can also be less than a day or <code>Inf</code>, see <em>Details</em></p></td>
</tr> </tr>
<tr> <tr>
<th>...</th> <th>...</th>
@ -337,7 +337,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='co'># grouping on patients and microorganisms leads to the same results</span> <span class='co'># grouping on patients and microorganisms leads to the same results</span>
<span class='co'># as first_isolate():</span> <span class='co'># as first_isolate():</span>
<span class='va'>x</span> <span class='op'>&lt;-</span> <span class='va'>example_isolates</span> <span class='op'>%&gt;%</span> <span class='va'>x</span> <span class='op'>&lt;-</span> <span class='va'>example_isolates</span> <span class='op'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span><span class='op'>(</span><span class='fu'><a href='first_isolate.html'>first_isolate</a></span><span class='op'>(</span><span class='va'>.</span>, include_unknown <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span><span class='op'>)</span> <span class='fu'><a href='first_isolate.html'>filter_first_isolate</a></span><span class='op'>(</span>include_unknown <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='va'>y</span> <span class='op'>&lt;-</span> <span class='va'>example_isolates</span> <span class='op'>%&gt;%</span> <span class='va'>y</span> <span class='op'>&lt;-</span> <span class='va'>example_isolates</span> <span class='op'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span><span class='op'>(</span><span class='va'>patient_id</span>, <span class='va'>mo</span><span class='op'>)</span> <span class='op'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span><span class='op'>(</span><span class='va'>patient_id</span>, <span class='va'>mo</span><span class='op'>)</span> <span class='op'>%&gt;%</span>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>
@ -258,7 +258,7 @@
<span class='op'>)</span> <span class='op'>)</span>
<span class='co'># S3 method for mic</span> <span class='co'># S3 method for mic</span>
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span> <span class='fu'>ggplot</span><span class='op'>(</span>
<span class='va'>data</span>, <span class='va'>data</span>,
mapping <span class='op'>=</span> <span class='cn'>NULL</span>, mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"MIC values of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>, title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"MIC values of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
@ -289,7 +289,7 @@
<span class='op'>)</span> <span class='op'>)</span>
<span class='co'># S3 method for disk</span> <span class='co'># S3 method for disk</span>
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span> <span class='fu'>ggplot</span><span class='op'>(</span>
<span class='va'>data</span>, <span class='va'>data</span>,
mapping <span class='op'>=</span> <span class='cn'>NULL</span>, mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>, title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Disk zones of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,
@ -314,7 +314,7 @@
<span class='op'>)</span> <span class='op'>)</span>
<span class='co'># S3 method for rsi</span> <span class='co'># S3 method for rsi</span>
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span><span class='op'>(</span> <span class='fu'>ggplot</span><span class='op'>(</span>
<span class='va'>data</span>, <span class='va'>data</span>,
mapping <span class='op'>=</span> <span class='cn'>NULL</span>, mapping <span class='op'>=</span> <span class='cn'>NULL</span>,
title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Overview of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>, title <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span><span class='op'>(</span><span class='st'>"Resistance Overview of"</span>, <span class='fu'><a href='https://rdrr.io/r/base/deparse.html'>deparse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/substitute.html'>substitute</a></span><span class='op'>(</span><span class='va'>data</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span>,

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9001</span>
</span> </span>
</div> </div>

View File

@ -2,16 +2,11 @@
*Note: the rules of 'EUCAST Clinical Breakpoints v11.0 (2021)' are now implemented.* *Note: the rules of 'EUCAST Clinical Breakpoints v11.0 (2021)' are now implemented.*
> <span class="fa fa-clipboard-list" style="color: #128f76; font-size: 20pt; margin-right: 5px;"></span> **PLEASE TAKE PART IN OUR SURVEY!**
> Since you are one of our users, we would like to know how you use the package and what it brought you or your organisation. **If you have a minute, please [anonymously fill in this short questionnaire](./survey.html)**. Your valuable input will help to improve the package and its functionalities. You can answer the open questions in either English, Spanish, French, Dutch, or German. Thank you very much in advance!
> <br>
> <a class="btn btn-info btn-amr" href="./survey.html">Take me to the 5-min survey!</a>
### What is `AMR` (for R)? ### What is `AMR` (for R)?
*(To find out how to conduct AMR data analysis, please [continue reading here to get started](./articles/AMR.html).)* *(To find out how to conduct AMR data analysis, please [continue reading here to get started](./articles/AMR.html).)*
`AMR` is a free, open-source and independent [R package](https://www.r-project.org) 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. `AMR` is a free, open-source and independent [R package](https://www.r-project.org) 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 AMR 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**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data. After installing this package, R knows [**~70,000 distinct microbial species**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.

View File

@ -65,7 +65,7 @@ filter_first_weighted_isolate(
\item{col_icu}{column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU)} \item{col_icu}{column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU)}
\item{col_keyantibiotics}{column name of the key antibiotics to determine first (weighted) isolates, see \code{\link[=key_antibiotics]{key_antibiotics()}}. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use \code{col_keyantibiotics = FALSE} to prevent this.} \item{col_keyantibiotics}{column name of the key antibiotics to determine first (weighted) isolates, see \code{\link[=key_antibiotics]{key_antibiotics()}}. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use \code{col_keyantibiotics = FALSE} to prevent this. Can also be the output of \code{\link[=key_antibiotics]{key_antibiotics()}}.}
\item{episode_days}{episode in days after which a genus/species combination will be determined as 'first isolate' again. The default of 365 days is based on the guideline by CLSI, see \emph{Source}.} \item{episode_days}{episode in days after which a genus/species combination will be determined as 'first isolate' again. The default of 365 days is based on the guideline by CLSI, see \emph{Source}.}

View File

@ -12,7 +12,7 @@ is_new_episode(x, episode_days, ...)
\arguments{ \arguments{
\item{x}{vector of dates (class \code{Date} or \code{POSIXt})} \item{x}{vector of dates (class \code{Date} or \code{POSIXt})}
\item{episode_days}{required episode length in days, can also be less than a day, see \emph{Details}} \item{episode_days}{required episode length in days, can also be less than a day or \code{Inf}, see \emph{Details}}
\item{...}{currently not used} \item{...}{currently not used}
} }
@ -90,7 +90,7 @@ if (require("dplyr")) {
# grouping on patients and microorganisms leads to the same results # grouping on patients and microorganisms leads to the same results
# as first_isolate(): # as first_isolate():
x <- example_isolates \%>\% x <- example_isolates \%>\%
filter(first_isolate(., include_unknown = TRUE)) filter_first_isolate(include_unknown = TRUE)
y <- example_isolates \%>\% y <- example_isolates \%>\%
group_by(patient_id, mo) \%>\% group_by(patient_id, mo) \%>\%