diff --git a/DESCRIPTION b/DESCRIPTION index 4ba3534f..331974c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.6.1.9033 +Version: 0.6.1.9034 Date: 2019-05-20 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/R/eucast_rules.R b/R/eucast_rules.R index 9bd9f59b..b92fae3a 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -291,7 +291,8 @@ eucast_rules <- function(x, "SXT", "VAN"), hard_dependencies = NULL, - verbose = verbose) + verbose = verbose, + ...) AMC <- cols_ab['AMC'] AMK <- cols_ab['AMK'] diff --git a/R/mdro.R b/R/mdro.R index eba2b7cc..175bf947 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -64,41 +64,41 @@ mdro <- function(x, } if (length(country) > 1) { - stop('`country` must be a length one character string.', call. = FALSE) + stop("`country` must be a length one character string.", call. = FALSE) } if (is.null(country)) { - country <- 'EUCAST' + country <- "EUCAST" } country <- trimws(country) - if (tolower(country) != 'eucast' & !country %like% '^[a-z]{2}$') { - stop('This is not a valid ISO 3166-1 alpha-2 country code: "', country, '". Please see ?mdro.', call. = FALSE) + if (tolower(country) != "eucast" & !country %like% "^[a-z]{2}$") { + stop("This is not a valid ISO 3166-1 alpha-2 country code: '", country, "'. Please see ?mdro.", call. = FALSE) } # create list and make country code case-independent guideline <- list(country = list(code = tolower(country))) - if (guideline$country$code == 'eucast') { - guideline$country$name <- '(European guidelines)' - guideline$name <- 'EUCAST Expert Rules, "Intrinsic Resistance and Exceptional Phenotypes Tables"' - guideline$version <- 'Version 3.1' - guideline$source <- 'http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf' + if (guideline$country$code == "eucast") { + guideline$country$name <- "(European guidelines)" + guideline$name <- "EUCAST Expert Rules, \"Intrinsic Resistance and Exceptional Phenotypes Tables\"" + guideline$version <- "Version 3.1" + guideline$source <- "http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf" # support per country: - } else if (guideline$country$code == 'de') { - guideline$country$name <- 'Germany' - guideline$name <- '' - guideline$version <- '' - guideline$source <- '' - } else if (guideline$country$code == 'nl') { - guideline$country$name <- 'The Netherlands' - guideline$name <- 'WIP-Richtlijn BRMO' - guideline$version <- 'Revision as of December 2017' - guideline$source <- 'https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH' + } else if (guideline$country$code == "de") { + guideline$country$name <- "Germany" + guideline$name <- "" + guideline$version <- "" + guideline$source <- "" + } else if (guideline$country$code == "nl") { + guideline$country$name <- "The Netherlands" + guideline$name <- "WIP-Richtlijn BRMO" + guideline$version <- "Revision as of December 2017" + guideline$source <- "https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH" # add here more countries like this: - # } else if (country$code == 'xx') { - # country$name <- 'country name' + # } else if (country$code == "xx") { + # country$name <- "country name" } else { - stop('This country code is currently unsupported: ', guideline$country$code, call. = FALSE) + stop("This country code is currently unsupported: ", guideline$country$code, call. = FALSE) } if (info == TRUE) { @@ -110,71 +110,71 @@ mdro <- function(x, } - cols_ab <- get_column_abx(x = x, verbose = verbose) + cols_ab <- get_column_abx(x = x, verbose = verbose, ...) - AMC <- cols_ab['AMC'] - AMK <- cols_ab['AMK'] - AMP <- cols_ab['AMP'] - AMX <- cols_ab['AMX'] - ATM <- cols_ab['ATM'] - AZL <- cols_ab['AZL'] - AZM <- cols_ab['AZM'] - CAZ <- cols_ab['CAZ'] - CED <- cols_ab['CED'] - CHL <- cols_ab['CHL'] - CIP <- cols_ab['CIP'] - CLI <- cols_ab['CLI'] - CLR <- cols_ab['CLR'] - COL <- cols_ab['COL'] - CRO <- cols_ab['CRO'] - CTX <- cols_ab['CTX'] - CXM <- cols_ab['CXM'] - CZO <- cols_ab['CZO'] - DAP <- cols_ab['DAP'] - DOX <- cols_ab['DOX'] - ERY <- cols_ab['ERY'] - ETP <- cols_ab['ETP'] - FEP <- cols_ab['FEP'] - FLC <- cols_ab['FLC'] - FOS <- cols_ab['FOS'] - FOX <- cols_ab['FOX'] - FUS <- cols_ab['FUS'] - GEN <- cols_ab['GEN'] - IPM <- cols_ab['IPM'] - KAN <- cols_ab['KAN'] - LIN <- cols_ab['LIN'] - LNZ <- cols_ab['LNZ'] - LVX <- cols_ab['LVX'] - MEM <- cols_ab['MEM'] - MEZ <- cols_ab['MEZ'] - MTR <- cols_ab['MTR'] - MFX <- cols_ab['MFX'] - MNO <- cols_ab['MNO'] - NAL <- cols_ab['NAL'] - NEO <- cols_ab['NEO'] - NET <- cols_ab['NET'] - NIT <- cols_ab['NIT'] - NOR <- cols_ab['NOR'] - NOV <- cols_ab['NOV'] - OFX <- cols_ab['OFX'] - PEN <- cols_ab['PEN'] - PIP <- cols_ab['PIP'] - PLB <- cols_ab['PLB'] - PRI <- cols_ab['PRI'] - QDA <- cols_ab['QDA'] - RID <- cols_ab['RID'] - RIF <- cols_ab['RIF'] - RXT <- cols_ab['RXT'] - SIS <- cols_ab['SIS'] - SXT <- cols_ab['SXT'] - TCY <- cols_ab['TCY'] - TEC <- cols_ab['TEC'] - TGC <- cols_ab['TGC'] - TIC <- cols_ab['TIC'] - TMP <- cols_ab['TMP'] - TOB <- cols_ab['TOB'] - TZP <- cols_ab['TZP'] - VAN <- cols_ab['VAN'] + AMC <- cols_ab["AMC"] + AMK <- cols_ab["AMK"] + AMP <- cols_ab["AMP"] + AMX <- cols_ab["AMX"] + ATM <- cols_ab["ATM"] + AZL <- cols_ab["AZL"] + AZM <- cols_ab["AZM"] + CAZ <- cols_ab["CAZ"] + CED <- cols_ab["CED"] + CHL <- cols_ab["CHL"] + CIP <- cols_ab["CIP"] + CLI <- cols_ab["CLI"] + CLR <- cols_ab["CLR"] + COL <- cols_ab["COL"] + CRO <- cols_ab["CRO"] + CTX <- cols_ab["CTX"] + CXM <- cols_ab["CXM"] + CZO <- cols_ab["CZO"] + DAP <- cols_ab["DAP"] + DOX <- cols_ab["DOX"] + ERY <- cols_ab["ERY"] + ETP <- cols_ab["ETP"] + FEP <- cols_ab["FEP"] + FLC <- cols_ab["FLC"] + FOS <- cols_ab["FOS"] + FOX <- cols_ab["FOX"] + FUS <- cols_ab["FUS"] + GEN <- cols_ab["GEN"] + IPM <- cols_ab["IPM"] + KAN <- cols_ab["KAN"] + LIN <- cols_ab["LIN"] + LNZ <- cols_ab["LNZ"] + LVX <- cols_ab["LVX"] + MEM <- cols_ab["MEM"] + MEZ <- cols_ab["MEZ"] + MTR <- cols_ab["MTR"] + MFX <- cols_ab["MFX"] + MNO <- cols_ab["MNO"] + NAL <- cols_ab["NAL"] + NEO <- cols_ab["NEO"] + NET <- cols_ab["NET"] + NIT <- cols_ab["NIT"] + NOR <- cols_ab["NOR"] + NOV <- cols_ab["NOV"] + OFX <- cols_ab["OFX"] + PEN <- cols_ab["PEN"] + PIP <- cols_ab["PIP"] + PLB <- cols_ab["PLB"] + PRI <- cols_ab["PRI"] + QDA <- cols_ab["QDA"] + RID <- cols_ab["RID"] + RIF <- cols_ab["RIF"] + RXT <- cols_ab["RXT"] + SIS <- cols_ab["SIS"] + SXT <- cols_ab["SXT"] + TCY <- cols_ab["TCY"] + TEC <- cols_ab["TEC"] + TGC <- cols_ab["TGC"] + TIC <- cols_ab["TIC"] + TMP <- cols_ab["TMP"] + TOB <- cols_ab["TOB"] + TZP <- cols_ab["TZP"] + VAN <- cols_ab["VAN"] ab_missing <- function(ab) { @@ -194,15 +194,15 @@ mdro <- function(x, cols <- cols[!is.na(cols)] if (length(rows) > 0 & length(cols) > 0) { if (any_all == "any") { - col_filter <- which(tbl_[, cols] == 'R') + row_filter <- which(tbl_[, cols] == "R") } else if (any_all == "all") { - col_filter <- tbl_ %>% + row_filter <- tbl_ %>% mutate(index = 1:nrow(.)) %>% filter_at(vars(cols), all_vars(. == "R")) %>% pull((index)) } - rows <- rows[rows %in% col_filter] - tbl_[rows, 'MDRO'] <<- to + rows <- rows[rows %in% row_filter] + tbl_[rows, "MDRO"] <<- to } } @@ -213,105 +213,117 @@ mdro <- function(x, # add unconfirmed to where genus is available mutate(MDRO = ifelse(!is.na(genus), 1, NA_integer_)) - if (guideline$country$code == 'eucast') { + if (guideline$country$code == "eucast") { # EUCAST ------------------------------------------------------------------ # Table 5 trans_tbl(3, - which(tbl_$family == 'Enterobacteriaceae' - | tbl_$fullname %like% '^Pseudomonas aeruginosa' - | tbl_$genus == 'Acinetobacter'), + which(tbl_$family == "Enterobacteriaceae" + | tbl_$fullname %like% "^Pseudomonas aeruginosa" + | tbl_$genus == "Acinetobacter"), COL, "all") trans_tbl(3, - which(tbl_$fullname %like% '^Salmonella Typhi'), + which(tbl_$fullname %like% "^Salmonella Typhi"), c(carbapenems, fluoroquinolones), "any") trans_tbl(3, - which(tbl_$fullname %like% '^Haemophilus influenzae'), + which(tbl_$fullname %like% "^Haemophilus influenzae"), c(cephalosporins_3rd, carbapenems, fluoroquinolones), "any") trans_tbl(3, - which(tbl_$fullname %like% '^Moraxella catarrhalis'), + which(tbl_$fullname %like% "^Moraxella catarrhalis"), c(cephalosporins_3rd, fluoroquinolones), "any") trans_tbl(3, - which(tbl_$fullname %like% '^Neisseria meningitidis'), + which(tbl_$fullname %like% "^Neisseria meningitidis"), c(cephalosporins_3rd, fluoroquinolones), "any") trans_tbl(3, - which(tbl_$fullname %like% '^Neisseria gonorrhoeae'), + which(tbl_$fullname %like% "^Neisseria gonorrhoeae"), AZM, "any") # Table 6 trans_tbl(3, - which(tbl_$fullname %like% '^Staphylococcus (aureus|epidermidis|coagulase negatief|hominis|haemolyticus|intermedius|pseudointermedius)'), + which(tbl_$fullname %like% "^Staphylococcus (aureus|epidermidis|coagulase negatief|hominis|haemolyticus|intermedius|pseudointermedius)"), c(VAN, TEC, DAP, LNZ, QDA, TGC), "any") trans_tbl(3, - which(tbl_$genus == 'Corynebacterium'), + which(tbl_$genus == "Corynebacterium"), c(VAN, TEC, DAP, LNZ, QDA, TGC), "any") trans_tbl(3, - which(tbl_$fullname %like% '^Streptococcus pneumoniae'), + which(tbl_$fullname %like% "^Streptococcus pneumoniae"), c(carbapenems, VAN, TEC, DAP, LNZ, QDA, TGC, RIF), "any") trans_tbl(3, # Sr. groups A/B/C/G - which(tbl_$fullname %like% '^Streptococcus (pyogenes|agalactiae|equisimilis|equi|zooepidemicus|dysgalactiae|anginosus)'), + which(tbl_$fullname %like% "^Streptococcus (pyogenes|agalactiae|equisimilis|equi|zooepidemicus|dysgalactiae|anginosus)"), c(PEN, cephalosporins, VAN, TEC, DAP, LNZ, QDA, TGC), "any") trans_tbl(3, - which(tbl_$genus == 'Enterococcus'), + which(tbl_$genus == "Enterococcus"), c(DAP, LNZ, TGC, TEC), "any") trans_tbl(3, - which(tbl_$fullname %like% '^Enterococcus faecalis'), + which(tbl_$fullname %like% "^Enterococcus faecalis"), c(AMP, AMX), "any") # Table 7 trans_tbl(3, - which(tbl_$genus == 'Bacteroides'), + which(tbl_$genus == "Bacteroides"), MTR, "any") trans_tbl(3, - which(tbl_$fullname %like% '^Clostridium difficile'), - c( MTR, VAN), + which(tbl_$fullname %like% "^Clostridium difficile"), + c(MTR, VAN), "any") } - if (guideline$country$code == 'de') { + if (guideline$country$code == "de") { # Germany ----------------------------------------------------------------- stop("We are still working on German guidelines in this beta version.", call. = FALSE) } - if (guideline$country$code == 'nl') { + if (guideline$country$code == "nl") { # Netherlands ------------------------------------------------------------- - aminoglycosides <- aminoglycosides[!ab_missing(aminoglycosides)] - fluoroquinolones <- fluoroquinolones[!ab_missing(fluoroquinolones)] - carbapenems <- carbapenems[!ab_missing(carbapenems)] + aminoglycosides <- aminoglycosides[!is.na(aminoglycosides)] + fluoroquinolones <- fluoroquinolones[!is.na(fluoroquinolones)] + carbapenems <- carbapenems[!is.na(carbapenems)] + amino <- AMX %or% AMP + third <- CAZ %or% CTX + ESBLs <- c(amino, third) + ESBLs <- ESBLs[!is.na(ESBLs)] + if (length(ESBLs) != 2) { + ESBLs <- character(0) + } # Table 1 trans_tbl(3, - which(tbl_$family == 'Enterobacteriaceae'), + which(tbl_$family == "Enterobacteriaceae"), c(aminoglycosides, fluoroquinolones), "all") trans_tbl(2, - which(tbl_$family == 'Enterobacteriaceae'), - c(carbapenems), + which(tbl_$family == "Enterobacteriaceae"), + carbapenems, "any") + trans_tbl(2, + which(tbl_$family == "Enterobacteriaceae"), + ESBLs, + "all") + # Table 2 trans_tbl(2, - which(tbl_$genus == 'Acinetobacter'), + which(tbl_$genus == "Acinetobacter"), c(carbapenems), "any") trans_tbl(3, - which(tbl_$genus == 'Acinetobacter'), + which(tbl_$genus == "Acinetobacter"), c(aminoglycosides, fluoroquinolones), "all") trans_tbl(3, - which(tbl_$fullname %like% '^Stenotrophomonas maltophilia'), + which(tbl_$fullname %like% "^Stenotrophomonas maltophilia"), SXT, "all") @@ -330,28 +342,28 @@ mdro <- function(x, tbl_$psae <- 0 } tbl_[which( - tbl_$fullname %like% 'Pseudomonas aeruginosa' + tbl_$fullname %like% "Pseudomonas aeruginosa" & tbl_$psae >= 3 - ), 'MDRO'] <- 3 + ), "MDRO"] <- 3 # Table 3 trans_tbl(3, - which(tbl_$fullname %like% 'Streptococcus pneumoniae'), + which(tbl_$fullname %like% "Streptococcus pneumoniae"), PEN, "all") trans_tbl(3, - which(tbl_$fullname %like% 'Streptococcus pneumoniae'), + which(tbl_$fullname %like% "Streptococcus pneumoniae"), VAN, "all") trans_tbl(3, - which(tbl_$fullname %like% 'Enterococcus faecium'), + which(tbl_$fullname %like% "Enterococcus faecium"), c(PEN, VAN), "all") } factor(x = tbl_$MDRO, levels = 1:3, - labels = c('Negative', 'Positive, unconfirmed', 'Positive'), + labels = c("Negative", "Positive, unconfirmed", "Positive"), ordered = TRUE) } @@ -372,55 +384,3 @@ mrgn <- function(x, country = "de", ...) { eucast_exceptional_phenotypes <- function(x, country = "EUCAST", ...) { mdro(x = x, country = "EUCAST", ...) } - -# is_ESBL <- function(x, col_mo = NULL, ...) { -# get_ab_col <- function(columns, ab) { -# columns[names(columns) == ab] -# } -# col_mo <- get_column_mo(tbl = x, col_mo = col_mo) -# cols_ab <- get_column_abx(tbl = x, -# soft_dependencies = c("AMX", "AMP"), -# hard_dependencies = c("CAZ"), -# ...) -# -# if (!any(c("AMX", "AMP") %in% names(cols_ab))) { -# # both ampicillin and amoxicillin are missing -# generate_warning_abs_missing(c("AMX", "AMP"), any = TRUE) -# return(rep(NA, nrow(x))) -# } -# -# ESBLs <- rep(NA, nrow(x)) -# -# # first make all eligible cases FALSE -# ESBLs[which(mo_family(x[, col_mo]) == "Enterobacteriaceae" -# & x[, get_ab_col(cols_ab, "AMX")] %in% c("R", "I", "S") -# & x[, get_ab_col(cols_ab, "AMX")] %in% c("R", "I", "S") -# & x[, get_ab_col(cols_ab, "AMX")] %in% c("R", "I", "S") -# )] <- FALSE -# # now make the positives cases TRUE -# ESBLs[which(!is.na(ESBLs) -# & x[, get_ab_col(cols_ab, "AMX")] == "R" -# & x[, get_ab_col(cols_ab, "CAZ")] == "R")] <- TRUE -# ESBLs -# -# } -# -# is_3MRGN <- function(x, ...) { -# -# } -# -# is_4MRGN <- function(x, ...) { -# -# } - -get_column_mo <- function(tbl, col_mo = NULL) { - # throws a blue note about which column will be used if guessed - if (is.null(col_mo)) { - col_mo <- search_type_in_df(tbl = tbl, type = "mo") - } - if (is.null(col_mo)) { - stop("`col_mo` must be set.", call. = FALSE) - } - col_mo -} - diff --git a/R/misc.R b/R/misc.R index 2739c5b1..8c4eb0f8 100755 --- a/R/misc.R +++ b/R/misc.R @@ -157,23 +157,56 @@ search_type_in_df <- function(tbl, type) { get_column_abx <- function(x, soft_dependencies = NULL, hard_dependencies = NULL, - verbose = FALSE) { + verbose = FALSE, + ...) { + # determine from given data set df_trans <- data.frame(colnames = colnames(x), abcode = suppressWarnings(as.ab(colnames(x)))) df_trans <- df_trans[!is.na(df_trans$abcode),] x <- as.character(df_trans$colnames) names(x) <- df_trans$abcode + + # add from self-defined dots (...): + # get_column_abx(septic_patients %>% rename(thisone = AMX), amox = "thisone") + dots <- list(...) + if (length(dots) > 0) { + dots <- unlist(dots) + newnames <- suppressWarnings(as.ab(names(dots))) + if (any(is.na(newnames))) { + warning("Invalid antibiotic reference(s): ", toString(names(dots)[is.na(newnames)]), + call. = FALSE, immediate. = TRUE) + } + names(dots) <- newnames + dots <- dots[!is.na(names(dots))] + # merge, but overwrite automatically determined ones by 'dots' + x <- c(x[!x %in% dots & !names(x) %in% names(dots)], dots) + } + # sort on name x <- x[sort(names(x))] + duplies <- x[base::duplicated(x)] if (verbose == TRUE) { for (i in 1:length(x)) { - message(blue(paste0("NOTE: Using column `", bold(x[i]), "` as input for ", names(x)[i], - " (", ab_name(names(x)[i], language = "en", tolower = TRUE), ")."))) + if (x[i] %in% duplies) { + message(red(paste0("NOTE: Using column `", bold(x[i]), "` as input for ", names(x)[i], + " (", ab_name(names(x)[i], language = "en", tolower = TRUE), ") [DUPLICATED USE]."))) + } else { + message(blue(paste0("NOTE: Using column `", bold(x[i]), "` as input for ", names(x)[i], + " (", ab_name(names(x)[i], language = "en", tolower = TRUE), ")."))) + } } } + if (n_distinct(x) != length(x)) { + msg_txt <- paste("Column(s)", paste0("'", duplies, "'", collapse = "'"), "used for more than one antibiotic.") + if (verbose == FALSE) { + msg_txt <- paste(msg_txt, "Use verbose = TRUE to see which antibiotics are used by which columns.") + } + stop(msg_txt, call. = FALSE) + } + if (!is.null(hard_dependencies)) { if (!all(hard_dependencies %in% names(x))) { # missing a hard dependency will return NA and consequently the data will not be analysed @@ -275,3 +308,7 @@ t <- function(from, language = get_locale()) { base::enc2utf8(from) } + +"%or%" <- function(x, y) { + ifelse(!is.na(x), x, ifelse(!is.na(y), y, NA)) +} diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 545bc27f..f314972c 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9034 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 6c353812..43dbe901 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 @@ -327,20 +327,9 @@ -2014-11-27 -T8 -Hospital B -Escherichia coli -R -S -R -S -F - - -2016-12-03 -R9 -Hospital B +2013-08-26 +Q7 +Hospital A Staphylococcus aureus S S @@ -348,42 +337,20 @@ S F - -2013-11-11 -M6 -Hospital D -Staphylococcus aureus -S -S -S -S -M - -2014-03-17 -O9 -Hospital B +2012-10-04 +O2 +Hospital A Escherichia coli -S R S S +S F -2012-10-08 -R4 -Hospital C -Streptococcus pneumoniae -S -S -S -S -F - - -2015-10-15 -C5 +2012-10-23 +C4 Hospital C Escherichia coli S @@ -392,6 +359,39 @@ S M + +2011-08-17 +R4 +Hospital B +Escherichia coli +R +S +R +S +F + + +2016-01-18 +L2 +Hospital B +Escherichia coli +S +S +S +S +M + + +2011-09-06 +O1 +Hospital A +Escherichia coli +R +S +S +S +F +

Now, let’s start the cleaning and the analysis!

@@ -411,8 +411,8 @@ # # Item Count Percent Cum. Count Cum. Percent # --- ----- ------- -------- ----------- ------------- -# 1 M 10,370 51.8% 10,370 51.8% -# 2 F 9,630 48.2% 20,000 100.0% +# 1 M 10,378 51.9% 10,378 51.9% +# 2 F 9,622 48.1% 20,000 100.0%

So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values M and F. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.

The data is already quite clean, but we still need to transform some variables. The bacteria column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The mutate() function of the dplyr package makes this really easy:

data <- data %>%
@@ -442,14 +442,14 @@
 # Pasteurella multocida (no new changes)
 # Staphylococcus (no new changes)
 # Streptococcus groups A, B, C, G (no new changes)
-# Streptococcus pneumoniae (1414 new changes)
+# Streptococcus pneumoniae (1443 new changes)
 # Viridans group streptococci (no new changes)
 # 
 # EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 01: Intrinsic resistance in Enterobacteriaceae (1367 new changes)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1303 new changes)
 # Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)
 # Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)
-# Table 04: Intrinsic resistance in Gram-positive bacteria (2649 new changes)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2746 new changes)
 # Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)
 # Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)
 # Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)
@@ -457,24 +457,24 @@
 # Table 13: Interpretive rules for quinolones (no new changes)
 # 
 # Other rules
-# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2211 new changes)
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (107 new changes)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2313 new changes)
+# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (115 new changes)
 # Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)
 # Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)
 # Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)
 # Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)
 # 
 # --------------------------------------------------------------------------
