(v0.7.1.9032) eucast_rules() improvements

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-08-09 14:28:46 +02:00
parent 1ce4b72dd2
commit 6a349bf757
33 changed files with 275 additions and 192 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 0.7.1.9031 Version: 0.7.1.9032
Date: 2019-08-08 Date: 2019-08-09
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),

12
NEWS.md
View File

@ -1,4 +1,4 @@
# AMR 0.7.1.9031 # AMR 0.7.1.9032
### Breaking ### Breaking
* Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too. * Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too.
@ -36,8 +36,12 @@
Since this is a major change, usage of the old `also_single_tested` will throw an informative error that it has been replaced by `only_all_tested`. Since this is a major change, usage of the old `also_single_tested` will throw an informative error that it has been replaced by `only_all_tested`.
### Changed ### Changed
* Added more informative errors and warnings to `eucast_rules()` * Function: `eucast_rules()`
* Fixed a bug in `eucast_rules()` for *Yersinia pseudotuberculosis* * Fixed a bug for *Yersinia pseudotuberculosis*
* Added more informative errors and warnings
* Printed info now distinguishes between added and changes values
* Using Verbose mode (i.e. `eucast_rules(..., verbose = TRUE)`) returns more informative and readable output
* Using factors as input now adds missing factors levels when the function changes antibiotic results
* Added tibble printing support for classes `rsi`, `mic`, `ab` and `mo`. When using tibbles containing antibiotic columns, values `S` will print in green, values `I` will print in yellow and values `R` will print in red: * Added tibble printing support for classes `rsi`, `mic`, `ab` and `mo`. When using tibbles containing antibiotic columns, values `S` will print in green, values `I` will print in yellow and values `R` will print in red:
```r ```r
(run this on your own console, as this page does not support colour printing) (run this on your own console, as this page does not support colour printing)
@ -61,9 +65,7 @@
* Deprecated the `country` parameter of `mdro()` in favour of the already existing `guideline` parameter to support multiple guidelines within one country * Deprecated the `country` parameter of `mdro()` in favour of the already existing `guideline` parameter to support multiple guidelines within one country
* The `name` of `RIF` is now Rifampicin instead of Rifampin * The `name` of `RIF` is now Rifampicin instead of Rifampin
* The `antibiotics` data set is now sorted by name * The `antibiotics` data set is now sorted by name
* Using verbose mode with `eucast_rules(..., verbose = TRUE)` returns more informative and readable output
* Speed improvement for `guess_ab_col()` which is now 30 times faster for antibiotic abbreviations * Speed improvement for `guess_ab_col()` which is now 30 times faster for antibiotic abbreviations
* Using factors as input for `eucast_rules()` now adds missing factors levels when the function changes antibiotic results
#### Other #### Other
* Added Dr Bart Meijer, Dr Dennis Souverein and Annick Lenglet as contributors * Added Dr Bart Meijer, Dr Dennis Souverein and Annick Lenglet as contributors

View File

