mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 18:06:11 +01:00
Compare commits
3 Commits
1a88caa119
...
331c1f6508
Author | SHA1 | Date | |
---|---|---|---|
331c1f6508 | |||
24eb4453db | |||
286eaa9699 |
@ -25,7 +25,6 @@
|
||||
^vignettes/AMR.Rmd$
|
||||
^vignettes/benchmarks.Rmd$
|
||||
^vignettes/EUCAST.Rmd$
|
||||
^vignettes/MDR.Rmd$
|
||||
^vignettes/PCA.Rmd$
|
||||
^vignettes/resistance_predict.Rmd$
|
||||
^vignettes/SPSS.Rmd$
|
||||
|
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 1.5.0.9009
|
||||
Date: 2021-01-22
|
||||
Version: 1.5.0.9012
|
||||
Date: 2021-01-25
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
|
8
NEWS.md
8
NEWS.md
@ -1,5 +1,5 @@
|
||||
# AMR 1.5.0.9009
|
||||
## <small>Last updated: 22 January 2021</small>
|
||||
# AMR 1.5.0.9012
|
||||
## <small>Last updated: 25 January 2021</small>
|
||||
|
||||
### New
|
||||
* Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package.
|
||||
@ -34,10 +34,12 @@
|
||||
* WHONET code `"PNV"` will now correctly be interpreted as `PHN`, the antibiotic code for phenoxymethylpenicillin ('peni V')
|
||||
* Fix for verbose output of `mdro(..., verbose = TRUE)` for German guideline (3MGRN and 4MGRN) and Dutch guideline (BRMO, only *P. aeruginosa*)
|
||||
* `is.rsi.eligible()` now returns `FALSE` immediately if the input does not contain any of the values "R", "S" or "I". This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
|
||||
* Functions `get_episode()` and `is_new_episode()` now support less than a day as value for argument `episode_days` (e.g., to include one patient/test per hour)
|
||||
* Argument `ampc_cephalosporin_resistance` in `eucast_rules()` now also applies to value "I" (not only "S")
|
||||
|
||||
### Other
|
||||
* Big documentation updates
|
||||
* Loading the package (i.e., `library(AMR)`) now is ~50 times faster than before
|
||||
* Loading the package (i.e., `library(AMR)`) now is ~50 times faster than before, in costs of package size (increased with ~3 MB)
|
||||
|
||||
|
||||
# AMR 1.5.0
|
||||
|
@ -442,7 +442,7 @@ create_ab_documentation <- function(ab) {
|
||||
out
|
||||
}
|
||||
|
||||
vector_or <- function(v, quotes = TRUE, reverse = FALSE) {
|
||||
vector_or <- function(v, quotes = TRUE, reverse = FALSE, last_sep = " or ") {
|
||||
# makes unique and sorts, and this also removed NAs
|
||||
v <- sort(unique(v))
|
||||
if (length(v) == 1) {
|
||||
@ -451,16 +451,25 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE) {
|
||||
if (reverse == TRUE) {
|
||||
v <- rev(v)
|
||||
}
|
||||
if (identical(v, c("I", "R", "S"))) {
|
||||
# class <rsi> should be sorted like this
|
||||
v <- c("R", "S", "I")
|
||||
}
|
||||
if (isTRUE(quotes)) {
|
||||
quotes <- '"'
|
||||
} else if (isFALSE(quotes)) {
|
||||
quotes <- ""
|
||||
}
|
||||
# all commas except for last item, so will become '"val1", "val2", "val3" or "val4"'
|
||||
paste0(paste0(ifelse(quotes, '"', ""), v[seq_len(length(v) - 1)], ifelse(quotes, '"', ""), collapse = ", "),
|
||||
" or ", paste0(ifelse(quotes, '"', ""), v[length(v)], ifelse(quotes, '"', "")))
|
||||
paste0(paste0(quotes, v[seq_len(length(v) - 1)], quotes, collapse = ", "),
|
||||
last_sep, paste0(quotes, v[length(v)], quotes))
|
||||
}
|
||||
|
||||
format_class <- function(class, plural) {
|
||||
class.bak <- class
|
||||
class[class %in% c("numeric", "double")] <- "number"
|
||||
class[class == "numeric"] <- "number"
|
||||
class[class == "integer"] <- "whole number"
|
||||
if (any(c("numeric", "double") %in% class.bak, na.rm = TRUE) & "integer" %in% class.bak) {
|
||||
if (all(c("numeric", "integer") %in% class.bak, na.rm = TRUE)) {
|
||||
class[class %in% c("number", "whole number")] <- "(whole) number"
|
||||
}
|
||||
class[class == "character"] <- "text string"
|
||||
@ -496,6 +505,8 @@ meet_criteria <- function(object,
|
||||
has_length = NULL,
|
||||
looks_like = NULL,
|
||||
is_in = NULL,
|
||||
is_positive = NULL,
|
||||
is_finite = NULL,
|
||||
contains_column_class = NULL,
|
||||
allow_NULL = FALSE,
|
||||
allow_NA = FALSE,
|
||||
@ -505,6 +516,16 @@ meet_criteria <- function(object,
|
||||
obj_name <- deparse(substitute(object))
|
||||
call_depth <- -2 - abs(.call_depth)
|
||||
|
||||
# if object is missing, or another error:
|
||||
tryCatch(invisible(object),
|
||||
error = function(e) pkg_env$meet_criteria_error_txt <- e$message)
|
||||
if (!is.null(pkg_env$meet_criteria_error_txt)) {
|
||||
error_txt <- pkg_env$meet_criteria_error_txt
|
||||
pkg_env$meet_criteria_error_txt <- NULL
|
||||
stop(error_txt, call. = FALSE)
|
||||
}
|
||||
pkg_env$meet_criteria_error_txt <- NULL
|
||||
|
||||
if (is.null(object)) {
|
||||
stop_if(allow_NULL == FALSE, "argument `", obj_name, "` must not be NULL", call = call_depth)
|
||||
return(invisible())
|
||||
@ -550,6 +571,25 @@ meet_criteria <- function(object,
|
||||
"` must be ",
|
||||
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1, "either ", ""),
|
||||
vector_or(is_in, quotes = !isTRUE(any(c("double", "numeric", "integer") %in% allow_class))),
|
||||
ifelse(allow_NA == TRUE, ", or NA", ""),
|
||||
call = call_depth)
|
||||
}
|
||||
if (!is.null(is_positive)) {
|
||||
stop_if(is.numeric(object) && !all(object > 0, na.rm = TRUE), "argument `", obj_name,
|
||||
"` must ",
|
||||
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
|
||||
"be a positive number",
|
||||
"all be positive numbers"),
|
||||
" (higher than zero)",
|
||||
call = call_depth)
|
||||
}
|
||||
if (!is.null(is_finite)) {
|
||||
stop_if(is.numeric(object) && !all(is.finite(object[!is.na(object)]), na.rm = TRUE), "argument `", obj_name,
|
||||
"` must ",
|
||||
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
|
||||
"be a finite number",
|
||||
"all be finite numbers"),
|
||||
" (i.e., not be infinite)",
|
||||
call = call_depth)
|
||||
}
|
||||
if (!is.null(contains_column_class)) {
|
||||
|
@ -38,7 +38,7 @@
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a dataset available in the AMR package.
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' # this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
||||
@ -207,12 +207,12 @@ ab_selector <- function(ab_class, function_name) {
|
||||
} else {
|
||||
agents_formatted <- paste0("column '", font_bold(agents, collapse = NULL), "'")
|
||||
agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL)
|
||||
need_name <- tolower(agents) != tolower(agents_names)
|
||||
need_name <- tolower(gsub("[^a-zA-Z]", "", agents)) != tolower(gsub("[^a-zA-Z]", "", agents_names))
|
||||
agents_formatted[need_name] <- paste0(agents_formatted[need_name],
|
||||
" (", agents_names[need_name], ")")
|
||||
message_("Selecting ", ab_group, ": ", paste(agents_formatted, collapse = ", "),
|
||||
as_note = FALSE,
|
||||
extra_indent = nchar(paste0("Selecting ", ab_group, ": ")))
|
||||
extra_indent = 4)
|
||||
}
|
||||
remember_thrown_message(function_name)
|
||||
}
|
||||
|
4
R/age.R
4
R/age.R
@ -149,8 +149,8 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
||||
#' }
|
||||
#' }
|
||||
age_groups <- function(x, split_at = c(12, 25, 55, 75), na.rm = FALSE) {
|
||||
meet_criteria(x, allow_class = c("numeric", "integer"))
|
||||
meet_criteria(split_at, allow_class = c("numeric", "integer", "character"))
|
||||
meet_criteria(x, allow_class = c("numeric", "integer"), is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(split_at, allow_class = c("numeric", "integer", "character"), is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (any(x < 0, na.rm = TRUE)) {
|
||||
|
@ -44,7 +44,7 @@
|
||||
#' }
|
||||
availability <- function(tbl, width = NULL) {
|
||||
meet_criteria(tbl, allow_class = "data.frame")
|
||||
meet_criteria(width, allow_class = "numeric", allow_NULL = TRUE)
|
||||
meet_criteria(width, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
|
||||
|
||||
x <- vapply(FUN.VALUE = double(1), tbl, function(x) {
|
||||
1 - sum(is.na(x)) / length(x)
|
||||
|
@ -129,7 +129,7 @@ format.bug_drug_combinations <- function(x,
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(add_ab_group, allow_class = "logical", has_length = 1)
|
||||
|
2
R/disk.R
2
R/disk.R
@ -61,7 +61,7 @@ as.disk <- function(x, na.rm = FALSE) {
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (!is.disk(x)) {
|
||||
x <- x %pm>% unlist()
|
||||
x <- unlist(x)
|
||||
if (na.rm == TRUE) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
|
32
R/episode.R
32
R/episode.R
@ -28,8 +28,8 @@
|
||||
#' 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
|
||||
#' @param x vector of dates (class `Date` or `POSIXt`)
|
||||
#' @param episode_days length of the required episode in days, see *Details*
|
||||
#' @param ... arguments passed on to [as.Date()]
|
||||
#' @param episode_days required episode length in days, can also be less than a day, see *Details*
|
||||
#' @param ... currently not used
|
||||
#' @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.
|
||||
#'
|
||||
@ -44,15 +44,20 @@
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a dataset available in the AMR package.
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' get_episode(example_isolates$date, episode_days = 60)
|
||||
#' is_new_episode(example_isolates$date, episode_days = 60)
|
||||
#' get_episode(example_isolates$date, episode_days = 60) # indices
|
||||
#' is_new_episode(example_isolates$date, episode_days = 60) # TRUE/FALSE
|
||||
#'
|
||||
#' # filter on results from the third 60-day episode only, using base R
|
||||
#' example_isolates[which(get_episode(example_isolates$date, 60) == 3), ]
|
||||
#'
|
||||
#' # the functions also work for less than a day, e.g. to include one per hour:
|
||||
#' get_episode(c(Sys.time(),
|
||||
#' Sys.time() + 60 * 60),
|
||||
#' episode_days = 1/24)
|
||||
#'
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#' # is_new_episode() can also be used in dplyr verbs to determine patient
|
||||
@ -100,7 +105,7 @@
|
||||
#' }
|
||||
get_episode <- function(x, episode_days, ...) {
|
||||
meet_criteria(x, allow_class = c("Date", "POSIXt"))
|
||||
meet_criteria(episode_days, allow_class = c("numeric", "double", "integer"), has_length = 1)
|
||||
meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
|
||||
exec_episode(type = "sequential",
|
||||
x = x,
|
||||
@ -112,7 +117,7 @@ get_episode <- function(x, episode_days, ...) {
|
||||
#' @export
|
||||
is_new_episode <- function(x, episode_days, ...) {
|
||||
meet_criteria(x, allow_class = c("Date", "POSIXt"))
|
||||
meet_criteria(episode_days, allow_class = c("numeric", "double", "integer"), has_length = 1)
|
||||
meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
|
||||
exec_episode(type = "logical",
|
||||
x = x,
|
||||
@ -121,7 +126,10 @@ is_new_episode <- function(x, episode_days, ...) {
|
||||
}
|
||||
|
||||
exec_episode <- function(type, x, episode_days, ...) {
|
||||
x <- as.double(as.Date(x, ...)) # as.Date() for POSIX classes
|
||||
x <- as.double(as.POSIXct(x)) # as.POSIXct() for Date classes
|
||||
# since x is now in seconds, get seconds from episode_days as well
|
||||
episode_seconds <- episode_days * 60 * 60 * 24
|
||||
|
||||
if (length(x) == 1) {
|
||||
if (type == "logical") {
|
||||
return(TRUE)
|
||||
@ -129,7 +137,7 @@ exec_episode <- function(type, x, episode_days, ...) {
|
||||
return(1)
|
||||
}
|
||||
} else if (length(x) == 2) {
|
||||
if (max(x) - min(x) >= episode_days) {
|
||||
if (max(x) - min(x) >= episode_seconds) {
|
||||
if (type == "logical") {
|
||||
return(c(TRUE, TRUE))
|
||||
} else if (type == "sequential") {
|
||||
@ -146,13 +154,13 @@ exec_episode <- function(type, x, episode_days, ...) {
|
||||
|
||||
# I asked on StackOverflow:
|
||||
# https://stackoverflow.com/questions/42122245/filter-one-row-every-year
|
||||
exec <- function(x, episode_days) {
|
||||
exec <- function(x, episode_seconds) {
|
||||
indices <- integer()
|
||||
start <- x[1]
|
||||
ind <- 1
|
||||
indices[1] <- 1
|
||||
for (i in 2:length(x)) {
|
||||
if (isTRUE((x[i] - start) >= episode_days)) {
|
||||
if (isTRUE((x[i] - start) >= episode_seconds)) {
|
||||
ind <- ind + 1
|
||||
if (type == "logical") {
|
||||
indices[ind] <- i
|
||||
@ -175,7 +183,7 @@ exec_episode <- function(type, x, episode_days, ...) {
|
||||
df <- data.frame(x = x,
|
||||
y = seq_len(length(x))) %pm>%
|
||||
pm_arrange(x)
|
||||
df$new <- exec(df$x, episode_days)
|
||||
df$new <- exec(df$x, episode_seconds)
|
||||
df %pm>%
|
||||
pm_arrange(y) %pm>%
|
||||
pm_pull(new)
|
||||
|
@ -73,7 +73,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' @param verbose a [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.
|
||||
#' @param version_breakpoints the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either `r vector_or(names(EUCAST_VERSION_BREAKPOINTS), reverse = TRUE)`.
|
||||
#' @param version_expertrules the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either `r vector_or(names(EUCAST_VERSION_EXPERT_RULES), reverse = TRUE)`.
|
||||
#' @param ampc_cephalosporin_resistance a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of `NA` for this argument will remove results for these agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: *`r gsub("[)(^]", "", gsub("|", ", ", eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1], fixed = TRUE))`*.
|
||||
#' @param ampc_cephalosporin_resistance a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of `NA` for this argument will remove results for these agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_or(gsub("[^a-zA-Z ]+", "", unlist(strsplit(eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*", last_sep = " and ")`.
|
||||
#' @param ... column name of an antibiotic, see section *Antibiotics* below
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
#' @param administration route of administration, either `r vector_or(dosage$administration)`
|
||||
@ -173,7 +173,7 @@ eucast_rules <- function(x,
|
||||
meet_criteria(verbose, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS)))
|
||||
meet_criteria(version_expertrules, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_EXPERT_RULES)))
|
||||
meet_criteria(ampc_cephalosporin_resistance, allow_class = c("rsi", "character"), has_length = 1, allow_NA = TRUE, allow_NULL = TRUE, is_in = c("R", "S", "I"))
|
||||
meet_criteria(ampc_cephalosporin_resistance, has_length = 1, allow_NA = TRUE, allow_NULL = TRUE, is_in = c("R", "S", "I"))
|
||||
|
||||
x_deparsed <- deparse(substitute(x))
|
||||
if (length(x_deparsed) > 1 || !all(x_deparsed %like% "[a-z]+")) {
|
||||
@ -1183,7 +1183,7 @@ edit_rsi <- function(x,
|
||||
#' @export
|
||||
eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 11.0) {
|
||||
meet_criteria(ab, allow_class = c("character", "numeric", "integer", "factor"))
|
||||
meet_criteria(administration, allow_class = "character", is_in = dosage$administration[!is.na(dosage$administration)])
|
||||
meet_criteria(administration, allow_class = "character", is_in = dosage$administration[!is.na(dosage$administration)], has_length = 1)
|
||||
meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS)))
|
||||
|
||||
# show used version_breakpoints number once per session (pkg_env will reload every session)
|
||||
@ -1195,9 +1195,21 @@ eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 11.0)
|
||||
}
|
||||
|
||||
ab <- as.ab(ab)
|
||||
df <- AMR::dosage[which(AMR::dosage$ab %in% ab & AMR::dosage$administration %in% administration), , drop = FALSE]
|
||||
df <- df[match(ab, df$ab), colnames(df)[colnames(df) != "administration"], drop = FALSE]
|
||||
rownames(df) <- NULL
|
||||
df$ab <- ab
|
||||
df
|
||||
lst <- vector("list", length = length(ab))
|
||||
for (i in seq_len(length(ab))) {
|
||||
df <- AMR::dosage[which(AMR::dosage$ab == ab[i] & AMR::dosage$administration == administration), , drop = FALSE]
|
||||
lst[[i]] <- list(ab = "",
|
||||
name = "",
|
||||
standard_dosage = ifelse("standard_dosage" %in% df$type,
|
||||
df[which(df$type == "standard_dosage"), ]$original_txt,
|
||||
NA_character_),
|
||||
high_dosage = ifelse("high_dosage" %in% df$type,
|
||||
df[which(df$type == "high_dosage"), ]$original_txt,
|
||||
NA_character_))
|
||||
}
|
||||
out <- do.call("rbind", lapply(lst, as.data.frame, stringsAsFactors = FALSE))
|
||||
rownames(out) <- NULL
|
||||
out$ab <- ab
|
||||
out$name <- ab_name(ab, language = NULL)
|
||||
out
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
#' @param include_unknown logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code `"UNKNOWN"`, which defaults to `FALSE`. For WHONET users, this means that all records with organism code `"con"` (*contamination*) will be excluded at default. Isolates with a microbial ID of `NA` will always be excluded as first isolate.
|
||||
#' @param ... arguments passed on to [first_isolate()] when using [filter_first_isolate()], or arguments passed on to [key_antibiotics()] when using [filter_first_weighted_isolate()]
|
||||
#' @details
|
||||
#' These functions are context-aware when used inside `dplyr` verbs, such as `filter()`, `mutate()` and `summarise()`. This means that then the `x` argument can be left blank, see *Examples*.
|
||||
#' These functions are context-aware. This means that then the `x` argument can be left blank, see *Examples*.
|
||||
#'
|
||||
#' The [first_isolate()] function is a wrapper around the [is_new_episode()] function, but more efficient for data sets containing microorganism codes or names.
|
||||
#'
|
||||
@ -96,7 +96,7 @@
|
||||
#' **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition**, 2014, *Clinical and Laboratory Standards Institute (CLSI)*. <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a dataset available in the AMR package.
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' # basic filtering on first isolates
|
||||
@ -172,20 +172,20 @@ first_isolate <- function(x,
|
||||
col_keyantibiotics <- NULL
|
||||
}
|
||||
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)
|
||||
meet_criteria(episode_days, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(testcodes_exclude, allow_class = "character", allow_NULL = TRUE)
|
||||
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(type, allow_class = "character", has_length = 1)
|
||||
meet_criteria(ignore_I, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(points_threshold, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(points_threshold, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(include_unknown, allow_class = "logical", has_length = 1)
|
||||
|
||||
dots <- unlist(list(...))
|
||||
if (length(dots) != 0) {
|
||||
# backwards compatibility with old arguments
|
||||
dots.names <- dots %pm>% names()
|
||||
dots.names <- names(dots)
|
||||
if ("filter_specimen" %in% dots.names) {
|
||||
specimen_group <- dots[which(dots.names == "filter_specimen")]
|
||||
}
|
||||
|
@ -61,7 +61,7 @@
|
||||
#' @rdname ggplot_pca
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # `example_isolates` is a dataset available in the AMR package.
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' # See ?pca for more info about Principal Component Analysis (PCA).
|
||||
@ -109,26 +109,26 @@ ggplot_pca <- function(x,
|
||||
|
||||
stop_ifnot_installed("ggplot2")
|
||||
meet_criteria(x, allow_class = c("prcomp", "princomp", "PCA", "lda"))
|
||||
meet_criteria(choices, allow_class = c("numeric", "integer"), has_length = 2)
|
||||
meet_criteria(choices, allow_class = c("numeric", "integer"), has_length = 2, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(scale, allow_class = c("numeric", "integer", "logical"), has_length = 1)
|
||||
meet_criteria(pc.biplot, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(labels, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(labels_textsize, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(labels_text_placement, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(labels_textsize, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(labels_text_placement, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(groups, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(ellipse, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(ellipse_prob, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(ellipse_size, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(ellipse_alpha, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(points_size, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(points_alpha, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(ellipse_prob, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(ellipse_size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(ellipse_alpha, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(points_size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(points_alpha, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(arrows, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(arrows_colour, allow_class = "character", has_length = 1)
|
||||
meet_criteria(arrows_size, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(arrows_textsize, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(arrows_size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(arrows_textsize, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(arrows_textangled, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(arrows_alpha, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(base_textsize, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(arrows_alpha, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(base_textsize, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
|
||||
calculations <- pca_calculations(pca_model = x,
|
||||
groups = groups,
|
||||
|
@ -180,12 +180,12 @@ ggplot_rsi <- function(data,
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(nrow, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(nrow, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(colours, allow_class = c("character", "logical"))
|
||||
meet_criteria(datalabels, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(datalabels.size, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(datalabels.size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(datalabels.colour, allow_class = "character", has_length = 1)
|
||||
meet_criteria(title, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(subtitle, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
@ -279,7 +279,7 @@ geom_rsi <- function(position = NULL,
|
||||
meet_criteria(x, allow_class = "character", has_length = 1)
|
||||
meet_criteria(fill, allow_class = "character", has_length = 1)
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
@ -327,7 +327,7 @@ facet_rsi <- function(facet = c("interpretation", "antibiotic"), nrow = NULL) {
|
||||
facet <- facet[1]
|
||||
stop_ifnot_installed("ggplot2")
|
||||
meet_criteria(facet, allow_class = "character", has_length = 1)
|
||||
meet_criteria(nrow, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(nrow, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
|
||||
|
||||
# we work with aes_string later on
|
||||
facet_deparse <- deparse(substitute(facet))
|
||||
@ -414,11 +414,11 @@ labels_rsi_count <- function(position = NULL,
|
||||
meet_criteria(position, allow_class = "character", has_length = 1, is_in = c("fill", "stack", "dodge"), allow_NULL = TRUE)
|
||||
meet_criteria(x, allow_class = "character", has_length = 1)
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(datalabels.size, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(datalabels.size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(datalabels.colour, allow_class = "character", has_length = 1)
|
||||
|
||||
if (is.null(position)) {
|
||||
|
@ -27,7 +27,7 @@
|
||||
#'
|
||||
#' These function can be used to determine first isolates (see [first_isolate()]). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates can then be called first 'weighted' isolates.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a [data.frame] with antibiotics columns, like `AMX` or `amox`. Can be left blank when used inside `dplyr` verbs, such as `filter()`, `mutate()` and `summarise()`.
|
||||
#' @param x a [data.frame] with antibiotics columns, like `AMX` or `amox`. Can be left blank to determine automatically
|
||||
#' @param y,z character vectors to compare
|
||||
#' @inheritParams first_isolate
|
||||
#' @param universal_1,universal_2,universal_3,universal_4,universal_5,universal_6 column names of **broad-spectrum** antibiotics, case-insensitive. See details for which antibiotics will be used at default (which are guessed with [guess_ab_col()]).
|
||||
@ -36,7 +36,7 @@
|
||||
#' @param warnings give a warning about missing antibiotic columns (they will be ignored)
|
||||
#' @param ... other arguments passed on to functions
|
||||
#' @details
|
||||
#' The [key_antibiotics()] function is context-aware when used inside `dplyr` verbs, such as `filter()`, `mutate()` and `summarise()`. This means that then the `x` argument can be left blank, see *Examples*.
|
||||
#' The [key_antibiotics()] function is context-aware. This means that then the `x` argument can be left blank, see *Examples*.
|
||||
#'
|
||||
#' The function [key_antibiotics()] returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using [key_antibiotics_equal()], to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (`"."`) by [key_antibiotics()] and ignored by [key_antibiotics_equal()].
|
||||
#'
|
||||
@ -77,7 +77,7 @@
|
||||
#' @seealso [first_isolate()]
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a dataset available in the AMR package.
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' # output of the `key_antibiotics()` function could be like this:
|
||||
@ -158,7 +158,7 @@ key_antibiotics <- function(x,
|
||||
dots <- unlist(list(...))
|
||||
if (length(dots) != 0) {
|
||||
# backwards compatibility with old arguments
|
||||
dots.names <- dots %pm>% names()
|
||||
dots.names <- names(dots)
|
||||
if ("info" %in% dots.names) {
|
||||
warnings <- dots[which(dots.names == "info")]
|
||||
}
|
||||
@ -291,7 +291,7 @@ key_antibiotics_equal <- function(y,
|
||||
meet_criteria(z, allow_class = "character")
|
||||
meet_criteria(type, allow_class = "character", has_length = c(1, 2))
|
||||
meet_criteria(ignore_I, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(points_threshold, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(points_threshold, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
|
||||
stop_ifnot(length(y) == length(z), "length of `y` and `z` must be equal")
|
||||
|
4
R/mdro.R
4
R/mdro.R
@ -37,7 +37,7 @@
|
||||
#' @param verbose a logical to turn Verbose mode on and off (default is off). In Verbose mode, the function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.
|
||||
#' @inheritSection eucast_rules Antibiotics
|
||||
#' @details
|
||||
#' These functions are context-aware when used inside `dplyr` verbs, such as `filter()`, `mutate()` and `summarise()`. This means that then the `x` argument can be left blank, see *Examples*.
|
||||
#' These functions are context-aware. This means that then the `x` argument can be left blank, see *Examples*.
|
||||
#'
|
||||
#' For the `pct_required_classes` argument, values above 1 will be divided by 100. This is to support both fractions (`0.75` or `3/4`) and percentages (`75`).
|
||||
#'
|
||||
@ -108,7 +108,7 @@
|
||||
#' #> 43 891 1066
|
||||
#' ```
|
||||
#'
|
||||
#' The rules set (the `custom` object in this case) could be exported to a shared file location using [saveRDS()] if you collaborate with multiple users. The custom rules set could then be imported using [readRDS()],
|
||||
#' The rules set (the `custom` object in this case) could be exported to a shared file location using [saveRDS()] if you collaborate with multiple users. The custom rules set could then be imported using [readRDS()].
|
||||
#' @inheritSection as.rsi Interpretation of R and S/I
|
||||
#' @return
|
||||
#' - CMI 2012 paper - function [mdr_cmi2012()] or [mdro()]:\cr
|
||||
|
2
R/mic.R
2
R/mic.R
@ -62,7 +62,7 @@ as.mic <- function(x, na.rm = FALSE) {
|
||||
if (is.mic(x)) {
|
||||
x
|
||||
} else {
|
||||
x <- x %pm>% unlist()
|
||||
x <- unlist(x)
|
||||
if (na.rm == TRUE) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
|
13
R/mo.R
13
R/mo.R
@ -1546,7 +1546,7 @@ exec_as.mo <- function(x,
|
||||
message_(word_wrap("- Try to use as many valid taxonomic names as possible for your input.",
|
||||
extra_indent = 2),
|
||||
as_note = FALSE)
|
||||
message_(word_wrap("- Save the output and use it as input for future calculations, e.g. create a new variable to your data using `as.mo()`. All functions in this package that rely on microorganism codes will automatically use that new column where possible. All `mo_*()` functions also do not require you to set their `x` argument as long as you have the dplyr package installed and you have a column of class <mo>.",
|
||||
message_(word_wrap("- Save the output and use it as input for future calculations, e.g. create a new variable to your data using `as.mo()`. All functions in this package that rely on microorganism codes will automatically use that new column where possible. All `mo_*()` functions also do not require you to set their `x` argument as long as you have a column of class <mo>.",
|
||||
extra_indent = 2),
|
||||
as_note = FALSE)
|
||||
message_(word_wrap("- Use `set_mo_source()` to continually transform your organisation codes to microorganisms codes used by this package, see `?mo_source`.",
|
||||
@ -2016,3 +2016,14 @@ repair_reference_df <- function(reference_df) {
|
||||
reference_df[, "mo"] <- as.mo(reference_df[, "mo", drop = TRUE])
|
||||
reference_df
|
||||
}
|
||||
|
||||
strip_words <- function(text, n, side = "right") {
|
||||
out <- lapply(strsplit(x, " "), function(x) {
|
||||
if (side %like% "^r" & length(x) > n) {
|
||||
x[seq_len(length(x) - n)]
|
||||
} else if (side %like% "^l" & length(x) > n) {
|
||||
x[2:length(x)]
|
||||
}
|
||||
})
|
||||
vapply(FUN.VALUE = character(1), out, paste, collapse = " ")
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
"', for which your permission is needed.")),
|
||||
"\n\n",
|
||||
word_wrap("Do you agree that this file will be created?"))
|
||||
if ("rsasdtudioapi" %in% rownames(utils::installed.packages())) {
|
||||
showQuestion <- import_fn("showQuestion", "rstudioapi")
|
||||
showQuestion <- import_fn("showQuestion", "rstudioapi", error_on_fail = FALSE)
|
||||
if (!is.null(showQuestion)) {
|
||||
q_continue <- showQuestion("Create new file in home directory", txt)
|
||||
} else {
|
||||
q_continue <- utils::menu(choices = c("OK", "Cancel"), graphics = FALSE, title = txt)
|
||||
|
2
R/pca.R
2
R/pca.R
@ -38,7 +38,7 @@
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a dataset available in the AMR package.
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' \donttest{
|
||||
|
@ -129,10 +129,10 @@ resistance_predict <- function(x,
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(col_ab, allow_class = "character", has_length = 1, is_in = colnames(x))
|
||||
meet_criteria(col_date, allow_class = "character", has_length = 1, is_in = colnames(x), allow_NULL = TRUE)
|
||||
meet_criteria(year_min, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(year_max, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(year_every, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(year_min, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(year_max, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(year_every, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(model, allow_class = c("character", "function"), has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(I_as_S, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(preserve_measurements, allow_class = "logical", has_length = 1)
|
||||
@ -143,7 +143,7 @@ resistance_predict <- function(x,
|
||||
dots <- unlist(list(...))
|
||||
if (length(dots) != 0) {
|
||||
# backwards compatibility with old arguments
|
||||
dots.names <- dots %pm>% names()
|
||||
dots.names <- names(dots)
|
||||
if ("tbl" %in% dots.names) {
|
||||
x <- dots[which(dots.names == "tbl")]
|
||||
}
|
||||
|
6
R/rsi.R
6
R/rsi.R
@ -29,7 +29,7 @@
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @rdname as.rsi
|
||||
#' @param x vector of values (for class [`mic`]: an MIC value in mg/L, for class [`disk`]: a disk diffusion radius in millimetres)
|
||||
#' @param mo any (vector of) text that can be coerced to a valid microorganism code with [as.mo()], will be determined automatically if the `dplyr` package is installed
|
||||
#' @param mo any (vector of) text that can be coerced to a valid microorganism code with [as.mo()], can be left empty to determine it automatically
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial code with [as.ab()]
|
||||
#' @param uti (Urinary Tract Infection) A vector with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.rsi()] on a [data.frame], this can also be a column containing [logical]s or when left blank, the data set will be searched for a 'specimen' and rows containing 'urin' (such as 'urine', 'urina') in that column will be regarded isolates from a UTI. See *Examples*.
|
||||
#' @inheritParams first_isolate
|
||||
@ -479,7 +479,7 @@ as.rsi.data.frame <- function(x,
|
||||
uti = NULL,
|
||||
conserve_capped_values = FALSE,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
reference_data = rsi_translation) {
|
||||
reference_data = AMR::rsi_translation) {
|
||||
meet_criteria(x, allow_class = "data.frame") # will also check for dimensions > 0
|
||||
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
@ -994,7 +994,7 @@ plot.rsi <- function(x,
|
||||
main = paste("Resistance Overview of", deparse(substitute(x))),
|
||||
axes = FALSE,
|
||||
...) {
|
||||
meet_criteria(lwd, allow_class = c("numeric", "integer"), has_length = 1)
|
||||
meet_criteria(lwd, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(ylim, allow_class = c("numeric", "integer"), allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
|
@ -37,7 +37,7 @@ rsi_calc <- function(...,
|
||||
only_all_tested = FALSE,
|
||||
only_count = FALSE) {
|
||||
meet_criteria(ab_result, allow_class = c("character", "numeric", "integer"), has_length = c(1, 2, 3), .call_depth = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, .call_depth = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE, .call_depth = 1)
|
||||
meet_criteria(as_percent, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(only_all_tested, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(only_count, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
@ -191,7 +191,7 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
meet_criteria(data, allow_class = "data.frame", contains_column_class = "rsi", .call_depth = 1)
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE, .call_depth = 1)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, .call_depth = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE, .call_depth = 1)
|
||||
meet_criteria(as_percent, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(combine_SI_missing, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
42d032c419117561e5c4b5b402e16f01
|
||||
58d6a0589aea598420e37045fb04a5ae
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,19 +14,20 @@
|
||||
"AMP" "Ampicillin" "standard_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 11
|
||||
"SAM" "Ampicillin/sulbactam" "high_dosage" "2 g + 1 g" 4 "iv" "" "(2 g ampicillin + 1 g sulbactam) x 4 iv" 11
|
||||
"SAM" "Ampicillin/sulbactam" "standard_dosage" "2 g + 1 g" 3 "iv" "" "(2 g ampicillin + 1 g sulbactam) x 3 iv" 11
|
||||
"AZM" "Azithromycin" "standard_dosage" "0.5 g" 1 "oral" "or 0.5 g x 1 iv" "0.5 g x 1 oral or 0.5 g x 1 iv" 11
|
||||
"AZM" "Azithromycin" "standard_dosage" "0.5 g" 1 "iv" "" "0.5 g x 1 iv" 11
|
||||
"AZM" "Azithromycin" "standard_dosage" "0.5 g" 1 "oral" "" "0.5 g x 1 oral" 11
|
||||
"ATM" "Aztreonam" "high_dosage" "2 g" 4 "iv" "" "2 g x 4 iv" 11
|
||||
"ATM" "Aztreonam" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3 iv" 11
|
||||
"PEN" "Benzylpenicillin" "high_dosage" "1.2 g" 4 "iv" "" "1.2 g (2 MU) x 4-6 iv" 11
|
||||
"PEN" "Benzylpenicillin" "standard_dosage" "0.6 g" 4 "iv" "" "0.6 g (1 MU) x 4 iv" 11
|
||||
"CEC" "Cefaclor" "high_dosage" "1 g" 3 "oral" "" "1 g x 3 oral" 11
|
||||
"CEC" "Cefaclor" "standard_dosage" "0.25-0.5 g" 3 "oral" "depending on species and/or infection type" "0.25-0.5 g x 3 oral depending on species and/or infection type" 11
|
||||
"CEC" "Cefaclor" "standard_dosage" "0.25-0.5 g" 3 "oral" "" "0.25-0.5 g x 3 oral" 11
|
||||
"CFR" "Cefadroxil" "standard_dosage" "0.5-1 g" 2 "oral" "" "0.5-1 g x 2 oral" 11
|
||||
"CFR" "Cefadroxil" "uncomplicated_uti" "0.5-1 g" 2 "oral" "" "0.5-1 g x 2 oral" 11
|
||||
"CZO" "Cefazolin" "high_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 11
|
||||
"CZO" "Cefazolin" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3 iv" 11
|
||||
"FEP" "Cefepime" "high_dosage" "2 g" 3 "iv" "" "2 g x 3 iv" 11
|
||||
"FEP" "Cefepime" "standard_dosage" "1 g" 3 "iv" "or 2 g x 2 iv" "1 g x 3 iv or 2 g x 2 iv" 11
|
||||
"FEP" "Cefepime" "standard_dosage" "2 g" 2 "iv" "" "2 g x 2 iv" 11
|
||||
"FDC" "Cefiderocol" "standard_dosage" "2 g" 3 "iv" "over 3 hours" "2 g x 3 iv over 3 hours" 11
|
||||
"CFM" "Cefixime" "standard_dosage" "0.2-0.4 g" 2 "oral" "" "0.2-0.4 g x 2 oral" 11
|
||||
"CFM" "Cefixime" "uncomplicated_uti" "0.2-0.4 g" 2 "oral" "" "0.2-0.4 g x 2 oral" 11
|
||||
@ -36,14 +37,14 @@
|
||||
"CPD" "Cefpodoxime" "uncomplicated_uti" "0.1-0.2 g" 2 "oral" "" "0.1-0.2 g x 2 oral" 11
|
||||
"CPT" "Ceftaroline" "high_dosage" "0.6 g" 3 "iv" "over 2 hours" "0.6 g x 3 iv over 2 hours" 11
|
||||
"CPT" "Ceftaroline" "standard_dosage" "0.6 g" 2 "iv" "over 1 hour" "0.6 g x 2 iv over 1 hour" 11
|
||||
"CAZ" "Ceftazidime" "high_dosage" "2 g" 3 "iv" "or 1 g x 6 iv" "2 g x 3 iv or 1 g x 6 iv" 11
|
||||
"CAZ" "Ceftazidime" "high_dosage" "1 g" 6 "iv" "" "1 g x 6 iv" 11
|
||||
"CAZ" "Ceftazidime" "standard_dosage" "1 g" 3 "iv" "" "1 g x 3 iv" 11
|
||||
"CZA" "Ceftazidime/avibactam" "standard_dosage" "2 g + 0.5 g" 3 "iv" "over 2 hours" "(2 g ceftazidime + 0.5 g avibactam) x 3 iv over 2 hours" 11
|
||||
"CTB" "Ceftibuten" "standard_dosage" "0.4 g" 1 "oral" "" "0.4 g x 1 oral" 11
|
||||
"BPR" "Ceftobiprole" "standard_dosage" "0.5 g" 3 "iv" "over 2 hours" "0.5 g x 3 iv over 2 hours" 11
|
||||
"CZT" "Ceftolozane/tazobactam" "standard_dosage" "1 g + 0.5 g" 3 "iv" "over 1 hour" "(1 g ceftolozane + 0.5 g tazobactam) x 3 iv over 1 hour" 11
|
||||
"CZT" "Ceftolozane/tazobactam" "standard_dosage" "2 g + 1 g" 3 "iv" "over 1 hour" "(2 g ceftolozane + 1 g tazobactam) x 3 iv over 1 hour" 11
|
||||
"CRO" "Ceftriaxone" "high_dosage" "2 g" 2 "iv" "or 4 g x 1 iv" "2 g x 2 iv or 4 g x 1 iv" 11
|
||||
"CRO" "Ceftriaxone" "high_dosage" "4 g" 1 "iv" "" "4 g x 1 iv" 11
|
||||
"CRO" "Ceftriaxone" "standard_dosage" "2 g" 1 "iv" "" "2 g x 1 iv" 11
|
||||
"CXM" "Cefuroxime" "high_dosage" "1.5 g" 3 "iv" "" "1.5 g x 3 iv" 11
|
||||
"CXM" "Cefuroxime" "standard_dosage" "0.75 g" 3 "iv" "" "0.75 g x 3 iv" 11
|
||||
@ -52,70 +53,100 @@
|
||||
"CXM" "Cefuroxime" "uncomplicated_uti" "0.25 g" 2 "oral" "" "0.25 g x 2 oral" 11
|
||||
"LEX" "Cephalexin" "standard_dosage" "0.25-1 g" 2 "oral" "" "0.25-1 g x 2-3 oral" 11
|
||||
"LEX" "Cephalexin" "uncomplicated_uti" "0.25-1 g" 2 "oral" "" "0.25-1 g x 2-3 oral" 11
|
||||
"CHL" "Chloramphenicol" "high_dosage" "2 g" 4 "oral" "or 2 g x 4 iv" "2 g x 4 oral or 2 g x 4 iv" 11
|
||||
"CHL" "Chloramphenicol" "standard_dosage" "1 g" 4 "oral" "or 1 g x 4 iv" "1 g x 4 oral or 1 g x 4 iv" 11
|
||||
"CIP" "Ciprofloxacin" "high_dosage" "0.75 g" 2 "oral" "or 0.4 g x 3 iv" "0.75 g x 2 oral or 0.4 g x 3 iv" 11
|
||||
"CIP" "Ciprofloxacin" "standard_dosage" "0.5 g" 2 "oral" "or 0.4 g x 2 iv" "0.5 g x 2 oral or 0.4 g x 2 iv" 11
|
||||
"CHL" "Chloramphenicol" "high_dosage" "2 g" 4 "iv" "" "2 g x 4 iv" 11
|
||||
"CHL" "Chloramphenicol" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 11
|
||||
"CHL" "Chloramphenicol" "high_dosage" "2 g" 4 "oral" "" "2 g x 4 oral" 11
|
||||
"CHL" "Chloramphenicol" "standard_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 11
|
||||
"CIP" "Ciprofloxacin" "high_dosage" "0.4 g" 3 "iv" "" "0.4 g x 3 iv" 11
|
||||
"CIP" "Ciprofloxacin" "standard_dosage" "0.4 g" 2 "iv" "" "0.4 g x 2 iv" 11
|
||||
"CIP" "Ciprofloxacin" "high_dosage" "0.75 g" 2 "oral" "" "0.75 g x 2 oral" 11
|
||||
"CIP" "Ciprofloxacin" "standard_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 11
|
||||
"CLR" "Clarithromycin" "high_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 11
|
||||
"CLR" "Clarithromycin" "standard_dosage" "0.25 g" 2 "oral" "" "0.25 g x 2 oral" 11
|
||||
"CLI" "Clindamycin" "high_dosage" "0.3 g" 4 "oral" "or 0.9 g x 3 iv" "0.3 g x 4 oral or 0.9 g x 3 iv" 11
|
||||
"CLI" "Clindamycin" "standard_dosage" "0.3 g" 2 "oral" "or 0.6 g x 3 iv" "0.3 g x 2 oral or 0.6 g x 3 iv" 11
|
||||
"CLO" "Cloxacillin" "high_dosage" "1 g" 4 "oral" "or 2 g x 6 iv" "1 g x 4 oral or 2 g x 6 iv" 11
|
||||
"CLO" "Cloxacillin" "standard_dosage" "0.5 g" 4 "oral" "or 1 g x 4 iv" "0.5 g x 4 oral or 1 g x 4 iv" 11
|
||||
"CLI" "Clindamycin" "high_dosage" "0.9 g" 3 "iv" "" "0.9 g x 3 iv" 11
|
||||
"CLI" "Clindamycin" "standard_dosage" "0.6 g" 3 "iv" "" "0.6 g x 3 iv" 11
|
||||
"CLI" "Clindamycin" "high_dosage" "0.3 g" 4 "oral" "" "0.3 g x 4 oral" 11
|
||||
"CLI" "Clindamycin" "standard_dosage" "0.3 g" 2 "oral" "" "0.3 g x 2 oral" 11
|
||||
"CLO" "Cloxacillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 11
|
||||
"CLO" "Cloxacillin" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 11
|
||||
"CLO" "Cloxacillin" "high_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 11
|
||||
"CLO" "Cloxacillin" "standard_dosage" "0.5 g" 4 "oral" "" "0.5 g x 4 oral" 11
|
||||
"COL" "Colistin" "standard_dosage" "4.5 MU" 2 "iv" "loading dose of 9 MU" "4.5 MU x 2 iv with a loading dose of 9 MU" 11
|
||||
"DAL" "Dalbavancin" "standard_dosage" "1 g" 1 "iv" "over 30 minutes on day 8" "1 g x 1 iv over 30 minutes on day 1 If needed, 0.5 g x 1 iv over 30 minutes on day 8" 11
|
||||
"DAP" "Daptomycin" "standard_dosage" "4 mg/kg" 1 "iv" "" "4 mg/kg x 1 iv" 11
|
||||
"DAP" "Daptomycin" "standard_dosage" "6 mg/kg" 1 "iv" "" "6 mg/kg x 1 iv" 11
|
||||
"DFX" "Delafloxacin" "standard_dosage" "0.45 g" 2 "oral" "or 0.3 g x 2 iv" "0.45 g x 2 oral or 0.3 g x 2 iv" 11
|
||||
"DIC" "Dicloxacillin" "high_dosage" "2 g" 4 "oral" "or 2 g x 6 iv" "2 g x 4 oral or 2 g x 6 iv" 11
|
||||
"DIC" "Dicloxacillin" "standard_dosage" "0.5-1 g" 4 "oral" "or 1 g x 4 iv" "0.5-1 g x 4 oral or 1 g x 4 iv" 11
|
||||
"DFX" "Delafloxacin" "standard_dosage" "0.3 g" 2 "iv" "" "0.3 g x 2 iv" 11
|
||||
"DFX" "Delafloxacin" "standard_dosage" "0.45 g" 2 "oral" "" "0.45 g x 2 oral" 11
|
||||
"DIC" "Dicloxacillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 11
|
||||
"DIC" "Dicloxacillin" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 11
|
||||
"DIC" "Dicloxacillin" "high_dosage" "2 g" 4 "oral" "" "2 g x 4 oral" 11
|
||||
"DIC" "Dicloxacillin" "standard_dosage" "0.5-1 g" 4 "oral" "" "0.5-1 g x 4 oral" 11
|
||||
"DOR" "Doripenem" "high_dosage" "1 g" 3 "iv" "over 1 hour" "1 g x 3 iv over 1 hour" 11
|
||||
"DOR" "Doripenem" "standard_dosage" "0.5 g" 3 "iv" "over 1 hour" "0.5 g x 3 iv over 1 hour" 11
|
||||
"DOX" "Doxycycline" "high_dosage" "0.2 g" 1 "oral" "" "0.2 g x 1 oral" 11
|
||||
"DOX" "Doxycycline" "standard_dosage" "0.1 g" 1 "oral" "" "0.1 g x 1 oral" 11
|
||||
"ERV" "Eravacycline" "standard_dosage" "1 mg/kg" 2 "iv" "" "1 mg/kg x 2 iv" 11
|
||||
"ETP" "Ertapenem" "standard_dosage" "1 g" 1 "iv" "over 30 minutes" "1 g x 1 iv over 30 minutes" 11
|
||||
"ERY" "Erythromycin" "high_dosage" "1 g" 4 "oral" "or 1 g x 4 iv" "1 g x 4 oral or 1 g x 4 iv" 11
|
||||
"ERY" "Erythromycin" "standard_dosage" "0.5 g" 2 "oral" "or 0.5 g x 2-4 iv" "0.5 g x 2-4 oral or 0.5 g x 2-4 iv" 11
|
||||
"ERY" "Erythromycin" "high_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 11
|
||||
"ERY" "Erythromycin" "standard_dosage" "0.5 g" 2 "iv" "" "0.5 g x 2-4 iv" 11
|
||||
"ERY" "Erythromycin" "high_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 11
|
||||
"ERY" "Erythromycin" "standard_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2-4 oral" 11
|
||||
"FDX" "Fidaxomicin" "standard_dosage" "0.2 g" 2 "oral" "" "0.2 g x 2 oral" 11
|
||||
"FLC" "Flucloxacillin" "high_dosage" "1 g" 4 "oral" "or 2 g x 6 iv" "1 g x 4 oral or 2 g x 6 iv" 11
|
||||
"FLC" "Flucloxacillin" "standard_dosage" "1 g" 3 "oral" "or 2 g x 4 iv (or 1 g x 6 iv)" "1 g x 3 oral or 2 g x 4 iv (or 1 g x 6 iv)" 11
|
||||
"FLC" "Flucloxacillin" "high_dosage" "2 g" 6 "iv" "" "2 g x 6 iv" 11
|
||||
"FLC" "Flucloxacillin" "standard_dosage" "2 g" 4 "iv" "" "2 g x 4 iv (or 1 g x 6 iv)" 11
|
||||
"FLC" "Flucloxacillin" "high_dosage" "1 g" 4 "oral" "" "1 g x 4 oral" 11
|
||||
"FLC" "Flucloxacillin" "standard_dosage" "1 g" 3 "oral" "" "1 g x 3 oral" 11
|
||||
"FOS" "Fosfomycin" "high_dosage" "8 g" 3 "iv" "" "8 g x 3 iv" 11
|
||||
"FOS" "Fosfomycin" "standard_dosage" "4 g" 3 "iv" "" "4 g x 3 iv" 11
|
||||
"FUS" "Fusidic acid" "high_dosage" "0.5 g" 3 "oral" "or 0.5 g x 3 iv" "0.5 g x 3 oral or 0.5 g x 3 iv" 11
|
||||
"FUS" "Fusidic acid" "standard_dosage" "0.5 g" 2 "oral" "or 0.5 g x 2 iv" "0.5 g x 2 oral or 0.5 g x 2 iv" 11
|
||||
"FUS" "Fusidic acid" "high_dosage" "0.5 g" 3 "iv" "" "0.5 g x 3 iv" 11
|
||||
"FUS" "Fusidic acid" "standard_dosage" "0.5 g" 2 "iv" "" "0.5 g x 2 iv" 11
|
||||
"FUS" "Fusidic acid" "high_dosage" "0.5 g" 3 "oral" "" "0.5 g x 3 oral" 11
|
||||
"FUS" "Fusidic acid" "standard_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 11
|
||||
"GEN" "Gentamicin" "standard_dosage" "6-7 mg/kg" 1 "iv" "" "6-7 mg/kg x 1 iv" 11
|
||||
"IPM" "Imipenem" "high_dosage" "1 g" 4 "iv" "over 30 minutes" "1 g x 4 iv over 30 minutes" 11
|
||||
"IPM" "Imipenem" "standard_dosage" "0.5 g" 4 "iv" "over 30 minutes" "0.5 g x 4 iv over 30 minutes" 11
|
||||
"IMR" "Imipenem/relebactam" "standard_dosage" "0.5 g + 0.25 g" 4 "iv" "over 30 minutes" "(0.5 g imipenem + 0.25 g relebactam) x 4 iv over 30 minutes" 11
|
||||
"IMR" "Imipenem/relebactam" "standard_dosage" "0.5 g + 0.25 g" 4 "iv" "over 30 minutes" "(0.5 g imipenem + 0.25 g relebactam) x 4 iv over 30 minutes" 11
|
||||
"LMU" "Lefamulin" "standard_dosage" "0.15 g" 2 "iv" "or 0.6 g x 2 oral" "0.15 g x 2 iv or 0.6 g x 2 oral" 11
|
||||
"LVX" "Levofloxacin" "high_dosage" "0.5 g" 2 "oral" "or 0.5 g x 2 iv" "0.5 g x 2 oral or 0.5 g x 2 iv" 11
|
||||
"LVX" "Levofloxacin" "standard_dosage" "0.5 g" 1 "oral" "or 0.5 g x 1 iv" "0.5 g x 1 oral or 0.5 g x 1 iv" 11
|
||||
"LNZ" "Linezolid" "standard_dosage" "0.6 g" 2 "oral" "or 0.6 g x 2 iv" "0.6 g x 2 oral or 0.6 g x 2 iv" 11
|
||||
"LMU" "Lefamulin" "standard_dosage" "0.6 g" 2 "oral" "" "0.6 g x 2 oral" 11
|
||||
"LVX" "Levofloxacin" "high_dosage" "0.5 g" 2 "iv" "" "0.5 g x 2 iv" 11
|
||||
"LVX" "Levofloxacin" "standard_dosage" "0.5 g" 1 "iv" "" "0.5 g x 1 iv" 11
|
||||
"LVX" "Levofloxacin" "high_dosage" "0.5 g" 2 "oral" "" "0.5 g x 2 oral" 11
|
||||
"LVX" "Levofloxacin" "standard_dosage" "0.5 g" 1 "oral" "" "0.5 g x 1 oral" 11
|
||||
"LNZ" "Linezolid" "standard_dosage" "0.6 g" 2 "iv" "" "0.6 g x 2 iv" 11
|
||||
"LNZ" "Linezolid" "standard_dosage" "0.6 g" 2 "oral" "" "0.6 g x 2 oral" 11
|
||||
"MEM" "Meropenem" "high_dosage" "2 g" 3 "iv" "over 3 hours" "2 g x 3 iv over 3 hours" 11
|
||||
"MEM" "Meropenem" "standard_dosage" "1 g" 3 "iv" "over 30 minutes" "1 g x 3 iv over 30 minutes" 11
|
||||
"MEV" "Meropenem/vaborbactam" "standard_dosage" "2 g + 2 g" 3 "iv" "over 3 hours" "(2 g meropenem + 2 g vaborbactam) x 3 iv over 3 hours" 11
|
||||
"MTR" "Metronidazole" "high_dosage" "0.5 g" 3 "oral" "or 0.5 g x 3 iv" "0.5 g x 3 oral or 0.5 g x 3 iv" 11
|
||||
"MTR" "Metronidazole" "standard_dosage" "0.4 g" 3 "oral" "or 0.4 g x 3 iv" "0.4 g x 3 oral or 0.4 g x 3 iv" 11
|
||||
"MTR" "Metronidazole" "high_dosage" "0.5 g" 3 "iv" "" "0.5 g x 3 iv" 11
|
||||
"MTR" "Metronidazole" "standard_dosage" "0.4 g" 3 "iv" "" "0.4 g x 3 iv" 11
|
||||
"MTR" "Metronidazole" "high_dosage" "0.5 g" 3 "oral" "" "0.5 g x 3 oral" 11
|
||||
"MTR" "Metronidazole" "standard_dosage" "0.4 g" 3 "oral" "" "0.4 g x 3 oral" 11
|
||||
"MNO" "Minocycline" "standard_dosage" "0.1 g" 2 "oral" "" "0.1 g x 2 oral" 11
|
||||
"MFX" "Moxifloxacin" "standard_dosage" "0.4 g" 1 "oral" "or 0.4 g x 1 iv" "0.4 g x 1 oral or 0.4 g x 1 iv" 11
|
||||
"OFX" "Ofloxacin" "high_dosage" "0.4 g" 2 "oral" "or 0.4 g x 2 iv" "0.4 g x 2 oral or 0.4 g x 2 iv" 11
|
||||
"OFX" "Ofloxacin" "standard_dosage" "0.2 g" 2 "oral" "or 0.2 g x 2 iv" "0.2 g x 2 oral or 0.2 g x 2 iv" 11
|
||||
"MFX" "Moxifloxacin" "standard_dosage" "0.4 g" 1 "iv" "" "0.4 g x 1 iv" 11
|
||||
"MFX" "Moxifloxacin" "standard_dosage" "0.4 g" 1 "oral" "" "0.4 g x 1 oral" 11
|
||||
"OFX" "Ofloxacin" "high_dosage" "0.4 g" 2 "iv" "" "0.4 g x 2 iv" 11
|
||||
"OFX" "Ofloxacin" "standard_dosage" "0.2 g" 2 "iv" "" "0.2 g x 2 iv" 11
|
||||
"OFX" "Ofloxacin" "high_dosage" "0.4 g" 2 "oral" "" "0.4 g x 2 oral" 11
|
||||
"OFX" "Ofloxacin" "standard_dosage" "0.2 g" 2 "oral" "" "0.2 g x 2 oral" 11
|
||||
"ORI" "Oritavancin" "standard_dosage" "1.2 g" 1 "iv" "" "1.2 g x 1 (single dose) iv over 3 hours" 11
|
||||
"OXA" "Oxacillin" "high_dosage" "1 g" 6 "iv" "" "1 g x 6 iv" 11
|
||||
"OXA" "Oxacillin" "standard_dosage" "1 g" 4 "iv" "" "1 g x 4 iv" 11
|
||||
"PHN" "Phenoxymethylpenicillin" "standard_dosage" "0.5-2 g" 3 "oral" "depending on species and/or infection type" "0.5-2 g x 3-4 oral depending on species and/or infection type" 11
|
||||
"PHN" "Phenoxymethylpenicillin" "standard_dosage" "0.5-2 g" 3 "oral" "" "0.5-2 g x 3-4 oral" 11
|
||||
"PIP" "Piperacillin" "high_dosage" "4 g" 4 "iv" "" "4 g x 4 iv by extended 3-hour infusion" 11
|
||||
"PIP" "Piperacillin" "standard_dosage" "4 g" 4 "iv" "" "4 g x 4 iv" 11
|
||||
"TZP" "Piperacillin/tazobactam" "high_dosage" "4 g + 0.5 g" 4 "iv" "" "(4 g piperacillin + 0.5 g tazobactam) x 4 iv by extended 3-hour infusion" 11
|
||||
"TZP" "Piperacillin/tazobactam" "standard_dosage" "4 g + 0.5 g" 4 "iv" "" "(4 g piperacillin + 0.5 g tazobactam) x 4 iv or x 3 by extended 4-hour infusion" 11
|
||||
"QDA" "Quinupristin/dalfopristin" "high_dosage" "7.5 mg/kg" 3 "iv" "" "7.5 mg/kg x 3 iv" 11
|
||||
"QDA" "Quinupristin/dalfopristin" "standard_dosage" "7.5 mg/kg" 2 "iv" "" "7.5 mg/kg x 2 iv" 11
|
||||
"RIF" "Rifampicin" "high_dosage" "0.6 g" 2 "oral" "or 0.6 g x 2 iv" "0.6 g x 2 oral or 0.6 g x 2 iv" 11
|
||||
"RIF" "Rifampicin" "standard_dosage" "0.6 g" 1 "oral" "or 0.6 g x 1 iv" "0.6 g x 1 oral or 0.6 g x 1 iv" 11
|
||||
"RIF" "Rifampicin" "high_dosage" "0.6 g" 2 "iv" "" "0.6 g x 2 iv" 11
|
||||
"RIF" "Rifampicin" "standard_dosage" "0.6 g" 1 "iv" "" "0.6 g x 1 iv" 11
|
||||
"RIF" "Rifampicin" "high_dosage" "0.6 g" 2 "oral" "" "0.6 g x 2 oral" 11
|
||||
"RIF" "Rifampicin" "standard_dosage" "0.6 g" 1 "oral" "" "0.6 g x 1 oral" 11
|
||||
"RXT" "Roxithromycin" "standard_dosage" "0.15 g" 2 "oral" "" "0.15 g x 2 oral" 11
|
||||
"SPT" "Spectinomycin" "standard_dosage" "2 g" 1 "im" "" "2 g x 1 im" 11
|
||||
"TZD" "Tedizolid" "standard_dosage" "0.2 g" 1 "oral" "or 0.2 g x 1 iv" "0.2 g x 1 oral or 0.2 g x 1 iv" 11
|
||||
"TZD" "Tedizolid" "standard_dosage" "0.2 g" 1 "iv" "" "0.2 g x 1 iv" 11
|
||||
"TZD" "Tedizolid" "standard_dosage" "0.2 g" 1 "oral" "" "0.2 g x 1 oral" 11
|
||||
"TEC" "Teicoplanin" "high_dosage" "0.8 g" 1 "iv" "" "0.8 g x 1 iv" 11
|
||||
"TEC" "Teicoplanin" "standard_dosage" "0.4 g" 1 "iv" "" "0.4 g x 1 iv" 11
|
||||
"TLV" "Telavancin" "standard_dosage" "10 mg/kg" 1 "iv" "over 1 hour" "10 mg/kg x 1 iv over 1 hour" 11
|
||||
@ -130,7 +161,10 @@
|
||||
"TCC" "Ticarcillin/clavulanic acid" "standard_dosage" "3 g + 0.1-0.2 g" 4 "iv" "" "(3 g ticarcillin + 0.1-0.2 g clavulanic acid) x 4 iv" 11
|
||||
"TGC" "Tigecycline" "standard_dosage" "0.1 g" "loading dose followed by 50 mg x 2 iv" "0.1 g loading dose followed by 50 mg x 2 iv" 11
|
||||
"TOB" "Tobramycin" "standard_dosage" "6-7 mg/kg" 1 "iv" "" "6-7 mg/kg x 1 iv" 11
|
||||
"SXT" "Trimethoprim/sulfamethoxazole" "high_dosage" "0.24 g + 1.2 g" 2 "oral" "" "(0.24 g trimethoprim + 1.2 g sulfamethoxazole) x 2 oral" 11
|
||||
"SXT" "Trimethoprim/sulfamethoxazole" "high_dosage" "0.24 g + 1.2 g" 2 "oral" "" "(0.24 g trimethoprim + 1.2 g sulfamethoxazole) x 2 oral or (0.24 g trimethoprim + 1.2 g sulfamethoxazole) x 2 iv" 11
|
||||
"SXT" "Trimethoprim/sulfamethoxazole" "standard_dosage" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral" 11
|
||||
"SXT" "Trimethoprim/sulfamethoxazole" "standard_dosage" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral or (0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 iv" 11
|
||||
"SXT" "Trimethoprim/sulfamethoxazole" "uncomplicated_uti" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral" 11
|
||||
"VAN" "Vancomycin" "standard_dosage" "0.5 g" 4 "iv" "or 1 g x 2 iv or 2 g x 1 by continuous infusion" "0.5 g x 4 iv or 1 g x 2 iv or 2 g x 1 by continuous infusion" 11
|
||||
"SXT" "Trimethoprim/sulfamethoxazole" "uncomplicated_uti" "0.16 g + 0.8 g" 2 "oral" "" "(0.16 g trimethoprim + 0.8 g sulfamethoxazole) x 2 oral" 11
|
||||
"VAN" "Vancomycin" "standard_dosage" "1 g" 2 "iv" "" "1 g x 2 iv or 2 g x 1 by continuous infusion" 11
|
||||
|
Binary file not shown.
@ -409,6 +409,9 @@ genus_species is Moraxella catarrhalis NAL S fluoroquinolones S Expert Rules on
|
||||
genus_species is Moraxella catarrhalis NAL R fluoroquinolones R Expert Rules on Moraxella catarrhalis Expert Rules 3.2
|
||||
genus is Campylobacter ERY S CLR, AZM S Expert Rules on Campylobacter Expert Rules 3.2
|
||||
genus_species is Campylobacter ERY R CLR, AZM R Expert Rules on Campylobacter Expert Rules 3.2
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter (braakii|freundii|gillenii|murliniae|rodenticum|sedlakii|werkmanii|youngae)|Hafnia alvei|Serratia|Morganella morganii|Providencia) CTX S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter (braakii|freundii|gillenii|murliniae|rodenticum|sedlakii|werkmanii|youngae)|Hafnia alvei|Serratia|Morganella morganii|Providencia) CRO S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter (braakii|freundii|gillenii|murliniae|rodenticum|sedlakii|werkmanii|youngae)|Hafnia alvei|Serratia|Morganella morganii|Providencia) CAZ S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter braakii|Citrobacter freundii|Citrobacter gillenii|Citrobacter murliniae|Citrobacter rodenticum|Citrobacter sedlakii|Citrobacter werkmanii|Citrobacter youngae|Hafnia alvei|Serratia|Morganella morganii|Providencia) CTX S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter braakii|Citrobacter freundii|Citrobacter gillenii|Citrobacter murliniae|Citrobacter rodenticum|Citrobacter sedlakii|Citrobacter werkmanii|Citrobacter youngae|Hafnia alvei|Serratia|Morganella morganii|Providencia) CRO S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter braakii|Citrobacter freundii|Citrobacter gillenii|Citrobacter murliniae|Citrobacter rodenticum|Citrobacter sedlakii|Citrobacter werkmanii|Citrobacter youngae|Hafnia alvei|Serratia|Morganella morganii|Providencia) CAZ S CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter braakii|Citrobacter freundii|Citrobacter gillenii|Citrobacter murliniae|Citrobacter rodenticum|Citrobacter sedlakii|Citrobacter werkmanii|Citrobacter youngae|Hafnia alvei|Serratia|Morganella morganii|Providencia) CTX I CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter braakii|Citrobacter freundii|Citrobacter gillenii|Citrobacter murliniae|Citrobacter rodenticum|Citrobacter sedlakii|Citrobacter werkmanii|Citrobacter youngae|Hafnia alvei|Serratia|Morganella morganii|Providencia) CRO I CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
fullname like ^(Enterobacter|Klebsiella aerogenes|Citrobacter braakii|Citrobacter freundii|Citrobacter gillenii|Citrobacter murliniae|Citrobacter rodenticum|Citrobacter sedlakii|Citrobacter werkmanii|Citrobacter youngae|Hafnia alvei|Serratia|Morganella morganii|Providencia) CAZ I CTX, CRO, CAZ Expert Rules on Enterobacterales (AmpC de-repressed cephalosporins) Expert Rules 3.2 This is rule 3 and 4 of EUCAST Expert Rules v3.2 on Enterobacterales, result will be set with the 'ampc_derepressed_cephalosporins' argument
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 96.
|
@ -44,6 +44,28 @@ dosage_source <- read_excel("data-raw/Dosages_v_11.0_Breakpoint_Tables.xlsx", sk
|
||||
mutate(ab = as.ab(drug),
|
||||
ab_name = ab_name(ab, language = NULL))
|
||||
|
||||
dosage_source <- bind_rows(
|
||||
# oral
|
||||
dosage_source %>%
|
||||
filter(standard_dosage %like% " oral") %>%
|
||||
mutate(standard_dosage = gsub("oral.*", "oral", standard_dosage),
|
||||
high_dosage = if_else(high_dosage %like% "oral",
|
||||
gsub("oral.*", "oral", high_dosage),
|
||||
NA_character_)),
|
||||
# iv
|
||||
dosage_source %>%
|
||||
filter(standard_dosage %like% " iv") %>%
|
||||
mutate(standard_dosage = gsub(".* or ", "", standard_dosage),
|
||||
high_dosage = if_else(high_dosage %like% "( or | iv)",
|
||||
gsub(".* or ", "", high_dosage),
|
||||
NA_character_)),
|
||||
# im
|
||||
dosage_source %>%
|
||||
filter(standard_dosage %like% " im")
|
||||
) %>%
|
||||
arrange(drug)
|
||||
|
||||
|
||||
get_dosage_lst <- function(col_data) {
|
||||
standard <- col_data %>%
|
||||
# remove new lines
|
||||
@ -90,6 +112,7 @@ standard <- get_dosage_lst(dosage_source$standard_dosage)
|
||||
high <- get_dosage_lst(dosage_source$high_dosage)
|
||||
uti <- get_dosage_lst(dosage_source$uncomplicated_uti)
|
||||
dosage <- bind_rows(
|
||||
# standard dose
|
||||
data.frame(
|
||||
ab = dosage_source$ab,
|
||||
name = dosage_source$ab_name,
|
||||
@ -101,6 +124,7 @@ dosage <- bind_rows(
|
||||
original_txt = sapply(standard, function(x) x$original_txt),
|
||||
stringsAsFactors = FALSE
|
||||
),
|
||||
# high dose
|
||||
data.frame(
|
||||
ab = dosage_source$ab,
|
||||
name = dosage_source$ab_name,
|
||||
@ -112,6 +136,7 @@ dosage <- bind_rows(
|
||||
original_txt = sapply(high, function(x) x$original_txt),
|
||||
stringsAsFactors = FALSE
|
||||
),
|
||||
# UTIs
|
||||
data.frame(
|
||||
ab = dosage_source$ab,
|
||||
name = dosage_source$ab_name,
|
||||
@ -124,8 +149,11 @@ dosage <- bind_rows(
|
||||
stringsAsFactors = FALSE
|
||||
)) %>%
|
||||
mutate(eucast_version = breakpoints_version,
|
||||
dose_times = as.integer(dose_times)) %>%
|
||||
dose_times = as.integer(dose_times),
|
||||
administration = gsub("([a-z]+) .*", "\\1", administration)) %>%
|
||||
arrange(name, administration, type) %>%
|
||||
filter(!is.na(dose), dose != ".")
|
||||
filter(!is.na(dose), dose != ".") %>%
|
||||
as.data.frame(stringsAsFactors = FALSE)
|
||||
rownames(dosage) <- NULL
|
||||
|
||||
usethis::use_data(dosage, internal = FALSE, overwrite = TRUE, version = 2)
|
||||
|
BIN
data/dosage.rda
BIN
data/dosage.rda
Binary file not shown.
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.5.0.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -201,15 +201,15 @@
|
||||
|
||||
|
||||
<p>With the function <code><a href="../reference/mdro.html">mdro()</a></code>, you can determine which micro-organisms are multi-drug resistant organisms (MDRO).</p>
|
||||
<div id="type-of-input" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#type-of-input" class="anchor"></a>Type of input</h4>
|
||||
<div id="type-of-input" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#type-of-input" class="anchor"></a>Type of input</h3>
|
||||
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function takes a data set as input, such as a regular <code>data.frame</code>. It tries to automatically determine the right columns for info about your isolates, like the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command <code><a href="../reference/mdro.html">?mdro</a></code>.</p>
|
||||
<p>For WHONET data (and most other data), all settings are automatically set correctly.</p>
|
||||
</div>
|
||||
<div id="guidelines" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#guidelines" class="anchor"></a>Guidelines</h4>
|
||||
<div id="guidelines" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#guidelines" class="anchor"></a>Guidelines</h3>
|
||||
<p>The function support multiple guidelines. You can select a guideline with the <code>guideline</code> parameter. Currently supported guidelines are (case-insensitive):</p>
|
||||
<ul>
|
||||
<li>
|
||||
@ -238,16 +238,44 @@
|
||||
</li>
|
||||
</ul>
|
||||
<p>Please suggest your own (country-specific) guidelines by letting us know: <a href="https://github.com/msberends/AMR/issues/new" class="uri">https://github.com/msberends/AMR/issues/new</a>.</p>
|
||||
</div>
|
||||
<div id="examples" class="section level4">
|
||||
<div id="custom-guidelines" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#examples" class="anchor"></a>Examples</h4>
|
||||
<a href="#custom-guidelines" class="anchor"></a>Custom Guidelines</h4>
|
||||
<p>You can also use your own custom guideline. Custom guidelines can be set with the <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code> function. This is of great importance if you have custom rules to determine MDROs in your hospital, e.g., rules that are dependent on ward, state of contact isolation or other variables in your data.</p>
|
||||
<p>If you are familiar with <code><a href="https://dplyr.tidyverse.org/reference/case_when.html">case_when()</a></code> of the <code>dplyr</code> package, you will recognise the input method to set your own rules. Rules must be set using what considers to be the ‘formula notation’:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">custom</span> <span class="op"><-</span> <span class="fu"><a href="../reference/mdro.html">custom_mdro_guideline</a></span><span class="op">(</span><span class="va">CIP</span> <span class="op">==</span> <span class="st">"R"</span> <span class="op">&</span> <span class="va">age</span> <span class="op">></span> <span class="fl">60</span> <span class="op">~</span> <span class="st">"Elderly Type A"</span>,
|
||||
<span class="va">ERY</span> <span class="op">==</span> <span class="st">"R"</span> <span class="op">&</span> <span class="va">age</span> <span class="op">></span> <span class="fl">60</span> <span class="op">~</span> <span class="st">"Elderly Type B"</span><span class="op">)</span></code></pre></div>
|
||||
<p>If a row/an isolate matches the first rule, the value after the first <code><a href="https://rdrr.io/r/base/tilde.html">~</a></code> (in this case <em>‘Elderly Type A’</em>) will be set as MDRO value. Otherwise, the second rule will be tried and so on. The number of rules is unlimited.</p>
|
||||
<p>You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">custom</span>
|
||||
<span class="co"># A set of custom MDRO rules:</span>
|
||||
<span class="co"># 1. CIP is "R" and age is higher than 60 -> Elderly Type A</span>
|
||||
<span class="co"># 2. ERY is "R" and age is higher than 60 -> Elderly Type B</span>
|
||||
<span class="co"># 3. Otherwise -> Negative</span>
|
||||
<span class="co"># </span>
|
||||
<span class="co"># Unmatched rows will return NA.</span>
|
||||
<span class="co"># Results will be of class <factor>, with ordered levels: Negative < Elderly Type A < Elderly Type B</span></code></pre></div>
|
||||
<p>The outcome of the function can be used for the <code>guideline</code> argument in the [mdro()] function:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">x</span> <span class="op"><-</span> <span class="fu"><a href="../reference/mdro.html">mdro</a></span><span class="op">(</span><span class="va">example_isolates</span>, guideline <span class="op">=</span> <span class="va">custom</span><span class="op">)</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/table.html">table</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||||
<span class="co"># x</span>
|
||||
<span class="co"># Negative Elderly Type A Elderly Type B </span>
|
||||
<span class="co"># 1066 43 891</span></code></pre></div>
|
||||
<p>The rules set (the <code>custom</code> object in this case) could be exported to a shared file location using <code><a href="https://rdrr.io/r/base/readRDS.html">saveRDS()</a></code> if you collaborate with multiple users. The custom rules set could then be imported using <code><a href="https://rdrr.io/r/base/readRDS.html">readRDS()</a></code>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="examples" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#examples" class="anchor"></a>Examples</h3>
|
||||
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code>. For example, the output of the default guideline by Magiorakos <em>et al.</em> returns a <code>factor</code> with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in that order.</p>
|
||||
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span> <span class="co"># to support pipes: %>%</span>
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/msberends/cleaner">cleaner</a></span><span class="op">)</span> <span class="co"># to create frequency tables</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">example_isolates</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="../reference/mdro.html">mdro</a></span><span class="op">(</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="op">)</span> <span class="co"># show frequency table of the result</span>
|
||||
@ -272,23 +300,23 @@ Unique: 2</p>
|
||||
<tr class="odd">
|
||||
<td align="left">1</td>
|
||||
<td align="left">Negative</td>
|
||||
<td align="right">1616</td>
|
||||
<td align="right">92.50%</td>
|
||||
<td align="right">1616</td>
|
||||
<td align="right">92.50%</td>
|
||||
<td align="right">1617</td>
|
||||
<td align="right">92.56%</td>
|
||||
<td align="right">1617</td>
|
||||
<td align="right">92.56%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Multi-drug-resistant (MDR)</td>
|
||||
<td align="right">131</td>
|
||||
<td align="right">7.50%</td>
|
||||
<td align="right">130</td>
|
||||
<td align="right">7.44%</td>
|
||||
<td align="right">1747</td>
|
||||
<td align="right">100.00%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>For another example, I will create a data set to determine multi-drug resistant TB:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="co"># random_rsi() is a helper function to generate</span>
|
||||
<span class="co"># a random vector with values S, I and R</span>
|
||||
<span class="va">my_TB_data</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op">(</span>rifampicin <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
|
||||
@ -299,7 +327,7 @@ Unique: 2</p>
|
||||
moxifloxacin <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
|
||||
kanamycin <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
||||
<p>Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">my_TB_data</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op">(</span>RIF <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
|
||||
INH <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
|
||||
GAT <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
|
||||
@ -308,32 +336,32 @@ Unique: 2</p>
|
||||
MFX <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span>,
|
||||
KAN <span class="op">=</span> <span class="fu"><a href="../reference/random.html">random_rsi</a></span><span class="op">(</span><span class="fl">5000</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
||||
<p>The data set now looks like this:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">)</span>
|
||||
<span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span>
|
||||
<span class="co"># 1 S R S S I R</span>
|
||||
<span class="co"># 2 R I S I S I</span>
|
||||
<span class="co"># 3 I I R S I S</span>
|
||||
<span class="co"># 4 R S R I R S</span>
|
||||
<span class="co"># 5 I R I I I R</span>
|
||||
<span class="co"># 6 I R I R S R</span>
|
||||
<span class="co"># 1 I R I R I I</span>
|
||||
<span class="co"># 2 R R I S R I</span>
|
||||
<span class="co"># 3 I S S I S I</span>
|
||||
<span class="co"># 4 I I R S R I</span>
|
||||
<span class="co"># 5 I R I S S I</span>
|
||||
<span class="co"># 6 S I I I R R</span>
|
||||
<span class="co"># kanamycin</span>
|
||||
<span class="co"># 1 R</span>
|
||||
<span class="co"># 2 I</span>
|
||||
<span class="co"># 3 I</span>
|
||||
<span class="co"># 4 I</span>
|
||||
<span class="co"># 1 I</span>
|
||||
<span class="co"># 2 R</span>
|
||||
<span class="co"># 3 S</span>
|
||||
<span class="co"># 4 R</span>
|
||||
<span class="co"># 5 S</span>
|
||||
<span class="co"># 6 S</span></code></pre></div>
|
||||
<span class="co"># 6 I</span></code></pre></div>
|
||||
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="fu"><a href="../reference/mdro.html">mdro</a></span><span class="op">(</span><span class="va">my_TB_data</span>, guideline <span class="op">=</span> <span class="st">"TB"</span><span class="op">)</span></code></pre></div>
|
||||
<p>or its shortcut <code><a href="../reference/mdro.html">mdr_tb()</a></code>:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">my_TB_data</span><span class="op">$</span><span class="va">mdr</span> <span class="op"><-</span> <span class="fu"><a href="../reference/mdro.html">mdr_tb</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">)</span>
|
||||
<span class="co"># NOTE: No column found as input for `col_mo`, assuming all records contain</span>
|
||||
<span class="co"># Mycobacterium tuberculosis.</span></code></pre></div>
|
||||
<span class="co"># NOTE: No column found as input for `col_mo`, assuming all records</span>
|
||||
<span class="co"># containMycobacterium tuberculosis.</span></code></pre></div>
|
||||
<p>Create a frequency table of the results:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">$</span><span class="va">mdr</span><span class="op">)</span></code></pre></div>
|
||||
<p><strong>Frequency table</strong></p>
|
||||
<p>Class: factor > ordered (numeric)<br>
|
||||
@ -354,40 +382,40 @@ Unique: 5</p>
|
||||
<tr class="odd">
|
||||
<td align="left">1</td>
|
||||
<td align="left">Mono-resistant</td>
|
||||
<td align="right">3286</td>
|
||||
<td align="right">65.72%</td>
|
||||
<td align="right">3286</td>
|
||||
<td align="right">65.72%</td>
|
||||
<td align="right">3228</td>
|
||||
<td align="right">64.56%</td>
|
||||
<td align="right">3228</td>
|
||||
<td align="right">64.56%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Negative</td>
|
||||
<td align="right">992</td>
|
||||
<td align="right">19.84%</td>
|
||||
<td align="right">4278</td>
|
||||
<td align="right">85.56%</td>
|
||||
<td align="right">1017</td>
|
||||
<td align="right">20.34%</td>
|
||||
<td align="right">4245</td>
|
||||
<td align="right">84.90%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">Multi-drug-resistant</td>
|
||||
<td align="right">424</td>
|
||||
<td align="right">8.48%</td>
|
||||
<td align="right">4702</td>
|
||||
<td align="right">94.04%</td>
|
||||
<td align="right">421</td>
|
||||
<td align="right">8.42%</td>
|
||||
<td align="right">4666</td>
|
||||
<td align="right">93.32%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
<td align="left">Poly-resistant</td>
|
||||
<td align="right">214</td>
|
||||
<td align="right">4.28%</td>
|
||||
<td align="right">4916</td>
|
||||
<td align="right">98.32%</td>
|
||||
<td align="right">231</td>
|
||||
<td align="right">4.62%</td>
|
||||
<td align="right">4897</td>
|
||||
<td align="right">97.94%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">5</td>
|
||||
<td align="left">Extensively drug-resistant</td>
|
||||
<td align="right">84</td>
|
||||
<td align="right">1.68%</td>
|
||||
<td align="right">103</td>
|
||||
<td align="right">2.06%</td>
|
||||
<td align="right">5000</td>
|
||||
<td align="right">100.00%</td>
|
||||
</tr>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -193,7 +193,7 @@
|
||||
<h1 data-toc-skip>How to import data from SPSS / SAS / Stata</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">22 January 2021</h4>
|
||||
<h4 class="date">24 January 2021</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/SPSS.Rmd"><code>vignettes/SPSS.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>SPSS.Rmd</code></div>
|
||||
@ -228,7 +228,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>R has a huge community.</strong></p>
|
||||
<p>Many R users just ask questions on websites like <a href="https://stackoverflow.com">StackOverflow.com</a>, the largest online community for programmers. At the time of writing, <a href="https://stackoverflow.com/questions/tagged/r?sort=votes">383,346 R-related questions</a> have already been asked on this platform (that covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.</p>
|
||||
<p>Many R users just ask questions on websites like <a href="https://stackoverflow.com">StackOverflow.com</a>, the largest online community for programmers. At the time of writing, <a href="https://stackoverflow.com/questions/tagged/r?sort=votes">384,445 R-related questions</a> have already been asked on this platform (that covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>R understands any data type, including SPSS/SAS/Stata.</strong></p>
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -223,20 +223,20 @@ Since you are one of our users, we would like to know how you use the package an
|
||||
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span>
|
||||
|
||||
<span class="va">example_isolates</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>mo <span class="op">=</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>bacteria <span class="op">=</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</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="reference/mo_property.html">mo_is_gram_negative</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span>ab <span class="op">=</span> <span class="st">"cefotax"</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">mo</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">bacteria</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="co">#> NOTE: Using column 'mo' as input for mo_is_gram_negative()</span>
|
||||
<span class="co">#> NOTE: Using column 'mo' as input for mo_is_intrinsic_resistant()</span>
|
||||
<span class="co">#> NOTE: Determining intrinsic resistance based on 'EUCAST Expert Rules' and</span>
|
||||
<span class="co">#> 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 from 2020.</span>
|
||||
<span class="co">#> 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 (2020).</span>
|
||||
<span class="co">#> Selecting aminoglycosides: 'AMK' (amikacin), 'GEN' (gentamicin), </span>
|
||||
<span class="co">#> 'KAN' (kanamycin), 'TOB' (tobramycin)</span>
|
||||
<span class="co">#> Selecting carbapenems: 'IPM' (imipenem), 'MEM' (meropenem)</span></code></pre></div>
|
||||
<p>With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (<code><a href="reference/mo_property.html">mo_is_gram_negative()</a></code> and <code><a href="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and <code><a href="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <a href="./reference/microorganisms.html">all microorganisms</a> and <a href="./reference/antibiotics.html">all antibiotics</a> in the <code>AMR</code> package make sure you get what you meant:</p>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="left">mo</th>
|
||||
<th align="left">bacteria</th>
|
||||
<th align="center">AMK</th>
|
||||
<th align="center">GEN</th>
|
||||
<th align="center">KAN</th>
|
||||
@ -256,6 +256,24 @@ Since you are one of our users, we would like to know how you use the package an
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left"><em>Pseudomonas aeruginosa</em></td>
|
||||
<td align="center"></td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center"></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left"><em>Pseudomonas aeruginosa</em></td>
|
||||
<td align="center"></td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center"></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left"><em>Pseudomonas aeruginosa</em></td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
@ -299,14 +317,32 @@ Since you are one of our users, we would like to know how you use the package an
|
||||
<td align="center"></td>
|
||||
<td align="center">S</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left"><em>Pseudomonas aeruginosa</em></td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center"></td>
|
||||
<td align="center">S</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left"><em>Pseudomonas aeruginosa</em></td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>A base R equivalent would be:</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="va">example_isolates</span><span class="op">$</span><span class="va">mo</span> <span class="op"><-</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">$</span><span class="va">mo</span><span class="op">)</span>
|
||||
<code class="sourceCode R"><span class="va">example_isolates</span><span class="op">$</span><span class="va">bacteria</span> <span class="op"><-</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">$</span><span class="va">mo</span><span class="op">)</span>
|
||||
<span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/which.html">which</a></span><span class="op">(</span><span class="fu"><a href="reference/mo_property.html">mo_is_gram_negative</a></span><span class="op">(</span><span class="op">)</span> <span class="op">&</span>
|
||||
<span class="fu"><a href="reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span>ab <span class="op">=</span> <span class="st">"cefotax"</span><span class="op">)</span><span class="op">)</span>,
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"mo"</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">]</span></code></pre></div>
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"bacteria"</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">]</span></code></pre></div>
|
||||
</div>
|
||||
<div id="partners" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -236,13 +236,13 @@
|
||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1509009" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.5.0.9009">
|
||||
<a href="#amr-1509009" class="anchor"></a>AMR 1.5.0.9009<small> Unreleased </small>
|
||||
<div id="amr-1509012" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.5.0.9012">
|
||||
<a href="#amr-1509012" class="anchor"></a>AMR 1.5.0.9012<small> Unreleased </small>
|
||||
</h1>
|
||||
<div id="last-updated-22-january-2021" class="section level2">
|
||||
<div id="last-updated-25-january-2021" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-22-january-2021" class="anchor"></a><small>Last updated: 22 January 2021</small>
|
||||
<a href="#last-updated-25-january-2021" class="anchor"></a><small>Last updated: 25 January 2021</small>
|
||||
</h2>
|
||||
<div id="new" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -288,6 +288,8 @@
|
||||
<li>Fix for verbose output of <code><a href="../reference/mdro.html">mdro(..., verbose = TRUE)</a></code> for German guideline (3MGRN and 4MGRN) and Dutch guideline (BRMO, only <em>P. aeruginosa</em>)</li>
|
||||
<li>
|
||||
<code><a href="../reference/as.rsi.html">is.rsi.eligible()</a></code> now returns <code>FALSE</code> immediately if the input does not contain any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.</li>
|
||||
<li>Functions <code><a href="../reference/get_episode.html">get_episode()</a></code> and <code><a href="../reference/get_episode.html">is_new_episode()</a></code> now support less than a day as value for argument <code>episode_days</code> (e.g., to include one patient/test per hour)</li>
|
||||
<li>Argument <code>ampc_cephalosporin_resistance</code> in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> now also applies to value “I” (not only “S”)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other" class="section level3">
|
||||
@ -295,7 +297,7 @@
|
||||
<a href="#other" class="anchor"></a>Other</h3>
|
||||
<ul>
|
||||
<li>Big documentation updates</li>
|
||||
<li>Loading the package (i.e., <code><a href="https://msberends.github.io/AMR/">library(AMR)</a></code>) now is ~50 times faster than before</li>
|
||||
<li>Loading the package (i.e., <code><a href="https://msberends.github.io/AMR/">library(AMR)</a></code>) now is ~50 times faster than before, in costs of package size (increased with ~3 MB)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,7 +12,7 @@ articles:
|
||||
datasets: datasets.html
|
||||
resistance_predict: resistance_predict.html
|
||||
welcome_to_AMR: welcome_to_AMR.html
|
||||
last_built: 2021-01-22T09:54Z
|
||||
last_built: 2021-01-25T20:57Z
|
||||
urls:
|
||||
reference: https://msberends.github.io/AMR//reference
|
||||
article: https://msberends.github.io/AMR//articles
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -306,7 +306,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<div class='dont-index'><p><code><a href='filter_ab_class.html'>filter_ab_class()</a></code> for the <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> equivalent.</p></div>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'># this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):</span>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -282,7 +282,7 @@
|
||||
uti <span class='op'>=</span> <span class='cn'>NULL</span>,
|
||||
conserve_capped_values <span class='op'>=</span> <span class='cn'>FALSE</span>,
|
||||
add_intrinsic_resistance <span class='op'>=</span> <span class='cn'>FALSE</span>,
|
||||
reference_data <span class='op'>=</span> <span class='va'>rsi_translation</span>
|
||||
reference_data <span class='op'>=</span> <span class='fu'>AMR</span><span class='fu'>::</span><span class='va'><a href='rsi_translation.html'>rsi_translation</a></span>
|
||||
<span class='op'>)</span></pre>
|
||||
|
||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||
@ -302,7 +302,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>mo</th>
|
||||
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><a href='as.mo.html'>as.mo()</a></code>, will be determined automatically if the <code>dplyr</code> package is installed</p></td>
|
||||
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><a href='as.mo.html'>as.mo()</a></code>, can be left empty to determine it automatically</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ab</th>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9011</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -247,7 +247,7 @@
|
||||
|
||||
<h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2>
|
||||
|
||||
<p>A <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with 135 observations and 9 variables:</p><ul>
|
||||
<p>A <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with 169 observations and 9 variables:</p><ul>
|
||||
<li><p><code>ab</code><br /> Antibiotic ID as used in this package (such as <code>AMC</code>), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available</p></li>
|
||||
<li><p><code>name</code><br /> Official name of the antimicrobial agent as used by WHONET/EARS-Net or the WHO</p></li>
|
||||
<li><p><code>type</code><br /> Type of the dosage, either "high_dosage", "standard_dosage" or "uncomplicated_uti"</p></li>
|
||||
|
@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -291,7 +291,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ampc_cephalosporin_resistance</th>
|
||||
<td><p>a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to <code>NA</code>. Currently only works when <code>version_expertrules</code> is <code>3.2</code>; '<em>EUCAST Expert Rules v3.2 on Enterobacterales</em>' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of <code>NA</code> for this argument will remove results for these agents, while e.g. a value of <code>"R"</code> will make the results for these agents resistant. Use <code>NULL</code> to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. <br /> For <em>EUCAST Expert Rules</em> v3.2, this rule applies to: <em>Enterobacter, Klebsiella aerogenes, Citrobacter braakii, freundii, gillenii, murliniae, rodenticum, sedlakii, werkmanii, youngae, Hafnia alvei, Serratia, Morganella morganii, Providencia</em>.</p></td>
|
||||
<td><p>a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to <code>NA</code>. Currently only works when <code>version_expertrules</code> is <code>3.2</code>; '<em>EUCAST Expert Rules v3.2 on Enterobacterales</em>' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of <code>NA</code> for this argument will remove results for these agents, while e.g. a value of <code>"R"</code> will make the results for these agents resistant. Use <code>NULL</code> to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. <br /> For <em>EUCAST Expert Rules</em> v3.2, this rule applies to: <em>Citrobacter braakii</em>, <em>Citrobacter freundii</em>, <em>Citrobacter gillenii</em>, <em>Citrobacter murliniae</em>, <em>Citrobacter rodenticum</em>, <em>Citrobacter sedlakii</em>, <em>Citrobacter werkmanii</em>, <em>Citrobacter youngae</em>, <em>Enterobacter</em>, <em>Hafnia alvei</em>, <em>Klebsiella aerogenes</em>, <em>Morganella morganii</em>, <em>Providencia</em> and <em>Serratia</em>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>...</th>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -366,7 +366,7 @@
|
||||
<p>A <code><a href='https://rdrr.io/r/base/logical.html'>logical</a></code> vector</p>
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>These functions are context-aware when used inside <code>dplyr</code> verbs, such as <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code>, <code><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code> and <code><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
|
||||
<p>These functions are context-aware. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
|
||||
<p>The <code>first_isolate()</code> function is a wrapper around the <code><a href='get_episode.html'>is_new_episode()</a></code> function, but more efficient for data sets containing microorganism codes or names.</p>
|
||||
<p>All isolates with a microbial ID of <code>NA</code> will be excluded as first isolate.</p><h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>Why this is so Important</h3>
|
||||
|
||||
@ -419,7 +419,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<div class='dont-index'><p><code><a href='key_antibiotics.html'>key_antibiotics()</a></code></p></div>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'># basic filtering on first isolates</span>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9011</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -255,11 +255,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>episode_days</th>
|
||||
<td><p>length of the required episode in days, see <em>Details</em></p></td>
|
||||
<td><p>required episode length in days, can also be less than a day, see <em>Details</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>...</th>
|
||||
<td><p>arguments passed on to <code><a href='https://rdrr.io/r/base/as.Date.html'>as.Date()</a></code></p></td>
|
||||
<td><p>currently not used</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -293,15 +293,20 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<div class='dont-index'><p><code><a href='first_isolate.html'>first_isolate()</a></code></p></div>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='fu'>get_episode</span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>$</span><span class='va'>date</span>, episode_days <span class='op'>=</span> <span class='fl'>60</span><span class='op'>)</span>
|
||||
<span class='fu'>is_new_episode</span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>$</span><span class='va'>date</span>, episode_days <span class='op'>=</span> <span class='fl'>60</span><span class='op'>)</span>
|
||||
<span class='fu'>get_episode</span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>$</span><span class='va'>date</span>, episode_days <span class='op'>=</span> <span class='fl'>60</span><span class='op'>)</span> <span class='co'># indices</span>
|
||||
<span class='fu'>is_new_episode</span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>$</span><span class='va'>date</span>, episode_days <span class='op'>=</span> <span class='fl'>60</span><span class='op'>)</span> <span class='co'># TRUE/FALSE</span>
|
||||
|
||||
<span class='co'># filter on results from the third 60-day episode only, using base R</span>
|
||||
<span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'><a href='https://rdrr.io/r/base/which.html'>which</a></span><span class='op'>(</span><span class='fu'>get_episode</span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>$</span><span class='va'>date</span>, <span class='fl'>60</span><span class='op'>)</span> <span class='op'>==</span> <span class='fl'>3</span><span class='op'>)</span>, <span class='op'>]</span>
|
||||
|
||||
<span class='co'># the functions also work for less than a day, e.g. to include one per hour:</span>
|
||||
<span class='fu'>get_episode</span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/Sys.time.html'>Sys.time</a></span><span class='op'>(</span><span class='op'>)</span>,
|
||||
<span class='fu'><a href='https://rdrr.io/r/base/Sys.time.html'>Sys.time</a></span><span class='op'>(</span><span class='op'>)</span> <span class='op'>+</span> <span class='fl'>60</span> <span class='op'>*</span> <span class='fl'>60</span><span class='op'>)</span>,
|
||||
episode_days <span class='op'>=</span> <span class='fl'>1</span><span class='op'>/</span><span class='fl'>24</span><span class='op'>)</span>
|
||||
|
||||
<span class='co'># \donttest{</span>
|
||||
<span class='kw'>if</span> <span class='op'>(</span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>require</a></span><span class='op'>(</span><span class='st'><a href='https://dplyr.tidyverse.org'>"dplyr"</a></span><span class='op'>)</span><span class='op'>)</span> <span class='op'>{</span>
|
||||
<span class='co'># is_new_episode() can also be used in dplyr verbs to determine patient</span>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -392,7 +392,7 @@
|
||||
The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing</strong>. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome <a href='https://github.com/msberends/AMR/issues'>to suggest changes at our repository</a> or <a href='AMR.html'>write us an email (see section 'Contact Us')</a>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'># See ?pca for more info about Principal Component Analysis (PCA).</span>
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -281,7 +281,7 @@
|
||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||
<tr>
|
||||
<th>x</th>
|
||||
<td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with antibiotics columns, like <code>AMX</code> or <code>amox</code>. Can be left blank when used inside <code>dplyr</code> verbs, such as <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code>, <code><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code> and <code><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>.</p></td>
|
||||
<td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> with antibiotics columns, like <code>AMX</code> or <code>amox</code>. Can be left blank to determine automatically</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>col_mo</th>
|
||||
@ -331,7 +331,7 @@
|
||||
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>The <code>key_antibiotics()</code> function is context-aware when used inside <code>dplyr</code> verbs, such as <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code>, <code><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code> and <code><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
|
||||
<p>The <code>key_antibiotics()</code> function is context-aware. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
|
||||
<p>The function <code>key_antibiotics()</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal()</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>) by <code>key_antibiotics()</code> and ignored by <code>key_antibiotics_equal()</code>.</p>
|
||||
<p>The <code><a href='first_isolate.html'>first_isolate()</a></code> function only uses this function on the same microbial species from the same patient. Using this, e.g. an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) is found within the same patient episode. Without key antibiotic comparison it would not. See <code><a href='first_isolate.html'>first_isolate()</a></code> for more info.</p>
|
||||
<p>At default, the antibiotics that are used for <strong>Gram-positive bacteria</strong> are:</p><ul>
|
||||
@ -393,7 +393,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<div class='dont-index'><p><code><a href='first_isolate.html'>first_isolate()</a></code></p></div>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'># output of the `key_antibiotics()` function could be like this:</span>
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -325,7 +325,7 @@ Ordered <a href='https://rdrr.io/r/base/factor.html'>factor</a> with levels <cod
|
||||
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>These functions are context-aware when used inside <code>dplyr</code> verbs, such as <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code>, <code><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code> and <code><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
|
||||
<p>These functions are context-aware. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
|
||||
<p>For the <code>pct_required_classes</code> argument, values above 1 will be divided by 100. This is to support both fractions (<code>0.75</code> or <code>3/4</code>) and percentages (<code>75</code>).</p>
|
||||
<p><strong>Note:</strong> Every test that involves the Enterobacteriaceae family, will internally be performed using its newly named <em>order</em> Enterobacterales, since the Enterobacteriaceae family has been taxonomically reclassified by Adeolu <em>et al.</em> in 2016. Before that, Enterobacteriaceae was the only family under the Enterobacteriales (with an i) order. All species under the old Enterobacteriaceae family are still under the new Enterobacterales (without an i) order, but divided into multiple families. The way tests are performed now by this <code>mdro()</code> function makes sure that results from before 2016 and after 2016 are identical.</p>
|
||||
<h2 class="hasAnchor" id="supported-international-national-guidelines"><a class="anchor" href="#supported-international-national-guidelines"></a>Supported International / National Guidelines</h2>
|
||||
@ -375,7 +375,7 @@ Ordered <a href='https://rdrr.io/r/base/factor.html'>factor</a> with levels <cod
|
||||
<span class='co'>#> 43 891 1066 </span>
|
||||
</pre>
|
||||
|
||||
<p>The rules set (the <code>custom</code> object in this case) could be exported to a shared file location using <code><a href='https://rdrr.io/r/base/readRDS.html'>saveRDS()</a></code> if you collaborate with multiple users. The custom rules set could then be imported using <code><a href='https://rdrr.io/r/base/readRDS.html'>readRDS()</a></code>,</p>
|
||||
<p>The rules set (the <code>custom</code> object in this case) could be exported to a shared file location using <code><a href='https://rdrr.io/r/base/readRDS.html'>saveRDS()</a></code> if you collaborate with multiple users. The custom rules set could then be imported using <code><a href='https://rdrr.io/r/base/readRDS.html'>readRDS()</a></code>.</p>
|
||||
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9010</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -324,7 +324,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
|
||||
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
|
||||
<span class='co'># See ?example_isolates.</span>
|
||||
|
||||
<span class='co'># \donttest{</span>
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9009</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9012</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
19
index.md
19
index.md
@ -32,13 +32,13 @@ library(AMR)
|
||||
library(dplyr)
|
||||
|
||||
example_isolates %>%
|
||||
mutate(mo = mo_fullname(mo)) %>%
|
||||
mutate(bacteria = mo_fullname(mo)) %>%
|
||||
filter(mo_is_gram_negative(), mo_is_intrinsic_resistant(ab = "cefotax")) %>%
|
||||
select(mo, aminoglycosides(), carbapenems())
|
||||
select(bacteria, aminoglycosides(), carbapenems())
|
||||
#> NOTE: Using column 'mo' as input for mo_is_gram_negative()
|
||||
#> NOTE: Using column 'mo' as input for mo_is_intrinsic_resistant()
|
||||
#> NOTE: Determining intrinsic resistance based on 'EUCAST Expert Rules' and
|
||||
#> 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 from 2020.
|
||||
#> 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 (2020).
|
||||
#> Selecting aminoglycosides: 'AMK' (amikacin), 'GEN' (gentamicin),
|
||||
#> 'KAN' (kanamycin), 'TOB' (tobramycin)
|
||||
#> Selecting carbapenems: 'IPM' (imipenem), 'MEM' (meropenem)
|
||||
@ -46,23 +46,26 @@ example_isolates %>%
|
||||
|
||||
With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (`mo_is_gram_negative()` and `mo_is_intrinsic_resistant()`) and a column selection on two antibiotic groups (`aminoglycosides()` and `carbapenems()`), the reference data about [all microorganisms](./reference/microorganisms.html) and [all antibiotics](./reference/antibiotics.html) in the `AMR` package make sure you get what you meant:
|
||||
|
||||
|
||||
| mo | AMK | GEN | KAN | TOB | IPM | MEM |
|
||||
|:------------------------------|:---------:|:---------:|:---------:|:---------:|:---------:|:---------:|
|
||||
|bacteria | AMK | GEN | KAN | TOB | IPM | MEM |
|
||||
|:------------------------------|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||
|*Pseudomonas aeruginosa* | | I | R | S | S | |
|
||||
|*Pseudomonas aeruginosa* | | I | R | S | S | |
|
||||
|*Pseudomonas aeruginosa* | | I | R | S | S | |
|
||||
|*Pseudomonas aeruginosa* | S | S | R | S | | S |
|
||||
|*Pseudomonas aeruginosa* | S | S | R | S | S | S |
|
||||
|*Pseudomonas aeruginosa* | S | S | R | S | S | S |
|
||||
|*Stenotrophomonas maltophilia* | R | R | R | R | R | R |
|
||||
|*Pseudomonas aeruginosa* | S | S | R | S | | S |
|
||||
|*Pseudomonas aeruginosa* | S | S | R | S | | S |
|
||||
|*Pseudomonas aeruginosa* | S | S | R | S | S | S |
|
||||
|
||||
A base R equivalent would be:
|
||||
|
||||
```r
|
||||
example_isolates$mo <- mo_fullname(example_isolates$mo)
|
||||
example_isolates$bacteria <- mo_fullname(example_isolates$mo)
|
||||
example_isolates[which(mo_is_gram_negative() &
|
||||
mo_is_intrinsic_resistant(ab = "cefotax")),
|
||||
c("mo", aminoglycosides(), carbapenems())]
|
||||
c("bacteria", aminoglycosides(), carbapenems())]
|
||||
```
|
||||
|
||||
#### Partners
|
||||
|
@ -76,7 +76,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
# this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
||||
|
@ -47,7 +47,7 @@ is.rsi.eligible(x, threshold = 0.05)
|
||||
uti = NULL,
|
||||
conserve_capped_values = FALSE,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
reference_data = rsi_translation
|
||||
reference_data = AMR::rsi_translation
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
@ -57,7 +57,7 @@ is.rsi.eligible(x, threshold = 0.05)
|
||||
|
||||
\item{threshold}{maximum fraction of invalid antimicrobial interpretations of \code{x}, see \emph{Examples}}
|
||||
|
||||
\item{mo}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}, will be determined automatically if the \code{dplyr} package is installed}
|
||||
\item{mo}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}, can be left empty to determine it automatically}
|
||||
|
||||
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial code with \code{\link[=as.ab]{as.ab()}}}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
\alias{dosage}
|
||||
\title{Data Set with Treatment Dosages as Defined by EUCAST}
|
||||
\format{
|
||||
A \link{data.frame} with 135 observations and 9 variables:
|
||||
A \link{data.frame} with 169 observations and 9 variables:
|
||||
\itemize{
|
||||
\item \code{ab}\cr Antibiotic ID as used in this package (such as \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
|
||||
\item \code{name}\cr Official name of the antimicrobial agent as used by WHONET/EARS-Net or the WHO
|
||||
|
@ -46,7 +46,7 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 11)
|
||||
|
||||
\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either "3.2" or "3.1".}
|
||||
|
||||
\item{ampc_cephalosporin_resistance}{a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2}; '\emph{EUCAST Expert Rules v3.2 on Enterobacterales}' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of \code{NA} for this argument will remove results for these agents, while e.g. a value of \code{"R"} will make the results for these agents resistant. Use \code{NULL} to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Enterobacter, Klebsiella aerogenes, Citrobacter braakii, freundii, gillenii, murliniae, rodenticum, sedlakii, werkmanii, youngae, Hafnia alvei, Serratia, Morganella morganii, Providencia}.}
|
||||
\item{ampc_cephalosporin_resistance}{a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2}; '\emph{EUCAST Expert Rules v3.2 on Enterobacterales}' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of \code{NA} for this argument will remove results for these agents, while e.g. a value of \code{"R"} will make the results for these agents resistant. Use \code{NULL} to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia} and \emph{Serratia}.}
|
||||
|
||||
\item{...}{column name of an antibiotic, see section \emph{Antibiotics} below}
|
||||
|
||||
|
@ -93,7 +93,7 @@ A \code{\link{logical}} vector
|
||||
Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type. To determine patient episodes not necessarily based on microorganisms, use \code{\link[=is_new_episode]{is_new_episode()}} that also supports grouping with the \code{dplyr} package.
|
||||
}
|
||||
\details{
|
||||
These functions are context-aware when used inside \code{dplyr} verbs, such as \code{filter()}, \code{mutate()} and \code{summarise()}. This means that then the \code{x} argument can be left blank, see \emph{Examples}.
|
||||
These functions are context-aware. This means that then the \code{x} argument can be left blank, see \emph{Examples}.
|
||||
|
||||
The \code{\link[=first_isolate]{first_isolate()}} function is a wrapper around the \code{\link[=is_new_episode]{is_new_episode()}} function, but more efficient for data sets containing microorganism codes or names.
|
||||
|
||||
@ -148,7 +148,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
# basic filtering on first isolates
|
||||
|
@ -12,9 +12,9 @@ is_new_episode(x, episode_days, ...)
|
||||
\arguments{
|
||||
\item{x}{vector of dates (class \code{Date} or \code{POSIXt})}
|
||||
|
||||
\item{episode_days}{length of the required episode in days, see \emph{Details}}
|
||||
\item{episode_days}{required episode length in days, can also be less than a day, see \emph{Details}}
|
||||
|
||||
\item{...}{arguments passed on to \code{\link[=as.Date]{as.Date()}}}
|
||||
\item{...}{currently not used}
|
||||
}
|
||||
\value{
|
||||
\itemize{
|
||||
@ -46,15 +46,20 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
get_episode(example_isolates$date, episode_days = 60)
|
||||
is_new_episode(example_isolates$date, episode_days = 60)
|
||||
get_episode(example_isolates$date, episode_days = 60) # indices
|
||||
is_new_episode(example_isolates$date, episode_days = 60) # TRUE/FALSE
|
||||
|
||||
# filter on results from the third 60-day episode only, using base R
|
||||
example_isolates[which(get_episode(example_isolates$date, 60) == 3), ]
|
||||
|
||||
# the functions also work for less than a day, e.g. to include one per hour:
|
||||
get_episode(c(Sys.time(),
|
||||
Sys.time() + 60 * 60),
|
||||
episode_days = 1/24)
|
||||
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
# is_new_episode() can also be used in dplyr verbs to determine patient
|
||||
|
@ -115,7 +115,7 @@ The \link[=lifecycle]{lifecycle} of this function is \strong{maturing}. The unly
|
||||
}
|
||||
|
||||
\examples{
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
# See ?pca for more info about Principal Component Analysis (PCA).
|
||||
|
@ -40,7 +40,7 @@ key_antibiotics_equal(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a \link{data.frame} with antibiotics columns, like \code{AMX} or \code{amox}. Can be left blank when used inside \code{dplyr} verbs, such as \code{filter()}, \code{mutate()} and \code{summarise()}.}
|
||||
\item{x}{a \link{data.frame} with antibiotics columns, like \code{AMX} or \code{amox}. Can be left blank to determine automatically}
|
||||
|
||||
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||
|
||||
@ -68,7 +68,7 @@ key_antibiotics_equal(
|
||||
These function can be used to determine first isolates (see \code{\link[=first_isolate]{first_isolate()}}). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates can then be called first 'weighted' isolates.
|
||||
}
|
||||
\details{
|
||||
The \code{\link[=key_antibiotics]{key_antibiotics()}} function is context-aware when used inside \code{dplyr} verbs, such as \code{filter()}, \code{mutate()} and \code{summarise()}. This means that then the \code{x} argument can be left blank, see \emph{Examples}.
|
||||
The \code{\link[=key_antibiotics]{key_antibiotics()}} function is context-aware. This means that then the \code{x} argument can be left blank, see \emph{Examples}.
|
||||
|
||||
The function \code{\link[=key_antibiotics]{key_antibiotics()}} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{\link[=key_antibiotics_equal]{key_antibiotics_equal()}}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}) by \code{\link[=key_antibiotics]{key_antibiotics()}} and ignored by \code{\link[=key_antibiotics_equal]{key_antibiotics_equal()}}.
|
||||
|
||||
@ -135,7 +135,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
# output of the `key_antibiotics()` function could be like this:
|
||||
|
@ -77,7 +77,7 @@ Ordered \link{factor} with levels \code{Negative} < \verb{Positive, unconfirmed}
|
||||
Determine which isolates are multidrug-resistant organisms (MDRO) according to international, national and custom guidelines.
|
||||
}
|
||||
\details{
|
||||
These functions are context-aware when used inside \code{dplyr} verbs, such as \code{filter()}, \code{mutate()} and \code{summarise()}. This means that then the \code{x} argument can be left blank, see \emph{Examples}.
|
||||
These functions are context-aware. This means that then the \code{x} argument can be left blank, see \emph{Examples}.
|
||||
|
||||
For the \code{pct_required_classes} argument, values above 1 will be divided by 100. This is to support both fractions (\code{0.75} or \code{3/4}) and percentages (\code{75}).
|
||||
|
||||
@ -137,7 +137,7 @@ table(x)
|
||||
#> 43 891 1066
|
||||
}
|
||||
|
||||
The rules set (the \code{custom} object in this case) could be exported to a shared file location using \code{\link[=saveRDS]{saveRDS()}} if you collaborate with multiple users. The custom rules set could then be imported using \code{\link[=readRDS]{readRDS()}},
|
||||
The rules set (the \code{custom} object in this case) could be exported to a shared file location using \code{\link[=saveRDS]{saveRDS()}} if you collaborate with multiple users. The custom rules set could then be imported using \code{\link[=readRDS]{readRDS()}}.
|
||||
}
|
||||
|
||||
\section{Stable Lifecycle}{
|
||||
|
@ -71,7 +71,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# `example_isolates` is a data set available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
\donttest{
|
||||
|
@ -21,13 +21,13 @@ library(AMR)
|
||||
|
||||
With the function `mdro()`, you can determine which micro-organisms are multi-drug resistant organisms (MDRO).
|
||||
|
||||
#### Type of input
|
||||
### Type of input
|
||||
|
||||
The `mdro()` function takes a data set as input, such as a regular `data.frame`. It tries to automatically determine the right columns for info about your isolates, like the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command `?mdro`.
|
||||
|
||||
For WHONET data (and most other data), all settings are automatically set correctly.
|
||||
|
||||
#### Guidelines
|
||||
### Guidelines
|
||||
|
||||
The function support multiple guidelines. You can select a guideline with the `guideline` parameter. Currently supported guidelines are (case-insensitive):
|
||||
|
||||
@ -57,7 +57,35 @@ The function support multiple guidelines. You can select a guideline with the `g
|
||||
|
||||
Please suggest your own (country-specific) guidelines by letting us know: <https://github.com/msberends/AMR/issues/new>.
|
||||
|
||||
#### Examples
|
||||
#### Custom Guidelines
|
||||
|
||||
You can also use your own custom guideline. Custom guidelines can be set with the `custom_mdro_guideline()` function. This is of great importance if you have custom rules to determine MDROs in your hospital, e.g., rules that are dependent on ward, state of contact isolation or other variables in your data.
|
||||
|
||||
If you are familiar with `case_when()` of the `dplyr` package, you will recognise the input method to set your own rules. Rules must be set using what \R considers to be the 'formula notation':
|
||||
|
||||
```{r}
|
||||
custom <- custom_mdro_guideline(CIP == "R" & age > 60 ~ "Elderly Type A",
|
||||
ERY == "R" & age > 60 ~ "Elderly Type B")
|
||||
```
|
||||
|
||||
If a row/an isolate matches the first rule, the value after the first `~` (in this case *'Elderly Type A'*) will be set as MDRO value. Otherwise, the second rule will be tried and so on. The number of rules is unlimited.
|
||||
|
||||
You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.
|
||||
|
||||
```{r}
|
||||
custom
|
||||
```
|
||||
|
||||
The outcome of the function can be used for the `guideline` argument in the [mdro()] function:
|
||||
|
||||
```{r}
|
||||
x <- mdro(example_isolates, guideline = custom)
|
||||
table(x)
|
||||
```
|
||||
|
||||
The rules set (the `custom` object in this case) could be exported to a shared file location using `saveRDS()` if you collaborate with multiple users. The custom rules set could then be imported using `readRDS()`.
|
||||
|
||||
### Examples
|
||||
|
||||
The `mdro()` function always returns an ordered `factor`. For example, the output of the default guideline by Magiorakos *et al.* returns a `factor` with levels 'Negative', 'MDR', 'XDR' or 'PDR' in that order.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user