-# EUCAST rules affected 6,442 out of 20,000 rows, making a total of 7,748 edits
+# EUCAST rules affected 6,579 out of 20,000 rows, making a total of 7,920 edits
 # => added 0 test results
 # 
-# => changed 7,748 test results
-#    - 94 test results changed from S to I
-#    - 4,687 test results changed from S to R
-#    - 1,084 test results changed from I to S
-#    - 313 test results changed from I to R
-#    - 1,548 test results changed from R to S
-#    - 22 test results changed from R to I
+# => changed 7,920 test results
+#    - 123 test results changed from S to I
+#    - 4,680 test results changed from S to R
+#    - 1,131 test results changed from I to S
+#    - 306 test results changed from I to R
+#    - 1,657 test results changed from R to S
+#    - 23 test results changed from R to I
 # --------------------------------------------------------------------------
 # 
 # Use verbose = TRUE to get a data.frame with all specified edits instead.
@@ -502,8 +502,8 @@ # NOTE: Using column `bacteria` as input for `col_mo`. # NOTE: Using column `date` as input for `col_date`. # NOTE: Using column `patient_id` as input for `col_patient_id`. -# => Found 5,692 first isolates (28.5% of total) -

So only 28.5% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

+# => Found 5,674 first isolates (28.4% of total) +