@ -29,7 +29,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' @param x data with antibiotic columns, like e.g. \code{AMX} and \code{AMC} #' @param x data with antibiotic columns, like e.g. \code{AMX} and \code{AMC}
#' @param info print progress #' @param info print progress
#' @param rules a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")} #' @param rules a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")}
#' @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 \code{data.frame} with extensive info about which rows and columns would be effected and in which way. #' @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.
#' @param ... column name of an antibiotic, see section Antibiotics #' @param ... column name of an antibiotic, see section Antibiotics
#' @inheritParams first_isolate #' @inheritParams first_isolate
#' @details #' @details
@ -41,7 +41,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' @section Antibiotics: #' @section Antibiotics:
#' To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning. #' To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
#' #'
#' The following antibiotics are used for the functions \code{\link{eucast_rules}} and \code{\link{mdro}}. These are shown in the format '\strong{antimicrobial ID}: name (\emph{ATC code})', sorted by name: #' The following antibiotics are used for the functions \code{\link{eucast_rules}} and \code{\link{mdro}}. These are shown below in the format '\strong{antimicrobial ID}: name (\emph{ATC code})', sorted by name:
#' #'
#' \strong{AMK}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}), #' \strong{AMK}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}),
#' \strong{AMX}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}), #' \strong{AMX}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}),
@ -175,9 +175,11 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' # 5 Pseudomonas aeruginosa R R - - R R R #' # 5 Pseudomonas aeruginosa R R - - R R R
#' #'
#' #'
#' \donttest{
#' # do not apply EUCAST rules, but rather get a data.frame #' # do not apply EUCAST rules, but rather get a data.frame
#' # with 18 rows, containing all details about the transformations: #' # with 18 rows, containing all details about the transformations:
#' c <- eucast_rules(a, verbose = TRUE) #' c <- eucast_rules(a, verbose = TRUE)
#' }
eucast_rules <- function(x, eucast_rules <- function(x,
col_mo = NULL, col_mo = NULL,
info = TRUE, info = TRUE,
@ -186,7 +188,7 @@ eucast_rules <- function(x,
...) { ...) {
if (verbose == TRUE & interactive()) { if (verbose == TRUE & interactive()) {
txt <- paste0("WARNING: In Verbose mode, the eucast_rules() 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.", txt <- paste0("WARNING: In Verbose mode, the eucast_rules() 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.",
"\n\nThis may overwrite your existing data if you use e.g.:", "\n\nThis may overwrite your existing data if you use e.g.:",
"\ndata <- eucast_rules(data, verbose = TRUE)\n\nDo you want to continue?") "\ndata <- eucast_rules(data, verbose = TRUE)\n\nDo you want to continue?")
if ("rstudioapi" %in% rownames(installed.packages())) { if ("rstudioapi" %in% rownames(installed.packages())) {
@ -202,7 +204,7 @@ eucast_rules <- function(x,
if (!is.data.frame(x)) { if (!is.data.frame(x)) {
stop("`x` must be a data frame.", call. = FALSE) stop("`x` must be a data frame.", call. = FALSE)
} }
# try to find columns based on type # try to find columns based on type
# -- mo # -- mo
if (is.null(col_mo)) { if (is.null(col_mo)) {
@ -211,40 +213,59 @@ eucast_rules <- function(x,
if (is.null(col_mo)) { if (is.null(col_mo)) {
stop("`col_mo` must be set.", call. = FALSE) stop("`col_mo` must be set.", call. = FALSE)
} }
if (!all(rules %in% c("breakpoints", "expert", "other", "all"))) { if (!all(rules %in% c("breakpoints", "expert", "other", "all"))) {
stop("`rules` must be one or more of: 'breakpoints', 'expert', 'other', 'all'.") stop("`rules` must be one or more of: 'breakpoints', 'expert', 'other', 'all'.")
} }
if (is.null(col_mo)) { if (is.null(col_mo)) {
stop("`col_mo` must be set") stop("`col_mo` must be set")
} }
decimal.mark <- getOption("OutDec") decimal.mark <- getOption("OutDec")
big.mark <- ifelse(decimal.mark != ",", ",", ".") big.mark <- ifelse(decimal.mark != ",", ",", ".")
formatnr <- function(x) { formatnr <- function(x) {
trimws(format(x, big.mark = big.mark, decimal.mark = decimal.mark)) trimws(format(x, big.mark = big.mark, decimal.mark = decimal.mark))
} }
warned <- FALSE warned <- FALSE
txt_error <- function() { cat("", bgRed(white(" ERROR ")), "\n\n") } txt_error <- function() { cat("", bgRed(white(" ERROR ")), "\n\n") }
txt_warning <- function() { if (warned == FALSE) { cat("", bgYellow(black(" WARNING "))) }; warned <<- TRUE } txt_warning <- function() { if (warned == FALSE) { cat("", bgYellow(black(" WARNING "))) }; warned <<- TRUE }
txt_ok <- function(no_of_changes) { txt_ok <- function(no_added, no_changed) {
if (warned == FALSE) { if (warned == FALSE) {
if (no_of_changes > 0) { if (no_added + no_changed == 0) {
if (no_of_changes == 1) { cat(green(" (no changes)\n"))
cat(blue(" (1 value changed)\n"))
} else {
cat(blue(paste0(" (", formatnr(no_of_changes), " values changed)\n")))
}
} else { } else {
cat(green(" (no values changed)\n")) # opening
cat(blue(" ("))
# additions
if (no_added > 0) {
if (no_added == 1) {
cat(blue("1 value added"))
} else {
cat(blue(formatnr(no_added), "values added"))
}
}
# separator
if (no_added > 0 & no_changed > 0) {
cat(blue(", "))
}
# changes
if (no_changed > 0) {
if (no_changed == 1) {
cat(blue("1 value changed"))
} else {
cat(blue(formatnr(no_changed), "values changed"))
}
}
# closing
cat(blue(")\n"))
} }
warned <<- FALSE warned <<- FALSE
} }
} }
cols_ab <- get_column_abx(x = x, cols_ab <- get_column_abx(x = x,
soft_dependencies = c("AMC", soft_dependencies = c("AMC",
"AMK", "AMK",
@ -312,7 +333,7 @@ eucast_rules <- function(x,
hard_dependencies = NULL, hard_dependencies = NULL,
verbose = verbose, verbose = verbose,
...) ...)
AMC <- cols_ab['AMC'] AMC <- cols_ab['AMC']
AMK <- cols_ab['AMK'] AMK <- cols_ab['AMK']
AMP <- cols_ab['AMP'] AMP <- cols_ab['AMP']
@ -376,27 +397,27 @@ eucast_rules <- function(x,
TOB <- cols_ab['TOB'] TOB <- cols_ab['TOB']
TZP <- cols_ab['TZP'] TZP <- cols_ab['TZP']
VAN <- cols_ab['VAN'] VAN <- cols_ab['VAN']
ab_missing <- function(ab) { ab_missing <- function(ab) {
all(ab %in% c(NULL, NA)) all(ab %in% c(NULL, NA))
} }
verbose_info <- data.frame(row = integer(0), verbose_info <- data.frame(row = integer(0),
col = character(0), col = character(0),
mo_fullname = character(0), mo_fullname = character(0),
old = character(0), old = as.rsi(character(0)),
new = character(0), new = as.rsi(character(0)),
rule = character(0), rule = character(0),
rule_group = character(0), rule_group = character(0),
rule_name = character(0), rule_name = character(0),
stringsAsFactors = FALSE) stringsAsFactors = FALSE)
# helper function for editing the table # helper function for editing the table
edit_rsi <- function(to, rule, rows, cols) { edit_rsi <- function(to, rule, rows, cols) {
cols <- unique(cols[!is.na(cols) & !is.null(cols)]) cols <- unique(cols[!is.na(cols) & !is.null(cols)])
if (length(rows) > 0 & length(cols) > 0) { if (length(rows) > 0 & length(cols) > 0) {
before_df <- x_original before_df <- x_original
tryCatch( tryCatch(
# insert into original table # insert into original table
x_original[rows, cols] <<- to, x_original[rows, cols] <<- to,
@ -420,7 +441,7 @@ eucast_rules <- function(x,
ifelse(length(rows) > 10, "...", ""), ifelse(length(rows) > 10, "...", ""),
' while writing value "', to, ' while writing value "', to,
'" to column(s) `', paste(cols, collapse = "`, `"), '" to column(s) `', paste(cols, collapse = "`, `"),
"` (data class: ", paste(class(x_original), collapse = "/"), "):\n", e$message), "`:\n", e$message),
call. = FALSE) call. = FALSE)
} }
) )
@ -428,22 +449,23 @@ eucast_rules <- function(x,
tryCatch( tryCatch(
x[rows, cols] <<- x_original[rows, cols], x[rows, cols] <<- x_original[rows, cols],
error = function(e) { error = function(e) {
stop(paste0("Error in row(s) ", paste(rows[1:min(length(rows), 10)], collapse = ","), stop(paste0("In row(s) ", paste(rows[1:min(length(rows), 10)], collapse = ","),
'... while writing value "', to, '... while writing value "', to,
'" to column(s) `', paste(cols, collapse = "`, `"), '" to column(s) `', paste(cols, collapse = "`, `"),
"` (data class:", paste(class(x), collapse = "/"), "):\n", e$message), call. = FALSE) "`:\n", e$message), call. = FALSE)
} }
) )
# before_df might not be a data.frame, but a tibble or data.table instead # before_df might not be a data.frame, but a tibble or data.table instead
old <- as.data.frame(before_df, stringsAsFactors = FALSE)[rows,] old <- as.data.frame(before_df, stringsAsFactors = FALSE)[rows,]
no_of_changes_this_run <- 0 track_changes <- list(added = 0,
changed = 0)
for (i in 1:length(cols)) { for (i in 1:length(cols)) {
verbose_new <- data.frame(row = rows, verbose_new <- data.frame(row = rows,
col = cols[i], col = cols[i],
mo_fullname = x[rows, "fullname"], mo_fullname = x[rows, "fullname"],
old = as.character(old[, cols[i]]), old = as.rsi(as.character(old[, cols[i]]), warn = FALSE),
new = as.character(x[rows, cols[i]]), new = as.rsi(as.character(x[rows, cols[i]])),
rule = strip_style(rule[1]), rule = strip_style(rule[1]),
rule_group = strip_style(rule[2]), rule_group = strip_style(rule[2]),
rule_name = strip_style(rule[3]), rule_name = strip_style(rule[3]),
@ -452,18 +474,21 @@ eucast_rules <- function(x,
verbose_new <- verbose_new %>% filter(old != new | is.na(old)) verbose_new <- verbose_new %>% filter(old != new | is.na(old))
# save changes to data set 'verbose_info' # save changes to data set 'verbose_info'
verbose_info <<- rbind(verbose_info, verbose_new) verbose_info <<- rbind(verbose_info, verbose_new)
no_of_changes_this_run <- no_of_changes_this_run + nrow(verbose_new) # count adds and changes
track_changes$added <- track_changes$added + verbose_new %>% filter(is.na(old)) %>% nrow()
track_changes$changed <- track_changes$changed + verbose_new %>% filter(!is.na(old)) %>% nrow()
} }
# after the applied changes: return number of (new) changes # after the applied changes: return list with counts of added and changed
return(no_of_changes_this_run) return(track_changes)
} }
# no changes were applied: return number of (new) changes: none. # no changes were applied: return number of (new) changes: none.
return(0) return(list(added = 0,
changed = 0))
} }
# save original table # save original table
x_original <- x x_original <- x
# join to microorganisms data set # join to microorganisms data set
suppressWarnings( suppressWarnings(
x <- x %>% x <- x %>%
@ -473,13 +498,13 @@ eucast_rules <- function(x,
genus_species = paste(genus, species)) %>% genus_species = paste(genus, species)) %>%
as.data.frame(stringsAsFactors = FALSE) as.data.frame(stringsAsFactors = FALSE)
) )
if (info == TRUE) { if (info == TRUE) {
cat(paste0( cat(paste0(
"\nRules by the ", bold("European Committee on Antimicrobial Susceptibility Testing (EUCAST)"), "\nRules by the ", bold("European Committee on Antimicrobial Susceptibility Testing (EUCAST)"),
"\n", blue("http://eucast.org/"), "\n")) "\n", blue("http://eucast.org/"), "\n"))
} }
# since ampicillin ^= amoxicillin, get the first from the latter (not in original EUCAST table) # since ampicillin ^= amoxicillin, get the first from the latter (not in original EUCAST table)
if (!ab_missing(AMP) & !ab_missing(AMX)) { if (!ab_missing(AMP) & !ab_missing(AMX)) {
if (verbose == TRUE) { if (verbose == TRUE) {
@ -501,7 +526,7 @@ eucast_rules <- function(x,
message(blue(paste0("NOTE: Using column `", bold(AMX), "` as input for ampicillin (J01CA01) since many EUCAST rules depend on it."))) message(blue(paste0("NOTE: Using column `", bold(AMX), "` as input for ampicillin (J01CA01) since many EUCAST rules depend on it.")))
AMP <- AMX AMP <- AMX
} }
# antibiotic classes # antibiotic classes
aminoglycosides <- c(TOB, GEN, KAN, NEO, NET, SIS) aminoglycosides <- c(TOB, GEN, KAN, NEO, NET, SIS)
tetracyclines <- c(DOX, MNO, TCY) # since EUCAST v3.1 tigecycline (TGC) is set apart tetracyclines <- c(DOX, MNO, TCY) # since EUCAST v3.1 tigecycline (TGC) is set apart
@ -516,7 +541,7 @@ eucast_rules <- function(x,
ureidopenicillins <- c(PIP, TZP, AZL, MEZ) ureidopenicillins <- c(PIP, TZP, AZL, MEZ)
all_betalactams <- c(aminopenicillins, cephalosporins, carbapenems, ureidopenicillins, AMC, OXA, FLC, PEN) all_betalactams <- c(aminopenicillins, cephalosporins, carbapenems, ureidopenicillins, AMC, OXA, FLC, PEN)
fluoroquinolones <- c(OFX, CIP, NOR, LVX, MFX) fluoroquinolones <- c(OFX, CIP, NOR, LVX, MFX)
# Help function to get available antibiotic column names ------------------ # Help function to get available antibiotic column names ------------------
get_antibiotic_columns <- function(x, df) { get_antibiotic_columns <- function(x, df) {
x <- trimws(unlist(strsplit(x, ",", fixed = TRUE))) x <- trimws(unlist(strsplit(x, ",", fixed = TRUE)))
@ -538,11 +563,40 @@ eucast_rules <- function(x,
sort() %>% sort() %>%
paste(collapse = ", ") paste(collapse = ", ")
} }
format_antibiotic_names <- function(ab_names, ab_results) {
ab_names <- trimws(unlist(strsplit(ab_names, ",")))
ab_results <- trimws(unlist(strsplit(ab_results, ",")))
if (length(ab_results) == 1) {
if (length(ab_names) == 1) {
# like FOX S
x <- paste(ab_names, "is")
} else if (length(ab_names) == 2) {
# like PEN,FOX S
x <- paste(paste0(ab_names, collapse = " and "), "are both")
} else {
# like PEN,FOX,GEN S (although dependency on > 2 ABx does not exist at the moment)
x <- paste(paste0(ab_names, collapse = " and "), "are all")
}
return(paste0(x, " '", ab_results, "'"))
} else {
if (length(ab_names) == 2) {
# like PEN,FOX S,R
paste0(ab_names[1], " is '", ab_results[1], "' and ",
ab_names[2], " is '", ab_results[2], "'")
} else {
# like PEN,FOX,GEN S,R,R (although dependency on > 2 ABx does not exist at the moment)
paste0(ab_names[1], " is '", ab_results[1], "' and ",
ab_names[2], " is '", ab_results[2], "' and ",
ab_names[3], " is '", ab_results[3], "'")
}
}
}
eucast_rules_df <- eucast_rules_file # internal data file eucast_rules_df <- eucast_rules_file # internal data file
no_of_changes <- 0 no_added <- 0
no_changed <- 0
for (i in 1:nrow(eucast_rules_df)) { for (i in 1:nrow(eucast_rules_df)) {
rule_previous <- eucast_rules_df[max(1, i - 1), "reference.rule"] rule_previous <- eucast_rules_df[max(1, i - 1), "reference.rule"]
rule_current <- eucast_rules_df[i, "reference.rule"] rule_current <- eucast_rules_df[i, "reference.rule"]
rule_next <- eucast_rules_df[min(nrow(eucast_rules_df), i + 1), "reference.rule"] rule_next <- eucast_rules_df[min(nrow(eucast_rules_df), i + 1), "reference.rule"]
@ -553,7 +607,8 @@ eucast_rules <- function(x,
rule_text <- paste0("always report as '", eucast_rules_df[i, 7], "': ", get_antibiotic_names(eucast_rules_df[i, 6])) rule_text <- paste0("always report as '", eucast_rules_df[i, 7], "': ", get_antibiotic_names(eucast_rules_df[i, 6]))
} else { } else {
rule_text <- paste0("report as '", eucast_rules_df[i, 7], "' when ", rule_text <- paste0("report as '", eucast_rules_df[i, 7], "' when ",
get_antibiotic_names(eucast_rules_df[i, 4]), " is '", eucast_rules_df[i, 5], "': ", format_antibiotic_names(ab_names = get_antibiotic_names(eucast_rules_df[i, 4]),
ab_results = eucast_rules_df[i, 5]), ": ",
get_antibiotic_names(eucast_rules_df[i, 6])) get_antibiotic_names(eucast_rules_df[i, 6]))
} }
if (i == 1) { if (i == 1) {
@ -564,7 +619,7 @@ eucast_rules <- function(x,
rule_next <- "" rule_next <- ""
rule_group_next <- "" rule_group_next <- ""
} }
# don't apply rules if user doesn't want to apply them # don't apply rules if user doesn't want to apply them
if (rule_group_current %like% "breakpoint" & !any(c("all", "breakpoints") %in% rules)) { if (rule_group_current %like% "breakpoint" & !any(c("all", "breakpoints") %in% rules)) {
next next
@ -575,8 +630,8 @@ eucast_rules <- function(x,
if (rule_group_current %like% "other" & !any(c("all", "other") %in% rules)) { if (rule_group_current %like% "other" & !any(c("all", "other") %in% rules)) {
next next
} }
if (info == TRUE) { if (info == TRUE) {
# Print rule (group) ------------------------------------------------------ # Print rule (group) ------------------------------------------------------
if (rule_group_current != rule_group_previous) { if (rule_group_current != rule_group_previous) {
@ -604,11 +659,11 @@ eucast_rules <- function(x,
warned <- FALSE warned <- FALSE
} }
} }
# Get rule from file ------------------------------------------------------ # Get rule from file ------------------------------------------------------
col_mo_property <- eucast_rules_df[i, 1] col_mo_property <- eucast_rules_df[i, 1]
like_is_one_of <- eucast_rules_df[i, 2] like_is_one_of <- eucast_rules_df[i, 2]
# be sure to comprise all coagulase-negative/-positive Staphylococci when they are mentioned # be sure to comprise all coagulase-negative/-positive Staphylococci when they are mentioned
if (eucast_rules_df[i, 3] %like% "coagulase-") { if (eucast_rules_df[i, 3] %like% "coagulase-") {
suppressWarnings( suppressWarnings(
@ -633,7 +688,7 @@ eucast_rules <- function(x,
} }
like_is_one_of <- "like" like_is_one_of <- "like"
} }
if (like_is_one_of == "is") { if (like_is_one_of == "is") {
mo_value <- paste0("^", eucast_rules_df[i, 3], "$") mo_value <- paste0("^", eucast_rules_df[i, 3], "$")
} else if (like_is_one_of == "one_of") { } else if (like_is_one_of == "one_of") {
@ -647,12 +702,12 @@ eucast_rules <- function(x,
} else { } else {
stop("invalid like_is_one_of", call. = FALSE) stop("invalid like_is_one_of", call. = FALSE)
} }
source_antibiotics <- eucast_rules_df[i, 4] source_antibiotics <- eucast_rules_df[i, 4]
source_value <- trimws(unlist(strsplit(eucast_rules_df[i, 5], ",", fixed = TRUE))) source_value <- trimws(unlist(strsplit(eucast_rules_df[i, 5], ",", fixed = TRUE)))
target_antibiotics <- eucast_rules_df[i, 6] target_antibiotics <- eucast_rules_df[i, 6]
target_value <- eucast_rules_df[i, 7] target_value <- eucast_rules_df[i, 7]
if (is.na(source_antibiotics)) { if (is.na(source_antibiotics)) {
rows <- tryCatch(which(x[, col_mo_property] %like% mo_value), rows <- tryCatch(which(x[, col_mo_property] %like% mo_value),
error = function(e) integer(0)) error = function(e) integer(0))
@ -682,24 +737,28 @@ eucast_rules <- function(x,
stop("only 3 antibiotics supported for source_antibiotics ", call. = FALSE) stop("only 3 antibiotics supported for source_antibiotics ", call. = FALSE)
} }
} }
cols <- get_antibiotic_columns(target_antibiotics, x) cols <- get_antibiotic_columns(target_antibiotics, x)
# Apply rule on data ------------------------------------------------------ # Apply rule on data ------------------------------------------------------
# this will return the unique number of changes # this will return the unique number of changes
no_of_changes <- no_of_changes + edit_rsi(to = target_value, run_changes <- edit_rsi(to = target_value,
rule = c(rule_text, rule_group_current, rule_current), rule = c(rule_text, rule_group_current, rule_current),
rows = rows, rows = rows,
cols = cols) cols = cols)
no_added <- no_added + run_changes$added
no_changed <- no_changed + run_changes$changed
# Print number of new changes --------------------------------------------- # Print number of new changes ---------------------------------------------
if (info == TRUE & rule_next != rule_current) { if (info == TRUE & rule_next != rule_current) {
# print only on last one of rules in this group # print only on last one of rules in this group
txt_ok(no_of_changes = no_of_changes) txt_ok(no_added = no_added, no_changed = no_changed)
no_of_changes <- 0 # and reset counters
no_added <- 0
no_changed <- 0
} }
} }
# Print overview ---------------------------------------------------------- # Print overview ----------------------------------------------------------
if (info == TRUE) { if (info == TRUE) {
if (verbose == TRUE) { if (verbose == TRUE) {
@ -707,19 +766,19 @@ eucast_rules <- function(x,
} else { } else {
wouldve <- "" wouldve <- ""
} }
verbose_info <- verbose_info %>% verbose_info <- verbose_info %>%
arrange(row, rule_group, rule_name, col) arrange(row, rule_group, rule_name, col)
cat(paste0("\n", silver(strrep("-", options()$width - 1)), "\n")) cat(paste0("\n", silver(strrep("-", options()$width - 1)), "\n"))
cat(bold(paste('EUCAST rules', paste0(wouldve, 'affected'), cat(bold(paste('EUCAST rules', paste0(wouldve, 'affected'),
formatnr(n_distinct(verbose_info$row)), formatnr(n_distinct(verbose_info$row)),
'out of', formatnr(nrow(x_original)), 'out of', formatnr(nrow(x_original)),
'rows, making a total of', formatnr(nrow(verbose_info)), 'edits\n'))) 'rows, making a total of', formatnr(nrow(verbose_info)), 'edits\n')))
n_added <- verbose_info %>% filter(is.na(old)) %>% nrow() n_added <- verbose_info %>% filter(is.na(old)) %>% nrow()
n_changed <- verbose_info %>% filter(!is.na(old)) %>% nrow() n_changed <- verbose_info %>% filter(!is.na(old)) %>% nrow()
# print added values ---- # print added values ----
if (n_added == 0) { if (n_added == 0) {
colour <- cat # is function colour <- cat # is function
@ -734,8 +793,6 @@ eucast_rules <- function(x,
if (n_added > 0) { if (n_added > 0) {
verbose_info %>% verbose_info %>%
filter(is.na(old)) %>% filter(is.na(old)) %>%
# sort it well: S < I < R
mutate(new = as.rsi(new)) %>%
group_by(new) %>% group_by(new) %>%
summarise(n = n()) %>% summarise(n = n()) %>%
mutate(plural = ifelse(n > 1, "s", ""), mutate(plural = ifelse(n > 1, "s", ""),
@ -744,7 +801,7 @@ eucast_rules <- function(x,
paste(" -", ., collapse = "\n") %>% paste(" -", ., collapse = "\n") %>%
cat() cat()
} }
# print changed values ---- # print changed values ----
if (n_changed == 0) { if (n_changed == 0) {
colour <- cat # is function colour <- cat # is function
@ -762,9 +819,6 @@ eucast_rules <- function(x,
if (n_changed > 0) { if (n_changed > 0) {
verbose_info %>% verbose_info %>%
filter(!is.na(old)) %>% filter(!is.na(old)) %>%
# sort it well: S < I < R
mutate(old = as.rsi(old),
new = as.rsi(new)) %>%
group_by(old, new) %>% group_by(old, new) %>%
summarise(n = n()) %>% summarise(n = n()) %>%
mutate(plural = ifelse(n > 1, "s", ""), mutate(plural = ifelse(n > 1, "s", ""),
@ -775,14 +829,14 @@ eucast_rules <- function(x,
cat("\n") cat("\n")
} }
cat(paste0(silver(strrep("-", options()$width - 1)), "\n")) cat(paste0(silver(strrep("-", options()$width - 1)), "\n"))
if (verbose == FALSE & nrow(verbose_info) > 0) { if (verbose == FALSE & nrow(verbose_info) > 0) {
cat(paste("\nUse", bold("eucast_rules(..., verbose = TRUE)"), "(on your original data) to get a data.frame with all specified edits instead.\n\n")) cat(paste("\nUse", bold("eucast_rules(..., verbose = TRUE)"), "(on your original data) to get a data.frame with all specified edits instead.\n\n"))
} else if (verbose == TRUE) { } else if (verbose == TRUE) {
cat(paste0("\nUsed 'Verbose mode' (", bold("verbose = TRUE"), "), which returns a data.frame with all specified edits.\nUse ", bold("verbose = FALSE"), " to apply the rules on your data.\n\n")) cat(paste0("\nUsed 'Verbose mode' (", bold("verbose = TRUE"), "), which returns a data.frame with all specified edits.\nUse ", bold("verbose = FALSE"), " to apply the rules on your data.\n\n"))
} }
} }
# Return data set --------------------------------------------------------- # Return data set ---------------------------------------------------------
if (verbose == TRUE) { if (verbose == TRUE) {
verbose_info verbose_info

View File

@ -57,6 +57,12 @@ globalVariables(c(".",
"more_than_episode_ago", "more_than_episode_ago",
"name", "name",
"new", "new",
"newvar_date",
"newvar_genus_species",
"newvar_mo",
"newvar_patient_id",
"newvar_row_index",
"newvar_row_index_sorted",
"observations", "observations",
"observed", "observed",
"old", "old",

View File

@ -23,9 +23,9 @@
#' #'
#' This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. Also supports WHONET abbreviations. #' This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. Also supports WHONET abbreviations.
#' @param x a \code{data.frame} #' @param x a \code{data.frame}
#' @param search_string a text to search \code{x} for #' @param search_string a text to search \code{x} for, will be checked with \code{\link{as.ab}} if this value is not a column in \code{x}
#' @param verbose a logical to indicate whether additional info should be printed #' @param verbose a logical to indicate whether additional info should be printed
#' @details You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \code{\link{antibiotics}} data set for any column containing a name or ATC code of that antibiotic. \strong{Longer columns names take precendence over shorter column names.} #' @details You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \code{\link{antibiotics}} data set for any column containing a name or code of that antibiotic. \strong{Longer columns names take precendence over shorter column names.}
#' @importFrom dplyr %>% select filter_all any_vars #' @importFrom dplyr %>% select filter_all any_vars
#' @importFrom crayon blue #' @importFrom crayon blue
#' @return A column name of \code{x}, or \code{NULL} when no result is found. #' @return A column name of \code{x}, or \code{NULL} when no result is found.

4
R/mo.R
View File

@ -1581,7 +1581,7 @@ mo_uncertainties <- function() {
} }
#' @exportMethod print.mo_uncertainties #' @exportMethod print.mo_uncertainties
#' @importFrom crayon green yellow red white bgGreen bgYellow bgRed #' @importFrom crayon green yellow red white black bgGreen bgYellow bgRed
#' @export #' @export
#' @noRd #' @noRd
print.mo_uncertainties <- function(x, ...) { print.mo_uncertainties <- function(x, ...) {
@ -1600,7 +1600,7 @@ print.mo_uncertainties <- function(x, ...) {
colour2 <- function(...) bgGreen(white(...)) colour2 <- function(...) bgGreen(white(...))
} else if (x[i, "uncertainty"] == 2) { } else if (x[i, "uncertainty"] == 2) {
colour1 <- yellow colour1 <- yellow
colour2 <- bgYellow colour2 <- function(...) bgYellow(black(...))
} else { } else {
colour1 <- red colour1 <- red
colour2 <- function(...) bgRed(white(...)) colour2 <- function(...) bgRed(white(...))

View File

@ -21,7 +21,7 @@
#' Property of a microorganism #' Property of a microorganism
#' #'
#' Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set. All input values will be evaluated internally with \code{\link{as.mo}}. #' Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with \code{\link{as.mo}}, which makes it possible for input of these functions to use microbial abbreviations, codes and names. See Examples.
#' @param x any (vector of) text that can be coerced to a valid microorganism code with \code{\link{as.mo}} #' @param x any (vector of) text that can be coerced to a valid microorganism code with \code{\link{as.mo}}
#' @param property one of the column names of the \code{\link{microorganisms}} data set or \code{"shortname"} #' @param property one of the column names of the \code{\link{microorganisms}} data set or \code{"shortname"}
#' @param language language of the returned text, defaults to system language (see \code{\link{get_locale}}) and can also be set with \code{\link{getOption}("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation. #' @param language language of the returned text, defaults to system language (see \code{\link{get_locale}}) and can also be set with \code{\link{getOption}("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.
@ -53,7 +53,7 @@
#' @seealso \code{\link{microorganisms}} #' @seealso \code{\link{microorganisms}}
#' @inheritSection AMR Read more on our website! #' @inheritSection AMR Read more on our website!
#' @examples #' @examples
#' ## taxonomic tree #' # taxonomic tree -----------------------------------------------------------
#' mo_kingdom("E. coli") # "Bacteria" #' mo_kingdom("E. coli") # "Bacteria"
#' mo_phylum("E. coli") # "Proteobacteria" #' mo_phylum("E. coli") # "Proteobacteria"
#' mo_class("E. coli") # "Gammaproteobacteria" #' mo_class("E. coli") # "Gammaproteobacteria"
@ -63,35 +63,33 @@
#' mo_species("E. coli") # "coli" #' mo_species("E. coli") # "coli"
#' mo_subspecies("E. coli") # "" #' mo_subspecies("E. coli") # ""
#' #'
#' ## colloquial properties #' # colloquial properties ----------------------------------------------------
#' mo_name("E. coli") # "Escherichia coli" #' mo_name("E. coli") # "Escherichia coli"
#' mo_fullname("E. coli") # "Escherichia coli", same as mo_name() #' mo_fullname("E. coli") # "Escherichia coli", same as mo_name()
#' mo_shortname("E. coli") # "E. coli" #' mo_shortname("E. coli") # "E. coli"
#' #'
#' ## other properties #' # other properties ---------------------------------------------------------
#' mo_gramstain("E. coli") # "Gram-negative" #' mo_gramstain("E. coli") # "Gram-negative"
#' mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated) #' mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated)
#' mo_rank("E. coli") # "species" #' mo_rank("E. coli") # "species"
#' mo_url("E. coli") # get the direct url to the online database entry #' mo_url("E. coli") # get the direct url to the online database entry
#' mo_synonyms("E. coli") # get previously accepted taxonomic names #' mo_synonyms("E. coli") # get previously accepted taxonomic names
#' #'
#' ## scientific reference #' # scientific reference -----------------------------------------------------
#' mo_ref("E. coli") # "Castellani et al., 1919" #' mo_ref("E. coli") # "Castellani et al., 1919"
#' mo_authors("E. coli") # "Castellani et al." #' mo_authors("E. coli") # "Castellani et al."
#' mo_year("E. coli") # 1919 #' mo_year("E. coli") # 1919
#' #'
#' #' # abbreviations known in the field -----------------------------------------
#' # Abbreviations known in the field
#' mo_genus("MRSA") # "Staphylococcus" #' mo_genus("MRSA") # "Staphylococcus"
#' mo_species("MRSA") # "aureus" #' mo_species("MRSA") # "aureus"
#' mo_shortname("MRSA") # "S. aureus" #' mo_shortname("VISA") # "S. aureus"
#' mo_gramstain("MRSA") # "Gram-positive" #' mo_gramstain("VISA") # "Gram-positive"
#' #'
#' mo_genus("VISA") # "Staphylococcus" #' mo_genus("EHEC") # "Escherichia"
#' mo_species("VISA") # "aureus" #' mo_species("EHEC") # "coli"
#' #'
#' #' # known subspecies ---------------------------------------------------------
#' # Known subspecies
#' mo_name("doylei") # "Campylobacter jejuni doylei" #' mo_name("doylei") # "Campylobacter jejuni doylei"
#' mo_genus("doylei") # "Campylobacter" #' mo_genus("doylei") # "Campylobacter"
#' mo_species("doylei") # "jejuni" #' mo_species("doylei") # "jejuni"
@ -100,14 +98,14 @@
#' mo_fullname("K. pneu rh") # "Klebsiella pneumoniae rhinoscleromatis" #' mo_fullname("K. pneu rh") # "Klebsiella pneumoniae rhinoscleromatis"
#' mo_shortname("K. pneu rh") # "K. pneumoniae" #' mo_shortname("K. pneu rh") # "K. pneumoniae"
#' #'
#' #' \donttest{
#' # Becker classification, see ?as.mo #' # Becker classification, see ?as.mo ----------------------------------------
#' mo_fullname("S. epi") # "Staphylococcus epidermidis" #' mo_fullname("S. epi") # "Staphylococcus epidermidis"
#' mo_fullname("S. epi", Becker = TRUE) # "Coagulase-negative Staphylococcus (CoNS)" #' mo_fullname("S. epi", Becker = TRUE) # "Coagulase-negative Staphylococcus (CoNS)"
#' mo_shortname("S. epi") # "S. epidermidis" #' mo_shortname("S. epi") # "S. epidermidis"
#' mo_shortname("S. epi", Becker = TRUE) # "CoNS" #' mo_shortname("S. epi", Becker = TRUE) # "CoNS"
#' #'
#' # Lancefield classification, see ?as.mo #' # Lancefield classification, see ?as.mo ------------------------------------
#' mo_fullname("S. pyo") # "Streptococcus pyogenes" #' mo_fullname("S. pyo") # "Streptococcus pyogenes"
#' mo_fullname("S. pyo", Lancefield = TRUE) # "Streptococcus group A" #' mo_fullname("S. pyo", Lancefield = TRUE) # "Streptococcus group A"
#' mo_shortname("S. pyo") # "S. pyogenes" #' mo_shortname("S. pyo") # "S. pyogenes"
@ -136,6 +134,7 @@
#' mo_taxonomy("E. coli") #' mo_taxonomy("E. coli")
#' # get a list with the taxonomy, the authors and the URL to the online database #' # get a list with the taxonomy, the authors and the URL to the online database
#' mo_info("E. coli") #' mo_info("E. coli")
#' }
mo_name <- function(x, language = get_locale(), ...) { mo_name <- function(x, language = get_locale(), ...) {
translate_AMR(mo_validate(x = x, property = "fullname", ...), language = language, only_unknown = FALSE) translate_AMR(mo_validate(x = x, property = "fullname", ...), language = language, only_unknown = FALSE)
} }

24
R/rsi.R
View File

@ -129,18 +129,20 @@ as.rsi.default <- function(x, ...) {
x <- gsub('^R+$', 'R', x) x <- gsub('^R+$', 'R', x)
x[!x %in% c('S', 'I', 'R')] <- NA x[!x %in% c('S', 'I', 'R')] <- NA
na_after <- x[is.na(x) | x == ''] %>% length() na_after <- x[is.na(x) | x == ''] %>% length()
if (na_before != na_after) { if (!isFALSE(list(...)$warn)) { # so as.rsi(..., warn = FALSE) will never throw a warning
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ''] %>% if (na_before != na_after) {
unique() %>% list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ''] %>%
sort() unique() %>%
list_missing <- paste0('"', list_missing , '"', collapse = ", ") sort()
warning(na_after - na_before, ' results truncated (', list_missing <- paste0('"', list_missing , '"', collapse = ", ")
round(((na_after - na_before) / length(x)) * 100), warning(na_after - na_before, ' results truncated (',
'%) that were invalid antimicrobial interpretations: ', round(((na_after - na_before) / length(x)) * 100),
list_missing, call. = FALSE) '%) that were invalid antimicrobial interpretations: ',
list_missing, call. = FALSE)
}
} }
structure(.Data = factor(x, levels = c("S", "I", "R"), ordered = TRUE), structure(.Data = factor(x, levels = c("S", "I", "R"), ordered = TRUE),
class = c('rsi', 'ordered', 'factor')) class = c('rsi', 'ordered', 'factor'))
} }

View File

@ -24,11 +24,13 @@
#' All antimicrobial drugs and their official names, ATC codes, ATC groups and defined daily dose (DDD) are included in this package, using the WHO Collaborating Centre for Drug Statistics Methodology. #' All antimicrobial drugs and their official names, ATC codes, ATC groups and defined daily dose (DDD) are included in this package, using the WHO Collaborating Centre for Drug Statistics Methodology.
#' @section WHOCC: #' @section WHOCC:
#' \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} #' \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). \strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.} #' This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
#' #'
#' These have become the gold standard for international drug utilisation monitoring and research. #' These have become the gold standard for international drug utilisation monitoring and research.
#' #'
#' The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest. #' The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
#'
#' \strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.}
#' @inheritSection AMR Read more on our website! #' @inheritSection AMR Read more on our website!
#' @name WHOCC #' @name WHOCC
#' @rdname WHOCC #' @rdname WHOCC

View File

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

View File

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

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9031</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -249,6 +249,10 @@
<p><strong>Erwin E. A. Hassing</strong>. Contributor. <p><strong>Erwin E. A. Hassing</strong>. Contributor.
</p> </p>
</li> </li>
<li>
<p><strong>Annick Lenglet</strong>. Contributor.
</p>
</li>
<li> <li>
<p><strong>Bart C. Meijer</strong>. Contributor. <p><strong>Bart C. Meijer</strong>. Contributor.
</p> </p>

View File

@ -42,7 +42,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9031</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -315,7 +315,7 @@
<li> <li>
<p>It <strong>enhances existing data</strong> and <strong>adds new data</strong> from data sets included in this package.</p> <p>It <strong>enhances existing data</strong> and <strong>adds new data</strong> from data sets included in this package.</p>
<ul> <ul>
<li>Use <code><a href="reference/eucast_rules.html">eucast_rules()</a></code> to apply <a href="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST expert rules to isolates</a> (not the translation from MIC to RSI values).</li> <li>Use <code><a href="reference/eucast_rules.html">eucast_rules()</a></code> to apply <a href="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST expert rules to isolates</a> (not the translation from MIC to RSI values, use <code><a href="reference/as.rsi.html">as.rsi()</a></code> for that).</li>
<li>Use <code><a href="reference/first_isolate.html">first_isolate()</a></code> to identify the first isolates of every patient <a href="https://clsi.org/standards/products/microbiology/documents/m39/">using guidelines from the CLSI</a> (Clinical and Laboratory Standards Institute). <li>Use <code><a href="reference/first_isolate.html">first_isolate()</a></code> to identify the first isolates of every patient <a href="https://clsi.org/standards/products/microbiology/documents/m39/">using guidelines from the CLSI</a> (Clinical and Laboratory Standards Institute).
<ul> <ul>
<li>You can also identify first <em>weighted</em> isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.</li> <li>You can also identify first <em>weighted</em> isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.</li>

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9031</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -225,16 +225,16 @@
</div> </div>
<div id="amr-0-7-1-9031" class="section level1"> <div id="amr-0-7-1-9032" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-0-7-1-9031" class="anchor"></a>AMR 0.7.1.9031<small> Unreleased </small> <a href="#amr-0-7-1-9032" class="anchor"></a>AMR 0.7.1.9032<small> Unreleased </small>
</h1> </h1>
<div id="breaking" class="section level3"> <div id="breaking" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#breaking" class="anchor"></a>Breaking</h3> <a href="#breaking" class="anchor"></a>Breaking</h3>
<ul> <ul>
<li>Function <code>freq()</code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the <code>freq()</code> function. The <a href="https://github.com/msberends/clean"><code>clean</code></a> package is available on CRAN and will be installed automatically when updating the <code>AMR</code> package, that now imports it. In a later stage, the <code><a href="../reference/skewness.html">skewness()</a></code> and <code><a href="../reference/kurtosis.html">kurtosis()</a></code> functions will be moved to the <code>clean</code> package too.</li> <li>Function <code>freq()</code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the <code>freq()</code> function. The <a href="https://github.com/msberends/clean"><code>clean</code></a> package is available on CRAN and will be installed automatically when updating the <code>AMR</code> package, that now imports it. In a later stage, the <code><a href="../reference/skewness.html">skewness()</a></code> and <code><a href="../reference/kurtosis.html">kurtosis()</a></code> functions will be moved to the <code>clean</code> package too.</li>
<li>Selection of first isolates now <strong>excludes</strong> all unknown microorganisms at default, i.e. microbial codes <code>NA</code> and <code>"UNKNOWN"</code>. They can be included with the new parameter <code>include_unknown</code>: <code>first_isolates(..., include_unknown = TRUE)</code>. For WHONET users, this means that all records with microbial codes <code>"xxx"</code> (<em>no growth</em>) and <code>"con"</code> (<em>contamination</em>) will be excluded at default.</li> <li>Determination of first isolates now <strong>excludes</strong> all unknown microorganisms at default, i.e. microbial code <code>"UNKNOWN"</code>. They can be included with the new parameter <code>include_unknown</code>: <code>first_isolates(..., include_unknown = TRUE)</code>. For WHONET users, this means that all records with organism code <code>"con"</code> (<em>contamination</em>) will be excluded at default, since <code>as.mo("con") = "UNKNOWN"</code>.</li>
</ul> </ul>
</div> </div>
<div id="new" class="section level3"> <div id="new" class="section level3">
@ -274,9 +274,15 @@
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#changed" class="anchor"></a>Changed</h3> <a href="#changed" class="anchor"></a>Changed</h3>
<ul> <ul>
<li>Added more informative errors and warnings to <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> <li>Function: <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>
<ul>
<li>Fixed a bug for <em>Yersinia pseudotuberculosis</em>
</li> </li>
<li>Fixed a bug in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> for <em>Yersinia pseudotuberculosis</em> <li>Added more informative errors and warnings</li>
<li>Printed info now distinguishes between added and changes values</li>
<li>Using Verbose mode (i.e. <code><a href="../reference/eucast_rules.html">eucast_rules(..., verbose = TRUE)</a></code>) returns more informative and readable output</li>
<li>Using factors as input now adds missing factors levels when the function changes antibiotic results</li>
</ul>
</li> </li>
<li> <li>
<p>Added tibble printing support for classes <code>rsi</code>, <code>mic</code>, <code>ab</code> and <code>mo</code>. When using tibbles containing antibiotic columns, values <code>S</code> will print in green, values <code>I</code> will print in yellow and values <code>R</code> will print in red:</p> <p>Added tibble printing support for classes <code>rsi</code>, <code>mic</code>, <code>ab</code> and <code>mo</code>. When using tibbles containing antibiotic columns, values <code>S</code> will print in green, values <code>I</code> will print in yellow and values <code>R</code> will print in red:</p>
@ -306,15 +312,13 @@
<li>Deprecated the <code>country</code> parameter of <code><a href="../reference/mdro.html">mdro()</a></code> in favour of the already existing <code>guideline</code> parameter to support multiple guidelines within one country</li> <li>Deprecated the <code>country</code> parameter of <code><a href="../reference/mdro.html">mdro()</a></code> in favour of the already existing <code>guideline</code> parameter to support multiple guidelines within one country</li>
<li>The <code>name</code> of <code>RIF</code> is now Rifampicin instead of Rifampin</li> <li>The <code>name</code> of <code>RIF</code> is now Rifampicin instead of Rifampin</li>
<li>The <code>antibiotics</code> data set is now sorted by name</li> <li>The <code>antibiotics</code> data set is now sorted by name</li>
<li>Using verbose mode with <code><a href="../reference/eucast_rules.html">eucast_rules(..., verbose = TRUE)</a></code> returns more informative and readable output</li> <li><p>Speed improvement for <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code> which is now 30 times faster for antibiotic abbreviations</p></li>
<li>Speed improvement for <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code> which is now 30 times faster for antibiotic abbreviations</li>
<li><p>Using factors as input for <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> now adds missing factors levels when the function changes antibiotic results</p></li>
</ul> </ul>
<div id="other" class="section level4"> <div id="other" class="section level4">
<h4 class="hasAnchor"> <h4 class="hasAnchor">
<a href="#other" class="anchor"></a>Other</h4> <a href="#other" class="anchor"></a>Other</h4>
<ul> <ul>
<li>Added Dr Bart Meijer and Dr Dennis Souverein as contributors</li> <li>Added Dr Bart Meijer, Dr Dennis Souverein and Annick Lenglet as contributors</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -1228,7 +1232,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav"> <div id="tocnav">
<h2>Contents</h2> <h2>Contents</h2>
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0-7-1-9031">0.7.1.9031</a></li> <li><a href="#amr-0-7-1-9032">0.7.1.9032</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li> <li><a href="#amr-0-7-1">0.7.1</a></li>
<li><a href="#amr-0-7-0">0.7.0</a></li> <li><a href="#amr-0-7-0">0.7.0</a></li>
<li><a href="#amr-0-6-1">0.6.1</a></li> <li><a href="#amr-0-6-1">0.6.1</a></li>

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -239,9 +239,10 @@
<p><img src='figures/logo_who.png' height=60px style=margin-bottom:5px /> <br /> <p><img src='figures/logo_who.png' height=60px style=margin-bottom:5px /> <br />
This package contains <strong>all ~450 antimicrobial drugs</strong> and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <a href='https://www.whocc.no'>https://www.whocc.no</a>) and the Pharmaceuticals Community Register of the European Commission (<a href='http://ec.europa.eu/health/documents/community-register/html/atc.htm'>http://ec.europa.eu/health/documents/community-register/html/atc.htm</a>). <strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See <a href='https://www.whocc.no/copyright_disclaimer/'>https://www.whocc.no/copyright_disclaimer/</a>.</strong></p> This package contains <strong>all ~450 antimicrobial drugs</strong> and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <a href='https://www.whocc.no'>https://www.whocc.no</a>) and the Pharmaceuticals Community Register of the European Commission (<a href='http://ec.europa.eu/health/documents/community-register/html/atc.htm'>http://ec.europa.eu/health/documents/community-register/html/atc.htm</a>).</p>
<p>These have become the gold standard for international drug utilisation monitoring and research.</p> <p>These have become the gold standard for international drug utilisation monitoring and research.</p>
<p>The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.</p> <p>The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.</p>
<p><strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See <a href='https://www.whocc.no/copyright_disclaimer/'>https://www.whocc.no/copyright_disclaimer/</a>.</strong></p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2> <h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -269,9 +269,10 @@
<p><img src='figures/logo_who.png' height=60px style=margin-bottom:5px /> <br /> <p><img src='figures/logo_who.png' height=60px style=margin-bottom:5px /> <br />
This package contains <strong>all ~450 antimicrobial drugs</strong> and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <a href='https://www.whocc.no'>https://www.whocc.no</a>) and the Pharmaceuticals Community Register of the European Commission (<a href='http://ec.europa.eu/health/documents/community-register/html/atc.htm'>http://ec.europa.eu/health/documents/community-register/html/atc.htm</a>). <strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See <a href='https://www.whocc.no/copyright_disclaimer/'>https://www.whocc.no/copyright_disclaimer/</a>.</strong></p> This package contains <strong>all ~450 antimicrobial drugs</strong> and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <a href='https://www.whocc.no'>https://www.whocc.no</a>) and the Pharmaceuticals Community Register of the European Commission (<a href='http://ec.europa.eu/health/documents/community-register/html/atc.htm'>http://ec.europa.eu/health/documents/community-register/html/atc.htm</a>).</p>
<p>These have become the gold standard for international drug utilisation monitoring and research.</p> <p>These have become the gold standard for international drug utilisation monitoring and research.</p>
<p>The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.</p> <p>The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.</p>
<p><strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See <a href='https://www.whocc.no/copyright_disclaimer/'>https://www.whocc.no/copyright_disclaimer/</a>.</strong></p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2> <h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -267,9 +267,10 @@
<p><img src='figures/logo_who.png' height=60px style=margin-bottom:5px /> <br /> <p><img src='figures/logo_who.png' height=60px style=margin-bottom:5px /> <br />
This package contains <strong>all ~450 antimicrobial drugs</strong> and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <a href='https://www.whocc.no'>https://www.whocc.no</a>) and the Pharmaceuticals Community Register of the European Commission (<a href='http://ec.europa.eu/health/documents/community-register/html/atc.htm'>http://ec.europa.eu/health/documents/community-register/html/atc.htm</a>). <strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See <a href='https://www.whocc.no/copyright_disclaimer/'>https://www.whocc.no/copyright_disclaimer/</a>.</strong></p> This package contains <strong>all ~450 antimicrobial drugs</strong> and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <a href='https://www.whocc.no'>https://www.whocc.no</a>) and the Pharmaceuticals Community Register of the European Commission (<a href='http://ec.europa.eu/health/documents/community-register/html/atc.htm'>http://ec.europa.eu/health/documents/community-register/html/atc.htm</a>).</p>
<p>These have become the gold standard for international drug utilisation monitoring and research.</p> <p>These have become the gold standard for international drug utilisation monitoring and research.</p>
<p>The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.</p> <p>The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.</p>
<p><strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See <a href='https://www.whocc.no/copyright_disclaimer/'>https://www.whocc.no/copyright_disclaimer/</a>.</strong></p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2> <h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>

View File

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

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -258,7 +258,7 @@
</tr> </tr>
<tr> <tr>
<th>verbose</th> <th>verbose</th>
<td><p>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 <code>data.frame</code> with extensive info about which rows and columns would be effected and in which way.</p></td> <td><p>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.</p></td>
</tr> </tr>
<tr> <tr>
<th>...</th> <th>...</th>
@ -292,7 +292,7 @@
<p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab_col.html'>guess_ab_col</a></code> or input a text (case-insensitive), or use <code>NULL</code> to skip a column (e.g. <code>TIC = NULL</code> to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.</p> <p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab_col.html'>guess_ab_col</a></code> or input a text (case-insensitive), or use <code>NULL</code> to skip a column (e.g. <code>TIC = NULL</code> to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.</p>
<p>The following antibiotics are used for the functions <code>eucast_rules</code> and <code><a href='mdro.html'>mdro</a></code>. These are shown in the format '<strong>antimicrobial ID</strong>: name (<em>ATC code</em>)', sorted by name:</p> <p>The following antibiotics are used for the functions <code>eucast_rules</code> and <code><a href='mdro.html'>mdro</a></code>. These are shown below in the format '<strong>antimicrobial ID</strong>: name (<em>ATC code</em>)', sorted by name:</p>
<p><strong>AMK</strong>: amikacin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01GB06'>J01GB06</a>), <p><strong>AMK</strong>: amikacin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01GB06'>J01GB06</a>),
<strong>AMX</strong>: amoxicillin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CA04'>J01CA04</a>), <strong>AMX</strong>: amoxicillin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CA04'>J01CA04</a>),
<strong>AMC</strong>: amoxicillin/clavulanic acid (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CR02'>J01CR02</a>), <strong>AMC</strong>: amoxicillin/clavulanic acid (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CR02'>J01CR02</a>),
@ -409,6 +409,7 @@
<span class='co'># 5 Pseudomonas aeruginosa R R - - R R R</span> <span class='co'># 5 Pseudomonas aeruginosa R R - - R R R</span>
<span class='co'># }</span><span class='co'># NOT RUN {</span>
<span class='co'># do not apply EUCAST rules, but rather get a data.frame</span> <span class='co'># do not apply EUCAST rules, but rather get a data.frame</span>
<span class='co'># with 18 rows, containing all details about the transformations:</span> <span class='co'># with 18 rows, containing all details about the transformations:</span>
<span class='no'>c</span> <span class='kw'>&lt;-</span> <span class='fu'>eucast_rules</span>(<span class='no'>a</span>, <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='no'>c</span> <span class='kw'>&lt;-</span> <span class='fu'>eucast_rules</span>(<span class='no'>a</span>, <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9031</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -317,7 +317,7 @@
</tr> </tr>
<tr> <tr>
<th>include_unknown</th> <th>include_unknown</th>
<td><p>logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code <code>"UNKNOWN"</code>, which defaults to <code>FALSE</code>. For WHONET users, this means that all records with organism code <code>"con"</code> (<em>contamination</em>) will be excluded at default.</p></td> <td><p>logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code <code>"UNKNOWN"</code>, which defaults to <code>FALSE</code>. For WHONET users, this means that all records with organism code <code>"con"</code> (<em>contamination</em>) will be excluded at default. Isolates with a microbial ID of <code>NA</code> will always be excluded as first isolate.</p></td>
</tr> </tr>
<tr> <tr>
<th>...</th> <th>...</th>
@ -337,6 +337,7 @@
<p><strong>WHY THIS IS SO IMPORTANT</strong> <br /> <p><strong>WHY THIS IS SO IMPORTANT</strong> <br />
To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode <a href='https://www.ncbi.nlm.nih.gov/pubmed/17304462'>[1]</a>. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all <em>S. aureus</em> isolates would be overestimated, because you included this MRSA more than once. It would be <a href='https://en.wikipedia.org/wiki/Selection_bias'>selection bias</a>.</p> To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode <a href='https://www.ncbi.nlm.nih.gov/pubmed/17304462'>[1]</a>. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all <em>S. aureus</em> isolates would be overestimated, because you included this MRSA more than once. It would be <a href='https://en.wikipedia.org/wiki/Selection_bias'>selection bias</a>.</p>
<p>All isolates with a microbial ID of <code>NA</code> will be excluded as first isolate.</p>
<p>The functions <code>filter_first_isolate</code> and <code>filter_first_weighted_isolate</code> are helper functions to quickly filter on first isolates. The function <code>filter_first_isolate</code> is essentially equal to:</p><pre> <p>The functions <code>filter_first_isolate</code> and <code>filter_first_weighted_isolate</code> are helper functions to quickly filter on first isolates. The function <code>filter_first_isolate</code> is essentially equal to:</p><pre>
x %&gt;% x %&gt;%
mutate(only_firsts = first_isolate(x, ...)) %&gt;% mutate(only_firsts = first_isolate(x, ...)) %&gt;%

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -245,7 +245,7 @@
</tr> </tr>
<tr> <tr>
<th>search_string</th> <th>search_string</th>
<td><p>a text to search <code>x</code> for</p></td> <td><p>a text to search <code>x</code> for, will be checked with <code><a href='as.ab.html'>as.ab</a></code> if this value is not a column in <code>x</code></p></td>
</tr> </tr>
<tr> <tr>
<th>verbose</th> <th>verbose</th>
@ -259,7 +259,7 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2> <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>You can look for an antibiotic (trade) name or abbreviation and it will search <code>x</code> and the <code><a href='antibiotics.html'>antibiotics</a></code> data set for any column containing a name or ATC code of that antibiotic. <strong>Longer columns names take precendence over shorter column names.</strong></p> <p>You can look for an antibiotic (trade) name or abbreviation and it will search <code>x</code> and the <code><a href='antibiotics.html'>antibiotics</a></code> data set for any column containing a name or code of that antibiotic. <strong>Longer columns names take precendence over shorter column names.</strong></p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2> <h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>

View File

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

View File

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

View File

@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -299,7 +299,7 @@
<p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab_col.html'>guess_ab_col</a></code> or input a text (case-insensitive), or use <code>NULL</code> to skip a column (e.g. <code>TIC = NULL</code> to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.</p> <p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab_col.html'>guess_ab_col</a></code> or input a text (case-insensitive), or use <code>NULL</code> to skip a column (e.g. <code>TIC = NULL</code> to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.</p>
<p>The following antibiotics are used for the functions <code><a href='eucast_rules.html'>eucast_rules</a></code> and <code>mdro</code>. These are shown in the format '<strong>antimicrobial ID</strong>: name (<em>ATC code</em>)', sorted by name:</p> <p>The following antibiotics are used for the functions <code><a href='eucast_rules.html'>eucast_rules</a></code> and <code>mdro</code>. These are shown below in the format '<strong>antimicrobial ID</strong>: name (<em>ATC code</em>)', sorted by name:</p>
<p><strong>AMK</strong>: amikacin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01GB06'>J01GB06</a>), <p><strong>AMK</strong>: amikacin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01GB06'>J01GB06</a>),
<strong>AMX</strong>: amoxicillin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CA04'>J01CA04</a>), <strong>AMX</strong>: amoxicillin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CA04'>J01CA04</a>),
<strong>AMC</strong>: amoxicillin/clavulanic acid (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CR02'>J01CR02</a>), <strong>AMC</strong>: amoxicillin/clavulanic acid (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CR02'>J01CR02</a>),

View File

@ -47,7 +47,7 @@
<script src="../extra.js"></script> <script src="../extra.js"></script>
<meta property="og:title" content="Property of a microorganism — mo_property" /> <meta property="og:title" content="Property of a microorganism — mo_property" />
<meta property="og:description" content="Use these functions to return a specific property of a microorganism from the microorganisms data set. All input values will be evaluated internally with as.mo." /> <meta property="og:description" content="Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with as.mo, which makes it possible for input of these functions to use microbial abbreviations, codes and names. See Examples." />
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png" /> <meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png" />
<meta name="twitter:card" content="summary" /> <meta name="twitter:card" content="summary" />
@ -80,7 +80,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9032</span>
</span> </span>
</div> </div>
@ -230,7 +230,7 @@
<div class="ref-description"> <div class="ref-description">
<p>Use these functions to return a specific property of a microorganism from the <code><a href='microorganisms.html'>microorganisms</a></code> data set. All input values will be evaluated internally with <code><a href='as.mo.html'>as.mo</a></code>.</p> <p>Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with <code><a href='as.mo.html'>as.mo</a></code>, which makes it possible for input of these functions to use microbial abbreviations, codes and names. See Examples.</p>
</div> </div>
@ -352,7 +352,7 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># NOT RUN {</span> <pre class="examples"><span class='co'># NOT RUN {</span>
<span class='co'>## taxonomic tree</span> <span class='co'># taxonomic tree -----------------------------------------------------------</span>
<span class='fu'>mo_kingdom</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Bacteria"</span> <span class='fu'>mo_kingdom</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Bacteria"</span>
<span class='fu'>mo_phylum</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Proteobacteria"</span> <span class='fu'>mo_phylum</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Proteobacteria"</span>
<span class='fu'>mo_class</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Gammaproteobacteria"</span> <span class='fu'>mo_class</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Gammaproteobacteria"</span>
@ -362,35 +362,33 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<span class='fu'>mo_species</span>(<span class='st'>"E. coli"</span>) <span class='co'># "coli"</span> <span class='fu'>mo_species</span>(<span class='st'>"E. coli"</span>) <span class='co'># "coli"</span>
<span class='fu'>mo_subspecies</span>(<span class='st'>"E. coli"</span>) <span class='co'># ""</span> <span class='fu'>mo_subspecies</span>(<span class='st'>"E. coli"</span>) <span class='co'># ""</span>
<span class='co'>## colloquial properties</span> <span class='co'># colloquial properties ----------------------------------------------------</span>
<span class='fu'>mo_name</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Escherichia coli"</span> <span class='fu'>mo_name</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Escherichia coli"</span>
<span class='fu'>mo_fullname</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Escherichia coli", same as mo_name()</span> <span class='fu'>mo_fullname</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Escherichia coli", same as mo_name()</span>
<span class='fu'>mo_shortname</span>(<span class='st'>"E. coli"</span>) <span class='co'># "E. coli"</span> <span class='fu'>mo_shortname</span>(<span class='st'>"E. coli"</span>) <span class='co'># "E. coli"</span>
<span class='co'>## other properties</span> <span class='co'># other properties ---------------------------------------------------------</span>
<span class='fu'>mo_gramstain</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Gram-negative"</span> <span class='fu'>mo_gramstain</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Gram-negative"</span>
<span class='fu'>mo_type</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Bacteria" (equal to kingdom, but may be translated)</span> <span class='fu'>mo_type</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Bacteria" (equal to kingdom, but may be translated)</span>
<span class='fu'>mo_rank</span>(<span class='st'>"E. coli"</span>) <span class='co'># "species"</span> <span class='fu'>mo_rank</span>(<span class='st'>"E. coli"</span>) <span class='co'># "species"</span>
<span class='fu'>mo_url</span>(<span class='st'>"E. coli"</span>) <span class='co'># get the direct url to the online database entry</span> <span class='fu'>mo_url</span>(<span class='st'>"E. coli"</span>) <span class='co'># get the direct url to the online database entry</span>
<span class='fu'>mo_synonyms</span>(<span class='st'>"E. coli"</span>) <span class='co'># get previously accepted taxonomic names</span> <span class='fu'>mo_synonyms</span>(<span class='st'>"E. coli"</span>) <span class='co'># get previously accepted taxonomic names</span>
<span class='co'>## scientific reference</span> <span class='co'># scientific reference -----------------------------------------------------</span>
<span class='fu'>mo_ref</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Castellani et al., 1919"</span> <span class='fu'>mo_ref</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Castellani et al., 1919"</span>
<span class='fu'>mo_authors</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Castellani et al."</span> <span class='fu'>mo_authors</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Castellani et al."</span>
<span class='fu'>mo_year</span>(<span class='st'>"E. coli"</span>) <span class='co'># 1919</span> <span class='fu'>mo_year</span>(<span class='st'>"E. coli"</span>) <span class='co'># 1919</span>
<span class='co'># abbreviations known in the field -----------------------------------------</span>
<span class='co'># Abbreviations known in the field</span>
<span class='fu'>mo_genus</span>(<span class='st'>"MRSA"</span>) <span class='co'># "Staphylococcus"</span> <span class='fu'>mo_genus</span>(<span class='st'>"MRSA"</span>) <span class='co'># "Staphylococcus"</span>
<span class='fu'>mo_species</span>(<span class='st'>"MRSA"</span>) <span class='co'># "aureus"</span> <span class='fu'>mo_species</span>(<span class='st'>"MRSA"</span>) <span class='co'># "aureus"</span>
<span class='fu'>mo_shortname</span>(<span class='st'>"MRSA"</span>) <span class='co'># "S. aureus"</span> <span class='fu'>mo_shortname</span>(<span class='st'>"VISA"</span>) <span class='co'># "S. aureus"</span>
<span class='fu'>mo_gramstain</span>(<span class='st'>"MRSA"</span>) <span class='co'># "Gram-positive"</span> <span class='fu'>mo_gramstain</span>(<span class='st'>"VISA"</span>) <span class='co'># "Gram-positive"</span>
<span class='fu'>mo_genus</span>(<span class='st'>"VISA"</span>) <span class='co'># "Staphylococcus"</span> <span class='fu'>mo_genus</span>(<span class='st'>"EHEC"</span>) <span class='co'># "Escherichia"</span>
<span class='fu'>mo_species</span>(<span class='st'>"VISA"</span>) <span class='co'># "aureus"</span> <span class='fu'>mo_species</span>(<span class='st'>"EHEC"</span>) <span class='co'># "coli"</span>
<span class='co'># known subspecies ---------------------------------------------------------</span>
<span class='co'># Known subspecies</span>
<span class='fu'>mo_name</span>(<span class='st'>"doylei"</span>) <span class='co'># "Campylobacter jejuni doylei"</span> <span class='fu'>mo_name</span>(<span class='st'>"doylei"</span>) <span class='co'># "Campylobacter jejuni doylei"</span>
<span class='fu'>mo_genus</span>(<span class='st'>"doylei"</span>) <span class='co'># "Campylobacter"</span> <span class='fu'>mo_genus</span>(<span class='st'>"doylei"</span>) <span class='co'># "Campylobacter"</span>
<span class='fu'>mo_species</span>(<span class='st'>"doylei"</span>) <span class='co'># "jejuni"</span> <span class='fu'>mo_species</span>(<span class='st'>"doylei"</span>) <span class='co'># "jejuni"</span>
@ -399,14 +397,14 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<span class='fu'>mo_fullname</span>(<span class='st'>"K. pneu rh"</span>) <span class='co'># "Klebsiella pneumoniae rhinoscleromatis"</span> <span class='fu'>mo_fullname</span>(<span class='st'>"K. pneu rh"</span>) <span class='co'># "Klebsiella pneumoniae rhinoscleromatis"</span>
<span class='fu'>mo_shortname</span>(<span class='st'>"K. pneu rh"</span>) <span class='co'># "K. pneumoniae"</span> <span class='fu'>mo_shortname</span>(<span class='st'>"K. pneu rh"</span>) <span class='co'># "K. pneumoniae"</span>
<span class='co'># }</span><span class='co'># NOT RUN {</span>
<span class='co'># Becker classification, see ?as.mo</span> <span class='co'># Becker classification, see ?as.mo ----------------------------------------</span>
<span class='fu'>mo_fullname</span>(<span class='st'>"S. epi"</span>) <span class='co'># "Staphylococcus epidermidis"</span> <span class='fu'>mo_fullname</span>(<span class='st'>"S. epi"</span>) <span class='co'># "Staphylococcus epidermidis"</span>
<span class='fu'>mo_fullname</span>(<span class='st'>"S. epi"</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># "Coagulase-negative Staphylococcus (CoNS)"</span> <span class='fu'>mo_fullname</span>(<span class='st'>"S. epi"</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># "Coagulase-negative Staphylococcus (CoNS)"</span>
<span class='fu'>mo_shortname</span>(<span class='st'>"S. epi"</span>) <span class='co'># "S. epidermidis"</span> <span class='fu'>mo_shortname</span>(<span class='st'>"S. epi"</span>) <span class='co'># "S. epidermidis"</span>
<span class='fu'>mo_shortname</span>(<span class='st'>"S. epi"</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># "CoNS"</span> <span class='fu'>mo_shortname</span>(<span class='st'>"S. epi"</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># "CoNS"</span>
<span class='co'># Lancefield classification, see ?as.mo</span> <span class='co'># Lancefield classification, see ?as.mo ------------------------------------</span>
<span class='fu'>mo_fullname</span>(<span class='st'>"S. pyo"</span>) <span class='co'># "Streptococcus pyogenes"</span> <span class='fu'>mo_fullname</span>(<span class='st'>"S. pyo"</span>) <span class='co'># "Streptococcus pyogenes"</span>
<span class='fu'>mo_fullname</span>(<span class='st'>"S. pyo"</span>, <span class='kw'>Lancefield</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># "Streptococcus group A"</span> <span class='fu'>mo_fullname</span>(<span class='st'>"S. pyo"</span>, <span class='kw'>Lancefield</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='co'># "Streptococcus group A"</span>
<span class='fu'>mo_shortname</span>(<span class='st'>"S. pyo"</span>) <span class='co'># "S. pyogenes"</span> <span class='fu'>mo_shortname</span>(<span class='st'>"S. pyo"</span>) <span class='co'># "S. pyogenes"</span>

View File

@ -141,7 +141,7 @@ The `AMR` package basically does four important things:
2. It **enhances existing data** and **adds new data** from data sets included in this package. 2. It **enhances existing data** and **adds new data** from data sets included in this package.
* Use `eucast_rules()` to apply [EUCAST expert rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/) (not the translation from MIC to RSI values). * Use `eucast_rules()` to apply [EUCAST expert rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/) (not the translation from MIC to RSI values, use `as.rsi()` for that).
* Use `first_isolate()` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute). * Use `first_isolate()` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them. * You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
* Use `mdro()` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported. * Use `mdro()` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.

View File

@ -9,11 +9,13 @@ All antimicrobial drugs and their official names, ATC codes, ATC groups and defi
\section{WHOCC}{ \section{WHOCC}{
\if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr}
This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). \strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.} This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
These have become the gold standard for international drug utilisation monitoring and research. These have become the gold standard for international drug utilisation monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest. The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
\strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.}
} }
\section{Read more on our website!}{ \section{Read more on our website!}{

View File

@ -41,11 +41,13 @@ Synonyms (i.e. trade names) are derived from the Compound ID (\code{cid}) and co
\section{WHOCC}{ \section{WHOCC}{
\if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr}
This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). \strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.} This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
These have become the gold standard for international drug utilisation monitoring and research. These have become the gold standard for international drug utilisation monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest. The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
\strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.}
} }
\section{Read more on our website!}{ \section{Read more on our website!}{

View File

@ -35,11 +35,13 @@ European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{htt
\section{WHOCC}{ \section{WHOCC}{
\if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr}
This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). \strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.} This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
These have become the gold standard for international drug utilisation monitoring and research. These have become the gold standard for international drug utilisation monitoring and research.
The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest. The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
\strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.}
} }
\section{Read more on our website!}{ \section{Read more on our website!}{

View File

@ -33,7 +33,7 @@ eucast_rules(x, col_mo = NULL, info = TRUE, rules = c("breakpoints",
\item{rules}{a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")}} \item{rules}{a character vector that specifies which rules should be applied - one or more of \code{c("breakpoints", "expert", "other", "all")}}
\item{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 \code{data.frame} with extensive info about which rows and columns would be effected and in which way.} \item{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.}
\item{...}{column name of an antibiotic, see section Antibiotics} \item{...}{column name of an antibiotic, see section Antibiotics}
} }
@ -53,7 +53,7 @@ The file containing all EUCAST rules is located here: \url{https://gitlab.com/ms
To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning. To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
The following antibiotics are used for the functions \code{\link{eucast_rules}} and \code{\link{mdro}}. These are shown in the format '\strong{antimicrobial ID}: name (\emph{ATC code})', sorted by name: The following antibiotics are used for the functions \code{\link{eucast_rules}} and \code{\link{mdro}}. These are shown below in the format '\strong{antimicrobial ID}: name (\emph{ATC code})', sorted by name:
\strong{AMK}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}), \strong{AMK}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}),
\strong{AMX}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}), \strong{AMX}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}),
@ -170,10 +170,12 @@ b
# 5 Pseudomonas aeruginosa R R - - R R R # 5 Pseudomonas aeruginosa R R - - R R R
\donttest{
# do not apply EUCAST rules, but rather get a data.frame # do not apply EUCAST rules, but rather get a data.frame
# with 18 rows, containing all details about the transformations: # with 18 rows, containing all details about the transformations:
c <- eucast_rules(a, verbose = TRUE) c <- eucast_rules(a, verbose = TRUE)
} }
}
\keyword{eucast} \keyword{eucast}
\keyword{interpretive} \keyword{interpretive}
\keyword{reading} \keyword{reading}

View File

@ -9,7 +9,7 @@ guess_ab_col(x = NULL, search_string = NULL, verbose = FALSE)
\arguments{ \arguments{
\item{x}{a \code{data.frame}} \item{x}{a \code{data.frame}}
\item{search_string}{a text to search \code{x} for} \item{search_string}{a text to search \code{x} for, will be checked with \code{\link{as.ab}} if this value is not a column in \code{x}}
\item{verbose}{a logical to indicate whether additional info should be printed} \item{verbose}{a logical to indicate whether additional info should be printed}
} }
@ -20,7 +20,7 @@ A column name of \code{x}, or \code{NULL} when no result is found.
This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. Also supports WHONET abbreviations. This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. Also supports WHONET abbreviations.
} }
\details{ \details{
You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \code{\link{antibiotics}} data set for any column containing a name or ATC code of that antibiotic. \strong{Longer columns names take precendence over shorter column names.} You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \code{\link{antibiotics}} data set for any column containing a name or code of that antibiotic. \strong{Longer columns names take precendence over shorter column names.}
} }
\section{Read more on our website!}{ \section{Read more on our website!}{

View File

@ -62,7 +62,7 @@ Please suggest your own (country-specific) guidelines by letting us know: \url{h
To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning. To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive), or use \code{NULL} to skip a column (e.g. \code{TIC = NULL} to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
The following antibiotics are used for the functions \code{\link{eucast_rules}} and \code{\link{mdro}}. These are shown in the format '\strong{antimicrobial ID}: name (\emph{ATC code})', sorted by name: The following antibiotics are used for the functions \code{\link{eucast_rules}} and \code{\link{mdro}}. These are shown below in the format '\strong{antimicrobial ID}: name (\emph{ATC code})', sorted by name:
\strong{AMK}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}), \strong{AMK}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}),
\strong{AMX}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}), \strong{AMX}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}),

View File

@ -89,7 +89,7 @@ mo_property(x, property = "fullname", language = get_locale(), ...)
} }
} }
\description{ \description{
Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set. All input values will be evaluated internally with \code{\link{as.mo}}. Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with \code{\link{as.mo}}, which makes it possible for input of these functions to use microbial abbreviations, codes and names. See Examples.
} }
\details{ \details{
All functions will return the most recently known taxonomic property according to the Catalogue of Life, except for \code{mo_ref}, \code{mo_authors} and \code{mo_year}. This leads to the following results: All functions will return the most recently known taxonomic property according to the Catalogue of Life, except for \code{mo_ref}, \code{mo_authors} and \code{mo_year}. This leads to the following results:
@ -130,7 +130,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
} }
\examples{ \examples{
## taxonomic tree # taxonomic tree -----------------------------------------------------------
mo_kingdom("E. coli") # "Bacteria" mo_kingdom("E. coli") # "Bacteria"
mo_phylum("E. coli") # "Proteobacteria" mo_phylum("E. coli") # "Proteobacteria"
mo_class("E. coli") # "Gammaproteobacteria" mo_class("E. coli") # "Gammaproteobacteria"
@ -140,35 +140,33 @@ mo_genus("E. coli") # "Escherichia"
mo_species("E. coli") # "coli" mo_species("E. coli") # "coli"
mo_subspecies("E. coli") # "" mo_subspecies("E. coli") # ""
## colloquial properties # colloquial properties ----------------------------------------------------
mo_name("E. coli") # "Escherichia coli" mo_name("E. coli") # "Escherichia coli"
mo_fullname("E. coli") # "Escherichia coli", same as mo_name() mo_fullname("E. coli") # "Escherichia coli", same as mo_name()
mo_shortname("E. coli") # "E. coli" mo_shortname("E. coli") # "E. coli"
## other properties # other properties ---------------------------------------------------------
mo_gramstain("E. coli") # "Gram-negative" mo_gramstain("E. coli") # "Gram-negative"
mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated) mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated)
mo_rank("E. coli") # "species" mo_rank("E. coli") # "species"
mo_url("E. coli") # get the direct url to the online database entry mo_url("E. coli") # get the direct url to the online database entry
mo_synonyms("E. coli") # get previously accepted taxonomic names mo_synonyms("E. coli") # get previously accepted taxonomic names
## scientific reference # scientific reference -----------------------------------------------------
mo_ref("E. coli") # "Castellani et al., 1919" mo_ref("E. coli") # "Castellani et al., 1919"
mo_authors("E. coli") # "Castellani et al." mo_authors("E. coli") # "Castellani et al."
mo_year("E. coli") # 1919 mo_year("E. coli") # 1919
# abbreviations known in the field -----------------------------------------
# Abbreviations known in the field
mo_genus("MRSA") # "Staphylococcus" mo_genus("MRSA") # "Staphylococcus"
mo_species("MRSA") # "aureus" mo_species("MRSA") # "aureus"
mo_shortname("MRSA") # "S. aureus" mo_shortname("VISA") # "S. aureus"
mo_gramstain("MRSA") # "Gram-positive" mo_gramstain("VISA") # "Gram-positive"
mo_genus("VISA") # "Staphylococcus" mo_genus("EHEC") # "Escherichia"
mo_species("VISA") # "aureus" mo_species("EHEC") # "coli"
# known subspecies ---------------------------------------------------------
# Known subspecies
mo_name("doylei") # "Campylobacter jejuni doylei" mo_name("doylei") # "Campylobacter jejuni doylei"
mo_genus("doylei") # "Campylobacter" mo_genus("doylei") # "Campylobacter"
mo_species("doylei") # "jejuni" mo_species("doylei") # "jejuni"
@ -177,14 +175,14 @@ mo_subspecies("doylei") # "doylei"
mo_fullname("K. pneu rh") # "Klebsiella pneumoniae rhinoscleromatis" mo_fullname("K. pneu rh") # "Klebsiella pneumoniae rhinoscleromatis"
mo_shortname("K. pneu rh") # "K. pneumoniae" mo_shortname("K. pneu rh") # "K. pneumoniae"
\donttest{
# Becker classification, see ?as.mo # Becker classification, see ?as.mo ----------------------------------------
mo_fullname("S. epi") # "Staphylococcus epidermidis" mo_fullname("S. epi") # "Staphylococcus epidermidis"
mo_fullname("S. epi", Becker = TRUE) # "Coagulase-negative Staphylococcus (CoNS)" mo_fullname("S. epi", Becker = TRUE) # "Coagulase-negative Staphylococcus (CoNS)"
mo_shortname("S. epi") # "S. epidermidis" mo_shortname("S. epi") # "S. epidermidis"
mo_shortname("S. epi", Becker = TRUE) # "CoNS" mo_shortname("S. epi", Becker = TRUE) # "CoNS"
# Lancefield classification, see ?as.mo # Lancefield classification, see ?as.mo ------------------------------------
mo_fullname("S. pyo") # "Streptococcus pyogenes" mo_fullname("S. pyo") # "Streptococcus pyogenes"
mo_fullname("S. pyo", Lancefield = TRUE) # "Streptococcus group A" mo_fullname("S. pyo", Lancefield = TRUE) # "Streptococcus group A"
mo_shortname("S. pyo") # "S. pyogenes" mo_shortname("S. pyo") # "S. pyogenes"
@ -214,6 +212,7 @@ mo_taxonomy("E. coli")
# get a list with the taxonomy, the authors and the URL to the online database # get a list with the taxonomy, the authors and the URL to the online database
mo_info("E. coli") mo_info("E. coli")
} }
}
\seealso{ \seealso{
\code{\link{microorganisms}} \code{\link{microorganisms}}
} }