faster determination of abx
@ -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(
|
||||
|
@ -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']
|
||||
|
314
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
|
||||
}
|
||||
|
||||
|
43
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))
|
||||
}
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -327,20 +327,9 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">2014-11-27</td>
|
||||
<td align="center">T8</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2016-12-03</td>
|
||||
<td align="center">R9</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">2013-08-26</td>
|
||||
<td align="center">Q7</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -348,42 +337,20 @@
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2013-11-11</td>
|
||||
<td align="center">M6</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2014-03-17</td>
|
||||
<td align="center">O9</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">2012-10-04</td>
|
||||
<td align="center">O2</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2012-10-08</td>
|
||||
<td align="center">R4</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2015-10-15</td>
|
||||
<td align="center">C5</td>
|
||||
<td align="center">2012-10-23</td>
|
||||
<td align="center">C4</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
@ -392,6 +359,39 @@
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2011-08-17</td>
|
||||
<td align="center">R4</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2016-01-18</td>
|
||||
<td align="center">L2</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2011-09-06</td>
|
||||
<td align="center">O1</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Now, let’s start the cleaning and the analysis!</p>
|
||||
@ -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%</code></pre>
|
||||
# 1 M 10,378 51.9% 10,378 51.9%
|
||||
# 2 F 9,622 48.1% 20,000 100.0%</code></pre>
|
||||
<p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.</p>
|
||||
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> 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 <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1">data <-<span class="st"> </span>data <span class="op">%>%</span></a>
|
||||
@ -442,14 +442,14 @@
|
||||
<a class="sourceLine" id="cb14-18" title="18"><span class="co"># Pasteurella multocida (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-19" title="19"><span class="co"># Staphylococcus (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-20" title="20"><span class="co"># Streptococcus groups A, B, C, G (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-21" title="21"><span class="co"># Streptococcus pneumoniae (1414 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-21" title="21"><span class="co"># Streptococcus pneumoniae (1443 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-22" title="22"><span class="co"># Viridans group streptococci (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-23" title="23"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb14-24" title="24"><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
|
||||
<a class="sourceLine" id="cb14-25" title="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1367 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-25" title="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1303 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-26" title="26"><span class="co"># Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-27" title="27"><span class="co"># Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-28" title="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2649 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-28" title="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2746 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-29" title="29"><span class="co"># Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-30" title="30"><span class="co"># Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-31" title="31"><span class="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a>
|
||||
@ -457,24 +457,24 @@
|
||||
<a class="sourceLine" id="cb14-33" title="33"><span class="co"># Table 13: Interpretive rules for quinolones (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-34" title="34"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb14-35" title="35"><span class="co"># Other rules</span></a>
|
||||
<a class="sourceLine" id="cb14-36" title="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2211 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-37" title="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (107 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-36" title="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2313 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-37" title="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (115 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-38" title="38"><span class="co"># Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-39" title="39"><span class="co"># Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-40" title="40"><span class="co"># Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-41" title="41"><span class="co"># Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-42" title="42"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb14-43" title="43"><span class="co"># --------------------------------------------------------------------------</span></a>
|
||||
<a class="sourceLine" id="cb14-44" title="44"><span class="co"># EUCAST rules affected 6,442 out of 20,000 rows, making a total of 7,748 edits</span></a>
|
||||
<a class="sourceLine" id="cb14-44" title="44"><span class="co"># EUCAST rules affected 6,579 out of 20,000 rows, making a total of 7,920 edits</span></a>
|
||||
<a class="sourceLine" id="cb14-45" title="45"><span class="co"># => added 0 test results</span></a>
|
||||
<a class="sourceLine" id="cb14-46" title="46"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb14-47" title="47"><span class="co"># => changed 7,748 test results</span></a>
|
||||
<a class="sourceLine" id="cb14-48" title="48"><span class="co"># - 94 test results changed from S to I</span></a>
|
||||
<a class="sourceLine" id="cb14-49" title="49"><span class="co"># - 4,687 test results changed from S to R</span></a>
|
||||
<a class="sourceLine" id="cb14-50" title="50"><span class="co"># - 1,084 test results changed from I to S</span></a>
|
||||
<a class="sourceLine" id="cb14-51" title="51"><span class="co"># - 313 test results changed from I to R</span></a>
|
||||
<a class="sourceLine" id="cb14-52" title="52"><span class="co"># - 1,548 test results changed from R to S</span></a>
|
||||
<a class="sourceLine" id="cb14-53" title="53"><span class="co"># - 22 test results changed from R to I</span></a>
|
||||
<a class="sourceLine" id="cb14-47" title="47"><span class="co"># => changed 7,920 test results</span></a>
|
||||
<a class="sourceLine" id="cb14-48" title="48"><span class="co"># - 123 test results changed from S to I</span></a>
|
||||
<a class="sourceLine" id="cb14-49" title="49"><span class="co"># - 4,680 test results changed from S to R</span></a>
|
||||
<a class="sourceLine" id="cb14-50" title="50"><span class="co"># - 1,131 test results changed from I to S</span></a>
|
||||
<a class="sourceLine" id="cb14-51" title="51"><span class="co"># - 306 test results changed from I to R</span></a>
|
||||
<a class="sourceLine" id="cb14-52" title="52"><span class="co"># - 1,657 test results changed from R to S</span></a>
|
||||
<a class="sourceLine" id="cb14-53" title="53"><span class="co"># - 23 test results changed from R to I</span></a>
|
||||
<a class="sourceLine" id="cb14-54" title="54"><span class="co"># --------------------------------------------------------------------------</span></a>
|
||||
<a class="sourceLine" id="cb14-55" title="55"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb14-56" title="56"><span class="co"># Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div>
|
||||
@ -502,8 +502,8 @@
|
||||
<a class="sourceLine" id="cb16-3" title="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
|
||||
<a class="sourceLine" id="cb16-4" title="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
|
||||
<a class="sourceLine" id="cb16-5" title="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
|
||||
<a class="sourceLine" id="cb16-6" title="6"><span class="co"># => Found 5,692 first isolates (28.5% of total)</span></a></code></pre></div>
|
||||
<p>So only 28.5% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
|
||||
<a class="sourceLine" id="cb16-6" title="6"><span class="co"># => Found 5,674 first isolates (28.4% of total)</span></a></code></pre></div>
|
||||
<p>So only 28.4% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
|
||||
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
|
||||
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
|
||||
@ -529,8 +529,8 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-18</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-03-19</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -540,10 +540,10 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-02-13</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-05-06</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -551,8 +551,8 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-04-04</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-05-20</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
@ -562,10 +562,10 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2010-04-28</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-07-20</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -573,21 +573,21 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2010-08-22</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-09-04</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2010-10-07</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-09-13</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -595,30 +595,8 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">7</td>
|
||||
<td align="center">2010-10-15</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2010-11-24</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2011-05-09</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2011-04-01</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -627,14 +605,36 @@
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2011-05-17</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">8</td>
|
||||
<td align="center">2011-10-15</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2011-11-14</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2012-02-11</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -650,7 +650,7 @@
|
||||
<a class="sourceLine" id="cb19-7" title="7"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
|
||||
<a class="sourceLine" id="cb19-8" title="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
|
||||
<a class="sourceLine" id="cb19-9" title="9"><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
|
||||
<a class="sourceLine" id="cb19-10" title="10"><span class="co"># => Found 15,100 first weighted isolates (75.5% of total)</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb19-10" title="10"><span class="co"># => Found 14,968 first weighted isolates (74.8% of total)</span></a></code></pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="center">isolate</th>
|
||||
@ -667,8 +667,8 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-18</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-03-19</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -679,119 +679,119 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-02-13</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-05-06</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-04-04</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-05-20</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2010-04-28</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2010-08-22</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2010-07-20</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2010-10-07</td>
|
||||
<td align="center">F5</td>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2010-09-04</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2010-09-13</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">7</td>
|
||||
<td align="center">2010-10-15</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2011-04-01</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2010-11-24</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2011-10-15</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2011-05-09</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2011-11-14</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2011-05-17</td>
|
||||
<td align="center">F5</td>
|
||||
<td align="center">2012-02-11</td>
|
||||
<td align="center">N8</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>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.</p>
|
||||
<p>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.</p>
|
||||
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, there’s a shortcut for this new algorithm too:</p>
|
||||
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb20-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
|
||||
<p>So we end up with 15,100 isolates for analysis.</p>
|
||||
<p>So we end up with 14,968 isolates for analysis.</p>
|
||||
<p>We can remove unneeded columns:</p>
|
||||
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1">data_1st <-<span class="st"> </span>data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb21-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div>
|
||||
@ -799,7 +799,6 @@
|
||||
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data_1st)</a></code></pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th></th>
|
||||
<th align="center">date</th>
|
||||
<th align="center">patient_id</th>
|
||||
<th align="center">hospital</th>
|
||||
@ -816,74 +815,24 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>1</td>
|
||||
<td align="center">2014-11-27</td>
|
||||
<td align="center">T8</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>4</td>
|
||||
<td align="center">2014-03-17</td>
|
||||
<td align="center">O9</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>5</td>
|
||||
<td align="center">2012-10-08</td>
|
||||
<td align="center">R4</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">B_STRPT_PNE</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram positive</td>
|
||||
<td align="center">Streptococcus</td>
|
||||
<td align="center">pneumoniae</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>8</td>
|
||||
<td align="center">2016-05-04</td>
|
||||
<td align="center">V6</td>
|
||||
<td align="center">2013-08-26</td>
|
||||
<td align="center">Q7</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_STPHY_AUR</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram positive</td>
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">aureus</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>9</td>
|
||||
<td align="center">2016-06-27</td>
|
||||
<td align="center">Z9</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<tr class="even">
|
||||
<td align="center">2012-10-04</td>
|
||||
<td align="center">O2</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
@ -895,20 +844,64 @@
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>10</td>
|
||||
<td align="center">2015-06-28</td>
|
||||
<td align="center">K1</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">B_STPHY_AUR</td>
|
||||
<tr class="odd">
|
||||
<td align="center">2012-10-23</td>
|
||||
<td align="center">C4</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">Gram positive</td>
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">aureus</td>
|
||||
<td align="center">Gram negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2011-08-17</td>
|
||||
<td align="center">R4</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2016-01-18</td>
|
||||
<td align="center">L2</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">Gram negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2011-09-06</td>
|
||||
<td align="center">O1</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -928,9 +921,9 @@
|
||||
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1"><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/paste">paste</a></span>(data_1st<span class="op">$</span>genus, data_1st<span class="op">$</span>species))</a></code></pre></div>
|
||||
<p>Or can be used like the <code>dplyr</code> way, which is easier readable:</p>
|
||||
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">data_1st <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus, species)</a></code></pre></div>
|
||||
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,100 x 13)</strong></p>
|
||||
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (14,968 x 13)</strong></p>
|
||||
<p>Columns: 2<br>
|
||||
Length: 15,100 (of which NA: 0 = 0.00%)<br>
|
||||
Length: 14,968 (of which NA: 0 = 0.00%)<br>
|
||||
Unique: 4</p>
|
||||
<p>Shortest: 16<br>
|
||||
Longest: 24</p>
|
||||
@ -947,33 +940,33 @@ Longest: 24</p>
|
||||
<tr class="odd">
|
||||
<td align="left">1</td>
|
||||
<td align="left">Escherichia coli</td>
|
||||
<td align="right">7,486</td>
|
||||
<td align="right">49.6%</td>
|
||||
<td align="right">7,486</td>
|
||||
<td align="right">49.6%</td>
|
||||
<td align="right">7,394</td>
|
||||
<td align="right">49.4%</td>
|
||||
<td align="right">7,394</td>
|
||||
<td align="right">49.4%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Staphylococcus aureus</td>
|
||||
<td align="right">3,730</td>
|
||||
<td align="right">24.7%</td>
|
||||
<td align="right">11,216</td>
|
||||
<td align="right">74.3%</td>
|
||||
<td align="right">3,716</td>
|
||||
<td align="right">24.8%</td>
|
||||
<td align="right">11,110</td>
|
||||
<td align="right">74.2%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">Streptococcus pneumoniae</td>
|
||||
<td align="right">2,257</td>
|
||||
<td align="right">14.9%</td>
|
||||
<td align="right">13,473</td>
|
||||
<td align="right">89.2%</td>
|
||||
<td align="right">2,291</td>
|
||||
<td align="right">15.3%</td>
|
||||
<td align="right">13,401</td>
|
||||
<td align="right">89.5%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
<td align="left">Klebsiella pneumoniae</td>
|
||||
<td align="right">1,627</td>
|
||||
<td align="right">10.8%</td>
|
||||
<td align="right">15,100</td>
|
||||
<td align="right">1,567</td>
|
||||
<td align="right">10.5%</td>
|
||||
<td align="right">14,968</td>
|
||||
<td align="right">100.0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -984,7 +977,7 @@ Longest: 24</p>
|
||||
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2>
|
||||
<p>The functions <code><a href="../reference/portion.html">portion_S()</a></code>, <code><a href="../reference/portion.html">portion_SI()</a></code>, <code><a href="../reference/portion.html">portion_I()</a></code>, <code><a href="../reference/portion.html">portion_IR()</a></code> and <code><a href="../reference/portion.html">portion_R()</a></code> 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 (<code><a href="../reference/portion.html">portion_R()</a></code>) and susceptibility as the portion of S and I (<code><a href="../reference/portion.html">portion_SI()</a></code>). These functions can be used on their own:</p>
|
||||
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1">data_1st <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_R</a></span>(AMX)</a>
|
||||
<a class="sourceLine" id="cb25-2" title="2"><span class="co"># [1] 0.4688742</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb25-2" title="2"><span class="co"># [1] 0.4659941</span></a></code></pre></div>
|
||||
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
|
||||
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" title="1">data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb26-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
@ -997,19 +990,19 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">0.4588551</td>
|
||||
<td align="center">0.4708540</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4665288</td>
|
||||
<td align="center">0.4617585</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4804318</td>
|
||||
<td align="center">0.4622030</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4791059</td>
|
||||
<td align="center">0.4691689</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1027,23 +1020,23 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">0.4588551</td>
|
||||
<td align="center">4472</td>
|
||||
<td align="center">0.4708540</td>
|
||||
<td align="center">4426</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4665288</td>
|
||||
<td align="center">5318</td>
|
||||
<td align="center">0.4617585</td>
|
||||
<td align="center">5243</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4804318</td>
|
||||
<td align="center">2223</td>
|
||||
<td align="center">0.4622030</td>
|
||||
<td align="center">2315</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4791059</td>
|
||||
<td align="center">3087</td>
|
||||
<td align="center">0.4691689</td>
|
||||
<td align="center">2984</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1063,27 +1056,27 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">0.9219877</td>
|
||||
<td align="center">0.8928667</td>
|
||||
<td align="center">0.9931873</td>
|
||||
<td align="center">0.9249391</td>
|
||||
<td align="center">0.8991074</td>
|
||||
<td align="center">0.9935082</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Klebsiella</td>
|
||||
<td align="center">0.8236017</td>
|
||||
<td align="center">0.9053473</td>
|
||||
<td align="center">0.9883221</td>
|
||||
<td align="center">0.8162093</td>
|
||||
<td align="center">0.9119336</td>
|
||||
<td align="center">0.9910657</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">0.9235925</td>
|
||||
<td align="center">0.9227882</td>
|
||||
<td align="center">0.9962466</td>
|
||||
<td align="center">0.9179225</td>
|
||||
<td align="center">0.9198062</td>
|
||||
<td align="center">0.9916577</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Streptococcus</td>
|
||||
<td align="center">0.6167479</td>
|
||||
<td align="center">0.6294195</td>
|
||||
<td align="center">0.0000000</td>
|
||||
<td align="center">0.6167479</td>
|
||||
<td align="center">0.6294195</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -217,14 +217,14 @@
|
||||
<a class="sourceLine" id="cb2-8" title="8"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
|
||||
<a class="sourceLine" id="cb2-9" title="9"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb2-10" title="10"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co"># as.mo("sau") 17 17 22.0 18 18.0 66 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co"># as.mo("stau") 47 48 52.0 48 48.0 92 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co"># as.mo("staaur") 18 18 35.0 18 62.0 66 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co"># as.mo("STAAUR") 17 18 25.0 18 18.0 54 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co"># as.mo("S. aureus") 28 28 41.0 28 72.0 73 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co"># as.mo("S. aureus") 28 28 41.0 28 28.0 120 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co"># as.mo("Staphylococcus aureus") 8 8 9.3 8 8.1 20 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co"># as.mo("sau") 18 18 22.0 18 18.0 62.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co"># as.mo("stau") 47 47 57.0 48 50.0 92.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co"># as.mo("staaur") 17 18 23.0 18 19.0 62.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co"># as.mo("STAAUR") 17 17 18.0 17 18.0 23.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co"># as.mo("S. aureus") 28 28 38.0 29 29.0 78.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co"># as.mo("S. aureus") 28 28 48.0 29 73.0 130.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co"># as.mo("Staphylococcus aureus") 8 8 8.1 8 8.1 8.2 10</span></a></code></pre></div>
|
||||
<p>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.</p>
|
||||
<p>To achieve this speed, the <code>as.mo</code> 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 <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">T.islandicus <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"theisl"</span>),</a>
|
||||
@ -236,12 +236,12 @@
|
||||
<a class="sourceLine" id="cb3-7" title="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb3-8" title="8"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb3-9" title="9"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co"># as.mo("theisl") 470 470 500 510 520 530 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co"># as.mo("THEISL") 470 470 490 470 520 520 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co"># as.mo("T. islandicus") 74 74 87 74 120 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co"># as.mo("T. islandicus") 74 74 89 74 120 140 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co"># as.mo("Thermus islandicus") 73 73 93 74 120 120 10</span></a></code></pre></div>
|
||||
<p>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 <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co"># as.mo("theisl") 470 480 510 520 530 530 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co"># as.mo("THEISL") 470 470 500 490 520 530 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co"># as.mo("T. islandicus") 74 75 85 76 81 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co"># as.mo("T. islandicus") 74 75 92 76 120 140 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co"># as.mo("Thermus islandicus") 73 73 74 74 74 75 10</span></a></code></pre></div>
|
||||
<p>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 <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
|
||||
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is very uncommon):</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/par">par</a></span>(<span class="dt">mar =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">16</span>, <span class="dv">4</span>, <span class="dv">2</span>)) <span class="co"># set more space for left margin text (16)</span></a>
|
||||
<a class="sourceLine" id="cb4-2" title="2"></a>
|
||||
@ -287,8 +287,8 @@
|
||||
<a class="sourceLine" id="cb5-24" title="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb5-25" title="25"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb5-26" title="26"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co"># mo_fullname(x) 639 681 745 720 770 910 10</span></a></code></pre></div>
|
||||
<p>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.</p>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co"># mo_fullname(x) 677 770 812 790 884 988 10</span></a></code></pre></div>
|
||||
<p>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.</p>
|
||||
</div>
|
||||
<div id="precalculated-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -300,10 +300,10 @@
|
||||
<a class="sourceLine" id="cb6-4" title="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
|
||||
<a class="sourceLine" id="cb6-5" title="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb6-6" title="6"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb6-7" title="7"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co"># A 12.90 13.2 13.40 13.40 13.80 14.00 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co"># B 25.30 25.7 31.00 27.10 27.50 70.10 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co"># C 1.38 1.6 1.69 1.69 1.72 1.97 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb6-7" title="7"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co"># A 12.9 13.20 13.30 13.40 13.50 13.50 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co"># B 25.3 25.80 30.40 25.80 26.20 71.60 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co"># C 1.3 1.37 1.56 1.67 1.73 1.74 10</span></a></code></pre></div>
|
||||
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0017 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">run_it <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-2" title="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a>
|
||||
@ -317,14 +317,14 @@
|
||||
<a class="sourceLine" id="cb7-10" title="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb7-11" title="11"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb7-12" title="12"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co"># A 0.392 0.485 0.577 0.580 0.628 0.808 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co"># B 0.444 0.521 0.566 0.567 0.609 0.710 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co"># C 1.380 1.680 1.750 1.760 1.820 2.160 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co"># D 0.422 0.522 0.564 0.553 0.640 0.644 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co"># E 0.362 0.443 0.520 0.543 0.595 0.684 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co"># F 0.347 0.432 0.515 0.495 0.585 0.728 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co"># G 0.377 0.417 0.479 0.463 0.495 0.681 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co"># H 0.263 0.264 0.310 0.282 0.350 0.436 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co"># A 0.442 0.477 0.583 0.572 0.673 0.806 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co"># B 0.442 0.502 0.626 0.611 0.761 0.826 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co"># C 1.360 1.620 1.820 1.810 2.060 2.150 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co"># D 0.449 0.514 0.622 0.639 0.725 0.798 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co"># E 0.401 0.440 0.530 0.508 0.568 0.799 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co"># F 0.353 0.391 0.502 0.494 0.635 0.695 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co"># G 0.451 0.559 0.595 0.609 0.646 0.747 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co"># H 0.191 0.278 0.395 0.376 0.528 0.653 10</span></a></code></pre></div>
|
||||
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> 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.</p>
|
||||
</div>
|
||||
<div id="results-in-other-languages" class="section level3">
|
||||
@ -351,13 +351,13 @@
|
||||
<a class="sourceLine" id="cb8-18" title="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
|
||||
<a class="sourceLine" id="cb8-19" title="19"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb8-20" title="20"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co"># en 18.15 18.27 22.87 18.31 18.68 63.44 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co"># de 23.03 23.14 27.80 23.20 23.53 68.60 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co"># nl 36.67 36.71 41.51 37.01 37.41 81.57 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co"># es 23.07 23.11 23.25 23.21 23.26 23.63 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co"># it 22.93 23.04 23.17 23.08 23.19 23.62 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co"># fr 23.13 23.21 27.71 23.30 23.31 67.70 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co"># pt 23.08 23.18 27.85 23.23 23.98 67.96 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co"># en 18.16 18.23 22.82 18.29 18.57 63.28 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co"># de 23.00 23.09 23.35 23.21 23.59 23.96 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co"># nl 36.60 36.74 37.00 36.97 37.32 37.41 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co"># es 23.10 23.15 23.40 23.29 23.63 23.97 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co"># it 23.04 23.14 23.28 23.27 23.43 23.58 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co"># fr 23.13 23.21 33.12 23.90 28.96 68.96 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co"># pt 22.98 23.16 23.37 23.44 23.51 23.65 10</span></a></code></pre></div>
|
||||
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 26 KiB |
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9034</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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))
|
||||
})
|
||||
|