So only 28.4% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

data_1st <- data %>% 
   filter(first == TRUE)

For future use, the above two syntaxes can be shortened with the filter_first_isolate() function:

@@ -529,8 +529,8 @@ 1 -2010-01-18 -F5 +2010-03-19 +N8 B_ESCHR_COL S S @@ -540,10 +540,10 @@ 2 -2010-02-13 -F5 +2010-05-06 +N8 B_ESCHR_COL -S +R S S S @@ -551,8 +551,8 @@ 3 -2010-04-04 -F5 +2010-05-20 +N8 B_ESCHR_COL R S @@ -562,10 +562,10 @@ 4 -2010-04-28 -F5 +2010-07-20 +N8 B_ESCHR_COL -R +S S S S @@ -573,21 +573,21 @@ 5 -2010-08-22 -F5 +2010-09-04 +N8 B_ESCHR_COL S S -R +S S FALSE 6 -2010-10-07 -F5 +2010-09-13 +N8 B_ESCHR_COL -S +R S S S @@ -595,30 +595,8 @@ 7 -2010-10-15 -F5 -B_ESCHR_COL -R -R -R -S -FALSE - - -8 -2010-11-24 -F5 -B_ESCHR_COL -R -I -S -R -FALSE - - -9 -2011-05-09 -F5 +2011-04-01 +N8 B_ESCHR_COL S S @@ -627,14 +605,36 @@ TRUE -10 -2011-05-17 -F5 +8 +2011-10-15 +N8 B_ESCHR_COL R -R -R -R +S +S +S +FALSE + + +9 +2011-11-14 +N8 +B_ESCHR_COL +S +S +S +S +FALSE + + +10 +2012-02-11 +N8 +B_ESCHR_COL +S +S +S +S FALSE @@ -650,7 +650,7 @@ # NOTE: Using column `patient_id` as input for `col_patient_id`. # NOTE: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this. # [Criterion] Inclusion based on key antibiotics, ignoring I. -# => Found 15,100 first weighted isolates (75.5% of total) +# => Found 14,968 first weighted isolates (74.8% of total) @@ -667,8 +667,8 @@ - - + + @@ -679,119 +679,119 @@ - - + + - + - + - - + + - + - - - - - - - - - - - - - - + + - + - - - - + + + + + + + + + + + + + + + + - - + + - - - - + + + + - - + + - - + + - - + + - + - - + + - - - - + + + + + -
isolate
12010-01-18F52010-03-19N8 B_ESCHR_COL S S
22010-02-13F52010-05-06N8 B_ESCHR_COLSR S S S FALSEFALSETRUE
32010-04-04F52010-05-20N8 B_ESCHR_COL R S S S FALSETRUEFALSE
42010-04-28F5B_ESCHR_COLRSSSFALSEFALSE
52010-08-22F52010-07-20N8 B_ESCHR_COL S SRS S FALSE TRUE
62010-10-07F5
52010-09-04N8 B_ESCHR_COL S S S S FALSEFALSE
62010-09-13N8B_ESCHR_COLRSSSFALSE TRUE
72010-10-15F52011-04-01N8 B_ESCHR_COLRRR SFALSESSSTRUE TRUE
82010-11-24F52011-10-15N8 B_ESCHR_COL RI SRSS FALSE TRUE
92011-05-09F52011-11-14N8 B_ESCHR_COL S S S STRUEFALSE TRUE
102011-05-17F52012-02-11N8 B_ESCHR_COLRRRRSSSSFALSE FALSETRUE
-

Instead of 2, now 8 isolates are flagged. In total, 75.5% of all isolates are marked ‘first weighted’ - 47% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

+

Instead of 2, now 7 isolates are flagged. In total, 74.8% of all isolates are marked ‘first weighted’ - 46.5% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

As with filter_first_isolate(), there’s a shortcut for this new algorithm too:

data_1st <- data %>% 
   filter_first_weighted_isolate()
-

So we end up with 15,100 isolates for analysis.

+

So we end up with 14,968 isolates for analysis.

We can remove unneeded columns:

data_1st <- data_1st %>% 
   select(-c(first, keyab))
@@ -799,7 +799,6 @@
head(data_1st)
- @@ -816,74 +815,24 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - + + + + @@ -895,20 +844,64 @@ - - - - - - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -928,9 +921,9 @@
freq(paste(data_1st$genus, data_1st$species))

Or can be used like the dplyr way, which is easier readable:

data_1st %>% freq(genus, species)
-

Frequency table of genus and species from a data.frame (15,100 x 13)

+

Frequency table of genus and species from a data.frame (14,968 x 13)

Columns: 2
-Length: 15,100 (of which NA: 0 = 0.00%)
+Length: 14,968 (of which NA: 0 = 0.00%)
Unique: 4

Shortest: 16
Longest: 24

@@ -947,33 +940,33 @@ Longest: 24

- - - - + + + + - - - - + + + + - - - - + + + + - - - + + + @@ -984,7 +977,7 @@ Longest: 24

Resistance percentages

The functions portion_S(), portion_SI(), portion_I(), portion_IR() and portion_R() can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (portion_R()) and susceptibility as the portion of S and I (portion_SI()). These functions can be used on their own:

data_1st %>% portion_R(AMX)
-# [1] 0.4688742
+# [1] 0.4659941

Or can be used in conjuction with group_by() and summarise(), both from the dplyr package:

data_1st %>% 
   group_by(hospital) %>% 
@@ -997,19 +990,19 @@ Longest: 24

- + - + - + - +
date patient_id hospital
12014-11-27T8Hospital BB_ESCHR_COLRSRSFGram negativeEscherichiacoliTRUE
42014-03-17O9Hospital BB_ESCHR_COLSSSSFGram negativeEscherichiacoliTRUE
52012-10-08R4Hospital CB_STRPT_PNESSSRFGram positiveStreptococcuspneumoniaeTRUE
82016-05-04V62013-08-26Q7 Hospital A B_STPHY_AURR SRRSSS F Gram positive Staphylococcus aureus TRUE
92016-06-27Z9Hospital B
2012-10-04O2Hospital A B_ESCHR_COL R Scoli TRUE
102015-06-28K1Hospital DB_STPHY_AUR
2012-10-23C4Hospital CB_ESCHR_COL S S S S MGram positiveStaphylococcusaureusGram negativeEscherichiacoliTRUE
2011-08-17R4Hospital BB_ESCHR_COLRSRSFGram negativeEscherichiacoliTRUE
2016-01-18L2Hospital BB_ESCHR_COLSSSSMGram negativeEscherichiacoliTRUE
2011-09-06O1Hospital AB_ESCHR_COLRSSSFGram negativeEscherichiacoli TRUE
1 Escherichia coli7,48649.6%7,48649.6%7,39449.4%7,39449.4%
2 Staphylococcus aureus3,73024.7%11,21674.3%3,71624.8%11,11074.2%
3 Streptococcus pneumoniae2,25714.9%13,47389.2%2,29115.3%13,40189.5%
4 Klebsiella pneumoniae1,62710.8%15,1001,56710.5%14,968 100.0%
Hospital A0.45885510.4708540
Hospital B0.46652880.4617585
Hospital C0.48043180.4622030
Hospital D0.47910590.4691689
@@ -1027,23 +1020,23 @@ Longest: 24

Hospital A -0.4588551 -4472 +0.4708540 +4426 Hospital B -0.4665288 -5318 +0.4617585 +5243 Hospital C -0.4804318 -2223 +0.4622030 +2315 Hospital D -0.4791059 -3087 +0.4691689 +2984 @@ -1063,27 +1056,27 @@ Longest: 24

Escherichia -0.9219877 -0.8928667 -0.9931873 +0.9249391 +0.8991074 +0.9935082 Klebsiella -0.8236017 -0.9053473 -0.9883221 +0.8162093 +0.9119336 +0.9910657 Staphylococcus -0.9235925 -0.9227882 -0.9962466 +0.9179225 +0.9198062 +0.9916577 Streptococcus -0.6167479 +0.6294195 0.0000000 -0.6167479 +0.6294195 diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png index 91255b9c..dcc9a169 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png index 4765d37e..21f93a78 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png index 2cd3f9dc..0003b4a2 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png index 9df3830e..8eb926cf 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ diff --git a/docs/articles/EUCAST.html b/docs/articles/EUCAST.html index 76249187..d99e246f 100644 --- a/docs/articles/EUCAST.html +++ b/docs/articles/EUCAST.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html index 582a1bd6..9f4476b1 100644 --- a/docs/articles/SPSS.html +++ b/docs/articles/SPSS.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 diff --git a/docs/articles/ab_property.html b/docs/articles/ab_property.html index f50e8289..531f999c 100644 --- a/docs/articles/ab_property.html +++ b/docs/articles/ab_property.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index 536041b8..fcd9387c 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 @@ -217,14 +217,14 @@ times = 10) print(S.aureus, unit = "ms", signif = 2) # Unit: milliseconds -# expr min lq mean median uq max neval -# as.mo("sau") 17 17 22.0 18 18.0 66 10 -# as.mo("stau") 47 48 52.0 48 48.0 92 10 -# as.mo("staaur") 18 18 35.0 18 62.0 66 10 -# as.mo("STAAUR") 17 18 25.0 18 18.0 54 10 -# as.mo("S. aureus") 28 28 41.0 28 72.0 73 10 -# as.mo("S. aureus") 28 28 41.0 28 28.0 120 10 -# as.mo("Staphylococcus aureus") 8 8 9.3 8 8.1 20 10
+# expr min lq mean median uq max neval +# as.mo("sau") 18 18 22.0 18 18.0 62.0 10 +# as.mo("stau") 47 47 57.0 48 50.0 92.0 10 +# as.mo("staaur") 17 18 23.0 18 19.0 62.0 10 +# as.mo("STAAUR") 17 17 18.0 17 18.0 23.0 10 +# as.mo("S. aureus") 28 28 38.0 29 29.0 78.0 10 +# as.mo("S. aureus") 28 28 48.0 29 73.0 130.0 10 +# as.mo("Staphylococcus aureus") 8 8 8.1 8 8.1 8.2 10

In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.

To achieve this speed, the as.mo function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of Thermus islandicus (B_THERMS_ISL), a bug probably never found before in humans:

T.islandicus <- microbenchmark(as.mo("theisl"),
@@ -236,12 +236,12 @@
 print(T.islandicus, unit = "ms", signif = 2)
 # Unit: milliseconds
 #                         expr min  lq mean median  uq max neval
-#              as.mo("theisl") 470 470  500    510 520 530    10
-#              as.mo("THEISL") 470 470  490    470 520 520    10
-#       as.mo("T. islandicus")  74  74   87     74 120 120    10
-#      as.mo("T.  islandicus")  74  74   89     74 120 140    10
-#  as.mo("Thermus islandicus")  73  73   93     74 120 120    10
-

That takes 7.8 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like Thermus islandicus) are almost fast - these are the most probable input from most data sets.

+# as.mo("theisl") 470 480 510 520 530 530 10 +# as.mo("THEISL") 470 470 500 490 520 530 10 +# as.mo("T. islandicus") 74 75 85 76 81 120 10 +# as.mo("T. islandicus") 74 75 92 76 120 140 10 +# as.mo("Thermus islandicus") 73 73 74 74 74 75 10 +

That takes 8.2 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like Thermus islandicus) are almost fast - these are the most probable input from most data sets.

In the figure below, we compare Escherichia coli (which is very common) with Prevotella brevis (which is moderately common) and with Thermus islandicus (which is very uncommon):

par(mar = c(5, 16, 4, 2)) # set more space for left margin text (16)
 
@@ -287,8 +287,8 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #            expr min  lq mean median  uq max neval
-#  mo_fullname(x) 639 681  745    720 770 910    10
-

So transforming 500,000 values (!!) of 50 unique values only takes 0.72 seconds (719 ms). You only lose time on your unique input values.

+# mo_fullname(x) 677 770 812 790 884 988 10 +

So transforming 500,000 values (!!) of 50 unique values only takes 0.79 seconds (789 ms). You only lose time on your unique input values.

@@ -300,10 +300,10 @@ times = 10) print(run_it, unit = "ms", signif = 3) # Unit: milliseconds -# expr min lq mean median uq max neval -# A 12.90 13.2 13.40 13.40 13.80 14.00 10 -# B 25.30 25.7 31.00 27.10 27.50 70.10 10 -# C 1.38 1.6 1.69 1.69 1.72 1.97 10

+# expr min lq mean median uq max neval +# A 12.9 13.20 13.30 13.40 13.50 13.50 10 +# B 25.3 25.80 30.40 25.80 26.20 71.60 10 +# C 1.3 1.37 1.56 1.67 1.73 1.74 10

So going from mo_fullname("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0017 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

run_it <- microbenchmark(A = mo_species("aureus"),
                          B = mo_genus("Staphylococcus"),
@@ -317,14 +317,14 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #  expr   min    lq  mean median    uq   max neval
-#     A 0.392 0.485 0.577  0.580 0.628 0.808    10
-#     B 0.444 0.521 0.566  0.567 0.609 0.710    10
-#     C 1.380 1.680 1.750  1.760 1.820 2.160    10
-#     D 0.422 0.522 0.564  0.553 0.640 0.644    10
-#     E 0.362 0.443 0.520  0.543 0.595 0.684    10
-#     F 0.347 0.432 0.515  0.495 0.585 0.728    10
-#     G 0.377 0.417 0.479  0.463 0.495 0.681    10
-#     H 0.263 0.264 0.310  0.282 0.350 0.436    10
+# A 0.442 0.477 0.583 0.572 0.673 0.806 10 +# B 0.442 0.502 0.626 0.611 0.761 0.826 10 +# C 1.360 1.620 1.820 1.810 2.060 2.150 10 +# D 0.449 0.514 0.622 0.639 0.725 0.798 10 +# E 0.401 0.440 0.530 0.508 0.568 0.799 10 +# F 0.353 0.391 0.502 0.494 0.635 0.695 10 +# G 0.451 0.559 0.595 0.609 0.646 0.747 10 +# H 0.191 0.278 0.395 0.376 0.528 0.653 10

Of course, when running mo_phylum("Firmicutes") the function has zero knowledge about the actual microorganism, namely S. aureus. But since the result would be "Firmicutes" too, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.

@@ -351,13 +351,13 @@ print(run_it, unit = "ms", signif = 4) # Unit: milliseconds # expr min lq mean median uq max neval -# en 18.15 18.27 22.87 18.31 18.68 63.44 10 -# de 23.03 23.14 27.80 23.20 23.53 68.60 10 -# nl 36.67 36.71 41.51 37.01 37.41 81.57 10 -# es 23.07 23.11 23.25 23.21 23.26 23.63 10 -# it 22.93 23.04 23.17 23.08 23.19 23.62 10 -# fr 23.13 23.21 27.71 23.30 23.31 67.70 10 -# pt 23.08 23.18 27.85 23.23 23.98 67.96 10
+# en 18.16 18.23 22.82 18.29 18.57 63.28 10 +# de 23.00 23.09 23.35 23.21 23.59 23.96 10 +# nl 36.60 36.74 37.00 36.97 37.32 37.41 10 +# es 23.10 23.15 23.40 23.29 23.63 23.97 10 +# it 23.04 23.14 23.28 23.27 23.43 23.58 10 +# fr 23.13 23.21 33.12 23.90 28.96 68.96 10 +# pt 22.98 23.16 23.37 23.44 23.51 23.65 10

Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.

diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png index d4a59c07..f1fd99d1 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 2b66d591..1ce938da 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9034 diff --git a/docs/articles/mo_property.html b/docs/articles/mo_property.html index 2db6b9e7..bc2daca7 100644 --- a/docs/articles/mo_property.html +++ b/docs/articles/mo_property.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 diff --git a/docs/articles/resistance_predict.html b/docs/articles/resistance_predict.html index 9caa6ed7..224ba3ba 100644 --- a/docs/articles/resistance_predict.html +++ b/docs/articles/resistance_predict.html @@ -40,7 +40,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 diff --git a/docs/authors.html b/docs/authors.html index c9a82572..e1b4b482 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9034 diff --git a/docs/index.html b/docs/index.html index 4bfd1484..e7b5bbda 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9034 diff --git a/docs/news/index.html b/docs/news/index.html index c2b6a3c1..ca6d8444 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9034 diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index 2f5c2b20..511d07d4 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9003 + 0.6.1.9034 diff --git a/docs/reference/index.html b/docs/reference/index.html index c0e9f866..a2b74a4d 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9033 + 0.6.1.9034 diff --git a/tests/testthat/test-mdro.R b/tests/testthat/test-mdro.R index 7521eba6..831a758e 100755 --- a/tests/testthat/test-mdro.R +++ b/tests/testthat/test-mdro.R @@ -40,7 +40,7 @@ test_that("mdro works", { # septic_patients should have these finding using Dutch guidelines expect_equal(outcome %>% freq() %>% pull(count), - c(1989, 9, 2)) # 1989 neg, 9 pos, 2 unconfirmed + c(1969, 25, 6)) # 1969 neg, 25 unconfirmed, 6 pos expect_equal( suppressWarnings( diff --git a/tests/testthat/test-misc.R b/tests/testthat/test-misc.R index 1403da12..e617aa3a 100755 --- a/tests/testthat/test-misc.R +++ b/tests/testthat/test-misc.R @@ -48,4 +48,6 @@ test_that("looking up ab columns works", { expect_warning(generate_warning_abs_missing(c("AMP", "AMX"), any = TRUE)) expect_warning(get_column_abx(septic_patients, hard_dependencies = "FUS")) expect_warning(get_column_abx(septic_patients, soft_dependencies = "FUS")) + expect_error(get_column_abx(dplyr::rename(septic_patients, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = TRUE)) + expect_error(get_column_abx(dplyr::rename(septic_patients, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = FALSE)) })