guess_ab_col, benchmarks
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 0.5.0.9009
|
||||
Date: 2019-01-08
|
||||
Date: 2019-01-11
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(
|
||||
|
@ -76,7 +76,7 @@ export(g.test)
|
||||
export(geom_rsi)
|
||||
export(get_locale)
|
||||
export(ggplot_rsi)
|
||||
export(guess_ab)
|
||||
export(guess_ab_col)
|
||||
export(guess_atc)
|
||||
export(guess_mo)
|
||||
export(header)
|
||||
|
2
NEWS.md
@ -7,7 +7,7 @@
|
||||
* Contains the complete manual of this package and all of its functions with an explanation of their parameters
|
||||
* Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis
|
||||
* Support for [`dplyr`](https://dplyr.tidyverse.org) version 0.8.0
|
||||
* Function `guess_ab` to find an antibiotic column in a table
|
||||
* Function `guess_ab_col` to find an antibiotic column in a table
|
||||
* Function `mo_failures()` to review values that could not be coerced to a valid MO code, using `as.mo()`. This latter function will now only show a maximum of 25 uncoerced values.
|
||||
* Function `mo_renamed()` to get a list of all returned values from `as.mo()` that have had taxonomic renaming
|
||||
* Function `age()` to calculate the (patients) age in years
|
||||
|
2
R/age.R
@ -48,7 +48,7 @@ age <- function(x, reference = Sys.Date()) {
|
||||
as.integer(years_gap - 1),
|
||||
as.integer(years_gap))
|
||||
if (any(ages > 120)) {
|
||||
warning("Some ages are >120.")
|
||||
warning("Some ages are > 120.")
|
||||
}
|
||||
ages
|
||||
}
|
||||
|
254
R/eucast_rules.R
@ -30,7 +30,7 @@
|
||||
#' @param ... parameters that are passed on to \code{eucast_rules}
|
||||
#' @inheritParams first_isolate
|
||||
#' @section Antibiotics:
|
||||
#' To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab}} or input a text (case-insensitive) or use \code{NULL} to skip a column (e.g. \code{tica = NULL}). Non-existing columns will anyway be skipped with a warning.
|
||||
#' To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive) or use \code{NULL} to skip a column (e.g. \code{tica = NULL}). Non-existing columns will anyway be skipped with a warning.
|
||||
#'
|
||||
#' Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code})
|
||||
#'
|
||||
@ -158,69 +158,69 @@ eucast_rules <- function(tbl,
|
||||
info = TRUE,
|
||||
rules = c("breakpoints", "expert", "other", "all"),
|
||||
verbose = FALSE,
|
||||
amcl = guess_ab(),
|
||||
amik = guess_ab(),
|
||||
amox = guess_ab(),
|
||||
ampi = guess_ab(),
|
||||
azit = guess_ab(),
|
||||
azlo = guess_ab(),
|
||||
aztr = guess_ab(),
|
||||
cefa = guess_ab(),
|
||||
cfep = guess_ab(),
|
||||
cfot = guess_ab(),
|
||||
cfox = guess_ab(),
|
||||
cfra = guess_ab(),
|
||||
cfta = guess_ab(),
|
||||
cftr = guess_ab(),
|
||||
cfur = guess_ab(),
|
||||
chlo = guess_ab(),
|
||||
cipr = guess_ab(),
|
||||
clar = guess_ab(),
|
||||
clin = guess_ab(),
|
||||
clox = guess_ab(),
|
||||
coli = guess_ab(),
|
||||
czol = guess_ab(),
|
||||
dapt = guess_ab(),
|
||||
doxy = guess_ab(),
|
||||
erta = guess_ab(),
|
||||
eryt = guess_ab(),
|
||||
fosf = guess_ab(),
|
||||
fusi = guess_ab(),
|
||||
gent = guess_ab(),
|
||||
imip = guess_ab(),
|
||||
kana = guess_ab(),
|
||||
levo = guess_ab(),
|
||||
linc = guess_ab(),
|
||||
line = guess_ab(),
|
||||
mero = guess_ab(),
|
||||
mezl = guess_ab(),
|
||||
mino = guess_ab(),
|
||||
moxi = guess_ab(),
|
||||
nali = guess_ab(),
|
||||
neom = guess_ab(),
|
||||
neti = guess_ab(),
|
||||
nitr = guess_ab(),
|
||||
norf = guess_ab(),
|
||||
novo = guess_ab(),
|
||||
oflo = guess_ab(),
|
||||
oxac = guess_ab(),
|
||||
peni = guess_ab(),
|
||||
pipe = guess_ab(),
|
||||
pita = guess_ab(),
|
||||
poly = guess_ab(),
|
||||
pris = guess_ab(),
|
||||
qida = guess_ab(),
|
||||
rifa = guess_ab(),
|
||||
roxi = guess_ab(),
|
||||
siso = guess_ab(),
|
||||
teic = guess_ab(),
|
||||
tetr = guess_ab(),
|
||||
tica = guess_ab(),
|
||||
tige = guess_ab(),
|
||||
tobr = guess_ab(),
|
||||
trim = guess_ab(),
|
||||
trsu = guess_ab(),
|
||||
vanc = guess_ab()) {
|
||||
amcl = guess_ab_col(),
|
||||
amik = guess_ab_col(),
|
||||
amox = guess_ab_col(),
|
||||
ampi = guess_ab_col(),
|
||||
azit = guess_ab_col(),
|
||||
azlo = guess_ab_col(),
|
||||
aztr = guess_ab_col(),
|
||||
cefa = guess_ab_col(),
|
||||
cfep = guess_ab_col(),
|
||||
cfot = guess_ab_col(),
|
||||
cfox = guess_ab_col(),
|
||||
cfra = guess_ab_col(),
|
||||
cfta = guess_ab_col(),
|
||||
cftr = guess_ab_col(),
|
||||
cfur = guess_ab_col(),
|
||||
chlo = guess_ab_col(),
|
||||
cipr = guess_ab_col(),
|
||||
clar = guess_ab_col(),
|
||||
clin = guess_ab_col(),
|
||||
clox = guess_ab_col(),
|
||||
coli = guess_ab_col(),
|
||||
czol = guess_ab_col(),
|
||||
dapt = guess_ab_col(),
|
||||
doxy = guess_ab_col(),
|
||||
erta = guess_ab_col(),
|
||||
eryt = guess_ab_col(),
|
||||
fosf = guess_ab_col(),
|
||||
fusi = guess_ab_col(),
|
||||
gent = guess_ab_col(),
|
||||
imip = guess_ab_col(),
|
||||
kana = guess_ab_col(),
|
||||
levo = guess_ab_col(),
|
||||
linc = guess_ab_col(),
|
||||
line = guess_ab_col(),
|
||||
mero = guess_ab_col(),
|
||||
mezl = guess_ab_col(),
|
||||
mino = guess_ab_col(),
|
||||
moxi = guess_ab_col(),
|
||||
nali = guess_ab_col(),
|
||||
neom = guess_ab_col(),
|
||||
neti = guess_ab_col(),
|
||||
nitr = guess_ab_col(),
|
||||
norf = guess_ab_col(),
|
||||
novo = guess_ab_col(),
|
||||
oflo = guess_ab_col(),
|
||||
oxac = guess_ab_col(),
|
||||
peni = guess_ab_col(),
|
||||
pipe = guess_ab_col(),
|
||||
pita = guess_ab_col(),
|
||||
poly = guess_ab_col(),
|
||||
pris = guess_ab_col(),
|
||||
qida = guess_ab_col(),
|
||||
rifa = guess_ab_col(),
|
||||
roxi = guess_ab_col(),
|
||||
siso = guess_ab_col(),
|
||||
teic = guess_ab_col(),
|
||||
tetr = guess_ab_col(),
|
||||
tica = guess_ab_col(),
|
||||
tige = guess_ab_col(),
|
||||
tobr = guess_ab_col(),
|
||||
trim = guess_ab_col(),
|
||||
trsu = guess_ab_col(),
|
||||
vanc = guess_ab_col()) {
|
||||
|
||||
EUCAST_VERSION_BREAKPOINTS <- "8.1, 2018"
|
||||
EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
|
||||
@ -268,69 +268,69 @@ eucast_rules <- function(tbl,
|
||||
}
|
||||
|
||||
# check columns
|
||||
if (identical(amcl, as.name("guess_ab"))) { amcl <- guess_ab(tbl, "amcl", verbose = verbose) }
|
||||
if (identical(amik, as.name("guess_ab"))) { amik <- guess_ab(tbl, "amik", verbose = verbose) }
|
||||
if (identical(amox, as.name("guess_ab"))) { amox <- guess_ab(tbl, "amox", verbose = verbose) }
|
||||
if (identical(ampi, as.name("guess_ab"))) { ampi <- guess_ab(tbl, "ampi", verbose = verbose) }
|
||||
if (identical(azit, as.name("guess_ab"))) { azit <- guess_ab(tbl, "azit", verbose = verbose) }
|
||||
if (identical(azlo, as.name("guess_ab"))) { azlo <- guess_ab(tbl, "azlo", verbose = verbose) }
|
||||
if (identical(aztr, as.name("guess_ab"))) { aztr <- guess_ab(tbl, "aztr", verbose = verbose) }
|
||||
if (identical(cefa, as.name("guess_ab"))) { cefa <- guess_ab(tbl, "cefa", verbose = verbose) }
|
||||
if (identical(cfep, as.name("guess_ab"))) { cfep <- guess_ab(tbl, "cfep", verbose = verbose) }
|
||||
if (identical(cfot, as.name("guess_ab"))) { cfot <- guess_ab(tbl, "cfot", verbose = verbose) }
|
||||
if (identical(cfox, as.name("guess_ab"))) { cfox <- guess_ab(tbl, "cfox", verbose = verbose) }
|
||||
if (identical(cfra, as.name("guess_ab"))) { cfra <- guess_ab(tbl, "cfra", verbose = verbose) }
|
||||
if (identical(cfta, as.name("guess_ab"))) { cfta <- guess_ab(tbl, "cfta", verbose = verbose) }
|
||||
if (identical(cftr, as.name("guess_ab"))) { cftr <- guess_ab(tbl, "cftr", verbose = verbose) }
|
||||
if (identical(cfur, as.name("guess_ab"))) { cfur <- guess_ab(tbl, "cfur", verbose = verbose) }
|
||||
if (identical(chlo, as.name("guess_ab"))) { chlo <- guess_ab(tbl, "chlo", verbose = verbose) }
|
||||
if (identical(cipr, as.name("guess_ab"))) { cipr <- guess_ab(tbl, "cipr", verbose = verbose) }
|
||||
if (identical(clar, as.name("guess_ab"))) { clar <- guess_ab(tbl, "clar", verbose = verbose) }
|
||||
if (identical(clin, as.name("guess_ab"))) { clin <- guess_ab(tbl, "clin", verbose = verbose) }
|
||||
if (identical(clox, as.name("guess_ab"))) { clox <- guess_ab(tbl, "clox", verbose = verbose) }
|
||||
if (identical(coli, as.name("guess_ab"))) { coli <- guess_ab(tbl, "coli", verbose = verbose) }
|
||||
if (identical(czol, as.name("guess_ab"))) { czol <- guess_ab(tbl, "czol", verbose = verbose) }
|
||||
if (identical(dapt, as.name("guess_ab"))) { dapt <- guess_ab(tbl, "dapt", verbose = verbose) }
|
||||
if (identical(doxy, as.name("guess_ab"))) { doxy <- guess_ab(tbl, "doxy", verbose = verbose) }
|
||||
if (identical(erta, as.name("guess_ab"))) { erta <- guess_ab(tbl, "erta", verbose = verbose) }
|
||||
if (identical(eryt, as.name("guess_ab"))) { eryt <- guess_ab(tbl, "eryt", verbose = verbose) }
|
||||
if (identical(fosf, as.name("guess_ab"))) { fosf <- guess_ab(tbl, "fosf", verbose = verbose) }
|
||||
if (identical(fusi, as.name("guess_ab"))) { fusi <- guess_ab(tbl, "fusi", verbose = verbose) }
|
||||
if (identical(gent, as.name("guess_ab"))) { gent <- guess_ab(tbl, "gent", verbose = verbose) }
|
||||
if (identical(imip, as.name("guess_ab"))) { imip <- guess_ab(tbl, "imip", verbose = verbose) }
|
||||
if (identical(kana, as.name("guess_ab"))) { kana <- guess_ab(tbl, "kana", verbose = verbose) }
|
||||
if (identical(levo, as.name("guess_ab"))) { levo <- guess_ab(tbl, "levo", verbose = verbose) }
|
||||
if (identical(linc, as.name("guess_ab"))) { linc <- guess_ab(tbl, "linc", verbose = verbose) }
|
||||
if (identical(line, as.name("guess_ab"))) { line <- guess_ab(tbl, "line", verbose = verbose) }
|
||||
if (identical(mero, as.name("guess_ab"))) { mero <- guess_ab(tbl, "mero", verbose = verbose) }
|
||||
if (identical(mezl, as.name("guess_ab"))) { mezl <- guess_ab(tbl, "mezl", verbose = verbose) }
|
||||
if (identical(mino, as.name("guess_ab"))) { mino <- guess_ab(tbl, "mino", verbose = verbose) }
|
||||
if (identical(moxi, as.name("guess_ab"))) { moxi <- guess_ab(tbl, "moxi", verbose = verbose) }
|
||||
if (identical(nali, as.name("guess_ab"))) { nali <- guess_ab(tbl, "nali", verbose = verbose) }
|
||||
if (identical(neom, as.name("guess_ab"))) { neom <- guess_ab(tbl, "neom", verbose = verbose) }
|
||||
if (identical(neti, as.name("guess_ab"))) { neti <- guess_ab(tbl, "neti", verbose = verbose) }
|
||||
if (identical(nitr, as.name("guess_ab"))) { nitr <- guess_ab(tbl, "nitr", verbose = verbose) }
|
||||
if (identical(norf, as.name("guess_ab"))) { norf <- guess_ab(tbl, "norf", verbose = verbose) }
|
||||
if (identical(novo, as.name("guess_ab"))) { novo <- guess_ab(tbl, "novo", verbose = verbose) }
|
||||
if (identical(oflo, as.name("guess_ab"))) { oflo <- guess_ab(tbl, "oflo", verbose = verbose) }
|
||||
if (identical(oxac, as.name("guess_ab"))) { oxac <- guess_ab(tbl, "oxac", verbose = verbose) }
|
||||
if (identical(peni, as.name("guess_ab"))) { peni <- guess_ab(tbl, "peni", verbose = verbose) }
|
||||
if (identical(pipe, as.name("guess_ab"))) { pipe <- guess_ab(tbl, "pipe", verbose = verbose) }
|
||||
if (identical(pita, as.name("guess_ab"))) { pita <- guess_ab(tbl, "pita", verbose = verbose) }
|
||||
if (identical(poly, as.name("guess_ab"))) { poly <- guess_ab(tbl, "poly", verbose = verbose) }
|
||||
if (identical(pris, as.name("guess_ab"))) { pris <- guess_ab(tbl, "pris", verbose = verbose) }
|
||||
if (identical(qida, as.name("guess_ab"))) { qida <- guess_ab(tbl, "qida", verbose = verbose) }
|
||||
if (identical(rifa, as.name("guess_ab"))) { rifa <- guess_ab(tbl, "rifa", verbose = verbose) }
|
||||
if (identical(roxi, as.name("guess_ab"))) { roxi <- guess_ab(tbl, "roxi", verbose = verbose) }
|
||||
if (identical(siso, as.name("guess_ab"))) { siso <- guess_ab(tbl, "siso", verbose = verbose) }
|
||||
if (identical(teic, as.name("guess_ab"))) { teic <- guess_ab(tbl, "teic", verbose = verbose) }
|
||||
if (identical(tetr, as.name("guess_ab"))) { tetr <- guess_ab(tbl, "tetr", verbose = verbose) }
|
||||
if (identical(tica, as.name("guess_ab"))) { tica <- guess_ab(tbl, "tica", verbose = verbose) }
|
||||
if (identical(tige, as.name("guess_ab"))) { tige <- guess_ab(tbl, "tige", verbose = verbose) }
|
||||
if (identical(tobr, as.name("guess_ab"))) { tobr <- guess_ab(tbl, "tobr", verbose = verbose) }
|
||||
if (identical(trim, as.name("guess_ab"))) { trim <- guess_ab(tbl, "trim", verbose = verbose) }
|
||||
if (identical(trsu, as.name("guess_ab"))) { trsu <- guess_ab(tbl, "trsu", verbose = verbose) }
|
||||
if (identical(vanc, as.name("guess_ab"))) { vanc <- guess_ab(tbl, "vanc", verbose = verbose) }
|
||||
if (identical(amcl, as.name("guess_ab_col"))) { amcl <- guess_ab_col(tbl, "amcl", verbose = verbose) }
|
||||
if (identical(amik, as.name("guess_ab_col"))) { amik <- guess_ab_col(tbl, "amik", verbose = verbose) }
|
||||
if (identical(amox, as.name("guess_ab_col"))) { amox <- guess_ab_col(tbl, "amox", verbose = verbose) }
|
||||
if (identical(ampi, as.name("guess_ab_col"))) { ampi <- guess_ab_col(tbl, "ampi", verbose = verbose) }
|
||||
if (identical(azit, as.name("guess_ab_col"))) { azit <- guess_ab_col(tbl, "azit", verbose = verbose) }
|
||||
if (identical(azlo, as.name("guess_ab_col"))) { azlo <- guess_ab_col(tbl, "azlo", verbose = verbose) }
|
||||
if (identical(aztr, as.name("guess_ab_col"))) { aztr <- guess_ab_col(tbl, "aztr", verbose = verbose) }
|
||||
if (identical(cefa, as.name("guess_ab_col"))) { cefa <- guess_ab_col(tbl, "cefa", verbose = verbose) }
|
||||
if (identical(cfep, as.name("guess_ab_col"))) { cfep <- guess_ab_col(tbl, "cfep", verbose = verbose) }
|
||||
if (identical(cfot, as.name("guess_ab_col"))) { cfot <- guess_ab_col(tbl, "cfot", verbose = verbose) }
|
||||
if (identical(cfox, as.name("guess_ab_col"))) { cfox <- guess_ab_col(tbl, "cfox", verbose = verbose) }
|
||||
if (identical(cfra, as.name("guess_ab_col"))) { cfra <- guess_ab_col(tbl, "cfra", verbose = verbose) }
|
||||
if (identical(cfta, as.name("guess_ab_col"))) { cfta <- guess_ab_col(tbl, "cfta", verbose = verbose) }
|
||||
if (identical(cftr, as.name("guess_ab_col"))) { cftr <- guess_ab_col(tbl, "cftr", verbose = verbose) }
|
||||
if (identical(cfur, as.name("guess_ab_col"))) { cfur <- guess_ab_col(tbl, "cfur", verbose = verbose) }
|
||||
if (identical(chlo, as.name("guess_ab_col"))) { chlo <- guess_ab_col(tbl, "chlo", verbose = verbose) }
|
||||
if (identical(cipr, as.name("guess_ab_col"))) { cipr <- guess_ab_col(tbl, "cipr", verbose = verbose) }
|
||||
if (identical(clar, as.name("guess_ab_col"))) { clar <- guess_ab_col(tbl, "clar", verbose = verbose) }
|
||||
if (identical(clin, as.name("guess_ab_col"))) { clin <- guess_ab_col(tbl, "clin", verbose = verbose) }
|
||||
if (identical(clox, as.name("guess_ab_col"))) { clox <- guess_ab_col(tbl, "clox", verbose = verbose) }
|
||||
if (identical(coli, as.name("guess_ab_col"))) { coli <- guess_ab_col(tbl, "coli", verbose = verbose) }
|
||||
if (identical(czol, as.name("guess_ab_col"))) { czol <- guess_ab_col(tbl, "czol", verbose = verbose) }
|
||||
if (identical(dapt, as.name("guess_ab_col"))) { dapt <- guess_ab_col(tbl, "dapt", verbose = verbose) }
|
||||
if (identical(doxy, as.name("guess_ab_col"))) { doxy <- guess_ab_col(tbl, "doxy", verbose = verbose) }
|
||||
if (identical(erta, as.name("guess_ab_col"))) { erta <- guess_ab_col(tbl, "erta", verbose = verbose) }
|
||||
if (identical(eryt, as.name("guess_ab_col"))) { eryt <- guess_ab_col(tbl, "eryt", verbose = verbose) }
|
||||
if (identical(fosf, as.name("guess_ab_col"))) { fosf <- guess_ab_col(tbl, "fosf", verbose = verbose) }
|
||||
if (identical(fusi, as.name("guess_ab_col"))) { fusi <- guess_ab_col(tbl, "fusi", verbose = verbose) }
|
||||
if (identical(gent, as.name("guess_ab_col"))) { gent <- guess_ab_col(tbl, "gent", verbose = verbose) }
|
||||
if (identical(imip, as.name("guess_ab_col"))) { imip <- guess_ab_col(tbl, "imip", verbose = verbose) }
|
||||
if (identical(kana, as.name("guess_ab_col"))) { kana <- guess_ab_col(tbl, "kana", verbose = verbose) }
|
||||
if (identical(levo, as.name("guess_ab_col"))) { levo <- guess_ab_col(tbl, "levo", verbose = verbose) }
|
||||
if (identical(linc, as.name("guess_ab_col"))) { linc <- guess_ab_col(tbl, "linc", verbose = verbose) }
|
||||
if (identical(line, as.name("guess_ab_col"))) { line <- guess_ab_col(tbl, "line", verbose = verbose) }
|
||||
if (identical(mero, as.name("guess_ab_col"))) { mero <- guess_ab_col(tbl, "mero", verbose = verbose) }
|
||||
if (identical(mezl, as.name("guess_ab_col"))) { mezl <- guess_ab_col(tbl, "mezl", verbose = verbose) }
|
||||
if (identical(mino, as.name("guess_ab_col"))) { mino <- guess_ab_col(tbl, "mino", verbose = verbose) }
|
||||
if (identical(moxi, as.name("guess_ab_col"))) { moxi <- guess_ab_col(tbl, "moxi", verbose = verbose) }
|
||||
if (identical(nali, as.name("guess_ab_col"))) { nali <- guess_ab_col(tbl, "nali", verbose = verbose) }
|
||||
if (identical(neom, as.name("guess_ab_col"))) { neom <- guess_ab_col(tbl, "neom", verbose = verbose) }
|
||||
if (identical(neti, as.name("guess_ab_col"))) { neti <- guess_ab_col(tbl, "neti", verbose = verbose) }
|
||||
if (identical(nitr, as.name("guess_ab_col"))) { nitr <- guess_ab_col(tbl, "nitr", verbose = verbose) }
|
||||
if (identical(norf, as.name("guess_ab_col"))) { norf <- guess_ab_col(tbl, "norf", verbose = verbose) }
|
||||
if (identical(novo, as.name("guess_ab_col"))) { novo <- guess_ab_col(tbl, "novo", verbose = verbose) }
|
||||
if (identical(oflo, as.name("guess_ab_col"))) { oflo <- guess_ab_col(tbl, "oflo", verbose = verbose) }
|
||||
if (identical(oxac, as.name("guess_ab_col"))) { oxac <- guess_ab_col(tbl, "oxac", verbose = verbose) }
|
||||
if (identical(peni, as.name("guess_ab_col"))) { peni <- guess_ab_col(tbl, "peni", verbose = verbose) }
|
||||
if (identical(pipe, as.name("guess_ab_col"))) { pipe <- guess_ab_col(tbl, "pipe", verbose = verbose) }
|
||||
if (identical(pita, as.name("guess_ab_col"))) { pita <- guess_ab_col(tbl, "pita", verbose = verbose) }
|
||||
if (identical(poly, as.name("guess_ab_col"))) { poly <- guess_ab_col(tbl, "poly", verbose = verbose) }
|
||||
if (identical(pris, as.name("guess_ab_col"))) { pris <- guess_ab_col(tbl, "pris", verbose = verbose) }
|
||||
if (identical(qida, as.name("guess_ab_col"))) { qida <- guess_ab_col(tbl, "qida", verbose = verbose) }
|
||||
if (identical(rifa, as.name("guess_ab_col"))) { rifa <- guess_ab_col(tbl, "rifa", verbose = verbose) }
|
||||
if (identical(roxi, as.name("guess_ab_col"))) { roxi <- guess_ab_col(tbl, "roxi", verbose = verbose) }
|
||||
if (identical(siso, as.name("guess_ab_col"))) { siso <- guess_ab_col(tbl, "siso", verbose = verbose) }
|
||||
if (identical(teic, as.name("guess_ab_col"))) { teic <- guess_ab_col(tbl, "teic", verbose = verbose) }
|
||||
if (identical(tetr, as.name("guess_ab_col"))) { tetr <- guess_ab_col(tbl, "tetr", verbose = verbose) }
|
||||
if (identical(tica, as.name("guess_ab_col"))) { tica <- guess_ab_col(tbl, "tica", verbose = verbose) }
|
||||
if (identical(tige, as.name("guess_ab_col"))) { tige <- guess_ab_col(tbl, "tige", verbose = verbose) }
|
||||
if (identical(tobr, as.name("guess_ab_col"))) { tobr <- guess_ab_col(tbl, "tobr", verbose = verbose) }
|
||||
if (identical(trim, as.name("guess_ab_col"))) { trim <- guess_ab_col(tbl, "trim", verbose = verbose) }
|
||||
if (identical(trsu, as.name("guess_ab_col"))) { trsu <- guess_ab_col(tbl, "trsu", verbose = verbose) }
|
||||
if (identical(vanc, as.name("guess_ab_col"))) { vanc <- guess_ab_col(tbl, "vanc", verbose = verbose) }
|
||||
col.list <- c(amcl, amik, amox, ampi, azit, azlo, aztr, cefa, cfra, cfep, cfot,
|
||||
cfox, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli,
|
||||
czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana,
|
||||
|
@ -21,18 +21,28 @@
|
||||
|
||||
#' Guess antibiotic column
|
||||
#'
|
||||
#' This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set.
|
||||
#' This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. You can look for an antibiotic (trade) of abbreviation and it will search the data for any column containing a name or ATC code of that antibiotic.
|
||||
#' @param tbl a \code{data.frame}
|
||||
#' @param col a character to look for
|
||||
#' @param verbose a logical to indicate whether additional info should be printed
|
||||
#' @importFrom dplyr %>% select filter_all any_vars
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on our website!
|
||||
# @examples
|
||||
#
|
||||
guess_ab <- function(tbl = NULL, col = NULL, verbose = FALSE) {
|
||||
#' @examples
|
||||
#' df <- data.frame(amox = "S",
|
||||
#' tetr = "R")
|
||||
#'
|
||||
#' guess_ab_col(df, "amoxicillin")
|
||||
#' # [1] "amox"
|
||||
#' guess_ab_col(df, "J01AA07") # ATC code of Tetracycline
|
||||
#' # [1] "tetr"
|
||||
#'
|
||||
#' guess_ab_col(df, "J01AA07", verbose = TRUE)
|
||||
#' # using column `tetr` for col "J01AA07"
|
||||
#' # [1] "tetr"
|
||||
guess_ab_col <- function(tbl = NULL, col = NULL, verbose = FALSE) {
|
||||
if (is.null(tbl) & is.null(col)) {
|
||||
return(as.name("guess_ab"))
|
||||
return(as.name("guess_ab_col"))
|
||||
}
|
||||
#stop("This function should not be called directly.")
|
||||
if (length(col) > 1) {
|
||||
@ -42,35 +52,58 @@ guess_ab <- function(tbl = NULL, col = NULL, verbose = FALSE) {
|
||||
if (!is.data.frame(tbl)) {
|
||||
stop("`tbl` must be a data.frame")
|
||||
}
|
||||
|
||||
tbl_names <- colnames(tbl)
|
||||
if (col %in% tbl_names) {
|
||||
return(col)
|
||||
}
|
||||
ab_result <- antibiotics %>%
|
||||
select(atc:trade_name) %>%
|
||||
filter_all(any_vars(tolower(.) == tolower(col)))
|
||||
filter_all(any_vars(tolower(.) == tolower(col))) %>%
|
||||
filter_all(any_vars(. %in% tbl_names))
|
||||
|
||||
if (nrow(ab_result) == 0 & nchar(col) > 4) {
|
||||
# use like when col >= 5 characters
|
||||
ab_result <- antibiotics %>%
|
||||
select(atc:trade_name) %>%
|
||||
filter_all(any_vars(tolower(.) %like% tolower(col))) %>%
|
||||
filter_all(any_vars(. %in% tbl_names))
|
||||
}
|
||||
|
||||
if (nrow(ab_result) > 1) {
|
||||
# get most likely one
|
||||
if (col %in% ab_result$atc) {
|
||||
ab_result <- ab_result %>% filter(atc == col)
|
||||
} else if (col %in% ab_result$certe) {
|
||||
ab_result <- ab_result %>% filter(certe == col)
|
||||
} else if (col %in% ab_result$umcg) {
|
||||
ab_result <- ab_result %>% filter(umcg == col)
|
||||
} else if (col %in% ab_result$umcg) {
|
||||
ab_result <- ab_result %>% filter(official == col)
|
||||
} else {
|
||||
ab_result <- ab_result[1,]
|
||||
# looking more and more for reliable hit
|
||||
ab_result_1 <- ab_result %>% filter(tolower(atc) == tolower(col))
|
||||
if (nrow(ab_result_1) == 0) {
|
||||
ab_result_1 <- ab_result %>% filter(tolower(certe) == tolower(col))
|
||||
}
|
||||
if (nrow(ab_result_1) == 0) {
|
||||
ab_result_1 <- ab_result %>% filter(tolower(umcg) == tolower(col))
|
||||
}
|
||||
tbl_result <- tbl_names[tbl_names %in% ab_result]
|
||||
if (length(tbl_result) > 1) {
|
||||
tbl_result <- tbl_result[1]
|
||||
warning('using column `', tbl_result, '` for col "', col, '"', call. = FALSE)
|
||||
} else if (length(tbl_result) == 0) {
|
||||
if (nrow(ab_result_1) == 0) {
|
||||
ab_result_1 <- ab_result %>% filter(tolower(official) == tolower(col))
|
||||
}
|
||||
if (nrow(ab_result_1) == 0) {
|
||||
ab_result_1 <- ab_result[1, ]
|
||||
}
|
||||
ab_result <- ab_result_1
|
||||
}
|
||||
|
||||
if (length(ab_result) == 0) {
|
||||
if (verbose == TRUE) {
|
||||
message('no result found for col "', col, '"')
|
||||
}
|
||||
return(NULL)
|
||||
} else if (verbose == TRUE) {
|
||||
message('using column `', tbl_result, '` for col "', col, '"')
|
||||
} else {
|
||||
result <- tbl_names[tbl_names %in% ab_result]
|
||||
if (length(result) == 0) {
|
||||
if (verbose == TRUE) {
|
||||
message('no result found for col "', col, '"')
|
||||
}
|
||||
return(NULL)
|
||||
}
|
||||
if (verbose == TRUE) {
|
||||
message('using column `', result, '` for col "', col, '"')
|
||||
}
|
||||
return(result)
|
||||
}
|
||||
tbl_result
|
||||
}
|
@ -25,12 +25,12 @@
|
||||
#' @param tbl table with antibiotics coloms, like \code{amox} and \code{amcl}.
|
||||
#' @param x,y characters to compare
|
||||
#' @inheritParams first_isolate
|
||||
#' @param universal_1,universal_2,universal_3,universal_4,universal_5,universal_6 column names of \strong{broad-spectrum} antibiotics, case-insensitive
|
||||
#' @param GramPos_1,GramPos_2,GramPos_3,GramPos_4,GramPos_5,GramPos_6 column names of antibiotics for \strong{Gram positives}, case-insensitive
|
||||
#' @param GramNeg_1,GramNeg_2,GramNeg_3,GramNeg_4,GramNeg_5,GramNeg_6 column names of antibiotics for \strong{Gram negatives}, case-insensitive
|
||||
#' @param universal_1,universal_2,universal_3,universal_4,universal_5,universal_6 column names of \strong{broad-spectrum} antibiotics, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}.
|
||||
#' @param GramPos_1,GramPos_2,GramPos_3,GramPos_4,GramPos_5,GramPos_6 column names of antibiotics for \strong{Gram positives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}.
|
||||
#' @param GramNeg_1,GramNeg_2,GramNeg_3,GramNeg_4,GramNeg_5,GramNeg_6 column names of antibiotics for \strong{Gram negatives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}.
|
||||
#' @param warnings give warning about missing antibiotic columns, they will anyway be ignored
|
||||
#' @param ... other parameters passed on to function
|
||||
#' @details The function \code{key_antibiotics} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{key_antibiotics_equal}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}). The \code{\link{first_isolate}} function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible \emph{S. aureus} (MSSA) found within the same episode (see \code{episode} parameter of \code{\link{first_isolate}}). Without key antibiotic comparison it wouldn't.
|
||||
#' @details The function \code{key_antibiotics} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{key_antibiotics_equal}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}). The \code{\link{first_isolate}} function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible \emph{S. aureus} (MSSA) found within the same episode (see \code{episode} parameter of \code{\link{first_isolate}}). Without key antibiotic comparison it would not.
|
||||
#'
|
||||
#' At default, the antibiotics that are used for \strong{Gram positive bacteria} are (colum names): \cr
|
||||
#' \code{"amox"}, \code{"amcl"}, \code{"cfur"}, \code{"pita"}, \code{"cipr"}, \code{"trsu"} (until here is universal), \code{"vanc"}, \code{"teic"}, \code{"tetr"}, \code{"eryt"}, \code{"oxac"}, \code{"rifa"}.
|
||||
@ -78,24 +78,24 @@
|
||||
#' # FALSE, because I is not ignored and so the 4th value differs
|
||||
key_antibiotics <- function(tbl,
|
||||
col_mo = NULL,
|
||||
universal_1 = guess_ab(tbl, "amox"),
|
||||
universal_2 = guess_ab(tbl, "amcl"),
|
||||
universal_3 = guess_ab(tbl, "cfur"),
|
||||
universal_4 = guess_ab(tbl, "pita"),
|
||||
universal_5 = guess_ab(tbl, "cipr"),
|
||||
universal_6 = guess_ab(tbl, "trsu"),
|
||||
GramPos_1 = guess_ab(tbl, "vanc"),
|
||||
GramPos_2 = guess_ab(tbl, "teic"),
|
||||
GramPos_3 = guess_ab(tbl, "tetr"),
|
||||
GramPos_4 = guess_ab(tbl, "eryt"),
|
||||
GramPos_5 = guess_ab(tbl, "oxac"),
|
||||
GramPos_6 = guess_ab(tbl, "rifa"),
|
||||
GramNeg_1 = guess_ab(tbl, "gent"),
|
||||
GramNeg_2 = guess_ab(tbl, "tobr"),
|
||||
GramNeg_3 = guess_ab(tbl, "coli"),
|
||||
GramNeg_4 = guess_ab(tbl, "cfot"),
|
||||
GramNeg_5 = guess_ab(tbl, "cfta"),
|
||||
GramNeg_6 = guess_ab(tbl, "mero"),
|
||||
universal_1 = guess_ab_col(tbl, "amox"),
|
||||
universal_2 = guess_ab_col(tbl, "amcl"),
|
||||
universal_3 = guess_ab_col(tbl, "cfur"),
|
||||
universal_4 = guess_ab_col(tbl, "pita"),
|
||||
universal_5 = guess_ab_col(tbl, "cipr"),
|
||||
universal_6 = guess_ab_col(tbl, "trsu"),
|
||||
GramPos_1 = guess_ab_col(tbl, "vanc"),
|
||||
GramPos_2 = guess_ab_col(tbl, "teic"),
|
||||
GramPos_3 = guess_ab_col(tbl, "tetr"),
|
||||
GramPos_4 = guess_ab_col(tbl, "eryt"),
|
||||
GramPos_5 = guess_ab_col(tbl, "oxac"),
|
||||
GramPos_6 = guess_ab_col(tbl, "rifa"),
|
||||
GramNeg_1 = guess_ab_col(tbl, "gent"),
|
||||
GramNeg_2 = guess_ab_col(tbl, "tobr"),
|
||||
GramNeg_3 = guess_ab_col(tbl, "coli"),
|
||||
GramNeg_4 = guess_ab_col(tbl, "cfot"),
|
||||
GramNeg_5 = guess_ab_col(tbl, "cfta"),
|
||||
GramNeg_6 = guess_ab_col(tbl, "mero"),
|
||||
warnings = TRUE,
|
||||
...) {
|
||||
|
||||
@ -153,9 +153,6 @@ key_antibiotics <- function(tbl,
|
||||
left_join_microorganisms(by = col_mo) %>%
|
||||
mutate(key_ab = NA_character_)
|
||||
|
||||
print(as.character(gram_positive))
|
||||
print(gram_negative)
|
||||
|
||||
# Gram +
|
||||
tbl <- tbl %>% mutate(key_ab =
|
||||
if_else(gramstain == "Gram positive",
|
||||
|
240
R/mdro.R
@ -46,66 +46,66 @@ mdro <- function(tbl,
|
||||
country = NULL,
|
||||
col_mo = NULL,
|
||||
info = TRUE,
|
||||
amcl = guess_ab(),
|
||||
amik = guess_ab(),
|
||||
amox = guess_ab(),
|
||||
ampi = guess_ab(),
|
||||
azit = guess_ab(),
|
||||
aztr = guess_ab(),
|
||||
cefa = guess_ab(),
|
||||
cfra = guess_ab(),
|
||||
cfep = guess_ab(),
|
||||
cfot = guess_ab(),
|
||||
cfox = guess_ab(),
|
||||
cfta = guess_ab(),
|
||||
cftr = guess_ab(),
|
||||
cfur = guess_ab(),
|
||||
chlo = guess_ab(),
|
||||
cipr = guess_ab(),
|
||||
clar = guess_ab(),
|
||||
clin = guess_ab(),
|
||||
clox = guess_ab(),
|
||||
coli = guess_ab(),
|
||||
czol = guess_ab(),
|
||||
dapt = guess_ab(),
|
||||
doxy = guess_ab(),
|
||||
erta = guess_ab(),
|
||||
eryt = guess_ab(),
|
||||
fosf = guess_ab(),
|
||||
fusi = guess_ab(),
|
||||
gent = guess_ab(),
|
||||
imip = guess_ab(),
|
||||
kana = guess_ab(),
|
||||
levo = guess_ab(),
|
||||
linc = guess_ab(),
|
||||
line = guess_ab(),
|
||||
mero = guess_ab(),
|
||||
metr = guess_ab(),
|
||||
mino = guess_ab(),
|
||||
moxi = guess_ab(),
|
||||
nali = guess_ab(),
|
||||
neom = guess_ab(),
|
||||
neti = guess_ab(),
|
||||
nitr = guess_ab(),
|
||||
novo = guess_ab(),
|
||||
norf = guess_ab(),
|
||||
oflo = guess_ab(),
|
||||
peni = guess_ab(),
|
||||
pipe = guess_ab(),
|
||||
pita = guess_ab(),
|
||||
poly = guess_ab(),
|
||||
qida = guess_ab(),
|
||||
rifa = guess_ab(),
|
||||
roxi = guess_ab(),
|
||||
siso = guess_ab(),
|
||||
teic = guess_ab(),
|
||||
tetr = guess_ab(),
|
||||
tica = guess_ab(),
|
||||
tige = guess_ab(),
|
||||
tobr = guess_ab(),
|
||||
trim = guess_ab(),
|
||||
trsu = guess_ab(),
|
||||
vanc = guess_ab()) {
|
||||
amcl = guess_ab_col(),
|
||||
amik = guess_ab_col(),
|
||||
amox = guess_ab_col(),
|
||||
ampi = guess_ab_col(),
|
||||
azit = guess_ab_col(),
|
||||
aztr = guess_ab_col(),
|
||||
cefa = guess_ab_col(),
|
||||
cfra = guess_ab_col(),
|
||||
cfep = guess_ab_col(),
|
||||
cfot = guess_ab_col(),
|
||||
cfox = guess_ab_col(),
|
||||
cfta = guess_ab_col(),
|
||||
cftr = guess_ab_col(),
|
||||
cfur = guess_ab_col(),
|
||||
chlo = guess_ab_col(),
|
||||
cipr = guess_ab_col(),
|
||||
clar = guess_ab_col(),
|
||||
clin = guess_ab_col(),
|
||||
clox = guess_ab_col(),
|
||||
coli = guess_ab_col(),
|
||||
czol = guess_ab_col(),
|
||||
dapt = guess_ab_col(),
|
||||
doxy = guess_ab_col(),
|
||||
erta = guess_ab_col(),
|
||||
eryt = guess_ab_col(),
|
||||
fosf = guess_ab_col(),
|
||||
fusi = guess_ab_col(),
|
||||
gent = guess_ab_col(),
|
||||
imip = guess_ab_col(),
|
||||
kana = guess_ab_col(),
|
||||
levo = guess_ab_col(),
|
||||
linc = guess_ab_col(),
|
||||
line = guess_ab_col(),
|
||||
mero = guess_ab_col(),
|
||||
metr = guess_ab_col(),
|
||||
mino = guess_ab_col(),
|
||||
moxi = guess_ab_col(),
|
||||
nali = guess_ab_col(),
|
||||
neom = guess_ab_col(),
|
||||
neti = guess_ab_col(),
|
||||
nitr = guess_ab_col(),
|
||||
novo = guess_ab_col(),
|
||||
norf = guess_ab_col(),
|
||||
oflo = guess_ab_col(),
|
||||
peni = guess_ab_col(),
|
||||
pipe = guess_ab_col(),
|
||||
pita = guess_ab_col(),
|
||||
poly = guess_ab_col(),
|
||||
qida = guess_ab_col(),
|
||||
rifa = guess_ab_col(),
|
||||
roxi = guess_ab_col(),
|
||||
siso = guess_ab_col(),
|
||||
teic = guess_ab_col(),
|
||||
tetr = guess_ab_col(),
|
||||
tica = guess_ab_col(),
|
||||
tige = guess_ab_col(),
|
||||
tobr = guess_ab_col(),
|
||||
trim = guess_ab_col(),
|
||||
trsu = guess_ab_col(),
|
||||
vanc = guess_ab_col()) {
|
||||
|
||||
if (!is.data.frame(tbl)) {
|
||||
stop("`tbl` must be a data frame.", call. = FALSE)
|
||||
@ -169,66 +169,66 @@ mdro <- function(tbl,
|
||||
}
|
||||
|
||||
# check columns
|
||||
if (identical(amcl, as.name("guess_ab"))) { amcl <- guess_ab(tbl, "amcl", verbose = info) }
|
||||
if (identical(amik, as.name("guess_ab"))) { amik <- guess_ab(tbl, "amik", verbose = info) }
|
||||
if (identical(amox, as.name("guess_ab"))) { amox <- guess_ab(tbl, "amox", verbose = info) }
|
||||
if (identical(ampi, as.name("guess_ab"))) { ampi <- guess_ab(tbl, "ampi", verbose = info) }
|
||||
if (identical(azit, as.name("guess_ab"))) { azit <- guess_ab(tbl, "azit", verbose = info) }
|
||||
if (identical(aztr, as.name("guess_ab"))) { aztr <- guess_ab(tbl, "aztr", verbose = info) }
|
||||
if (identical(cefa, as.name("guess_ab"))) { cefa <- guess_ab(tbl, "cefa", verbose = info) }
|
||||
if (identical(cfra, as.name("guess_ab"))) { cfra <- guess_ab(tbl, "cfra", verbose = info) }
|
||||
if (identical(cfep, as.name("guess_ab"))) { cfep <- guess_ab(tbl, "cfep", verbose = info) }
|
||||
if (identical(cfot, as.name("guess_ab"))) { cfot <- guess_ab(tbl, "cfot", verbose = info) }
|
||||
if (identical(cfox, as.name("guess_ab"))) { cfox <- guess_ab(tbl, "cfox", verbose = info) }
|
||||
if (identical(cfta, as.name("guess_ab"))) { cfta <- guess_ab(tbl, "cfta", verbose = info) }
|
||||
if (identical(cftr, as.name("guess_ab"))) { cftr <- guess_ab(tbl, "cftr", verbose = info) }
|
||||
if (identical(cfur, as.name("guess_ab"))) { cfur <- guess_ab(tbl, "cfur", verbose = info) }
|
||||
if (identical(chlo, as.name("guess_ab"))) { chlo <- guess_ab(tbl, "chlo", verbose = info) }
|
||||
if (identical(cipr, as.name("guess_ab"))) { cipr <- guess_ab(tbl, "cipr", verbose = info) }
|
||||
if (identical(clar, as.name("guess_ab"))) { clar <- guess_ab(tbl, "clar", verbose = info) }
|
||||
if (identical(clin, as.name("guess_ab"))) { clin <- guess_ab(tbl, "clin", verbose = info) }
|
||||
if (identical(clox, as.name("guess_ab"))) { clox <- guess_ab(tbl, "clox", verbose = info) }
|
||||
if (identical(coli, as.name("guess_ab"))) { coli <- guess_ab(tbl, "coli", verbose = info) }
|
||||
if (identical(czol, as.name("guess_ab"))) { czol <- guess_ab(tbl, "czol", verbose = info) }
|
||||
if (identical(dapt, as.name("guess_ab"))) { dapt <- guess_ab(tbl, "dapt", verbose = info) }
|
||||
if (identical(doxy, as.name("guess_ab"))) { doxy <- guess_ab(tbl, "doxy", verbose = info) }
|
||||
if (identical(erta, as.name("guess_ab"))) { erta <- guess_ab(tbl, "erta", verbose = info) }
|
||||
if (identical(eryt, as.name("guess_ab"))) { eryt <- guess_ab(tbl, "eryt", verbose = info) }
|
||||
if (identical(fosf, as.name("guess_ab"))) { fosf <- guess_ab(tbl, "fosf", verbose = info) }
|
||||
if (identical(fusi, as.name("guess_ab"))) { fusi <- guess_ab(tbl, "fusi", verbose = info) }
|
||||
if (identical(gent, as.name("guess_ab"))) { gent <- guess_ab(tbl, "gent", verbose = info) }
|
||||
if (identical(imip, as.name("guess_ab"))) { imip <- guess_ab(tbl, "imip", verbose = info) }
|
||||
if (identical(kana, as.name("guess_ab"))) { kana <- guess_ab(tbl, "kana", verbose = info) }
|
||||
if (identical(levo, as.name("guess_ab"))) { levo <- guess_ab(tbl, "levo", verbose = info) }
|
||||
if (identical(linc, as.name("guess_ab"))) { linc <- guess_ab(tbl, "linc", verbose = info) }
|
||||
if (identical(line, as.name("guess_ab"))) { line <- guess_ab(tbl, "line", verbose = info) }
|
||||
if (identical(mero, as.name("guess_ab"))) { mero <- guess_ab(tbl, "mero", verbose = info) }
|
||||
if (identical(metr, as.name("guess_ab"))) { metr <- guess_ab(tbl, "metr", verbose = info) }
|
||||
if (identical(mino, as.name("guess_ab"))) { mino <- guess_ab(tbl, "mino", verbose = info) }
|
||||
if (identical(moxi, as.name("guess_ab"))) { moxi <- guess_ab(tbl, "moxi", verbose = info) }
|
||||
if (identical(nali, as.name("guess_ab"))) { nali <- guess_ab(tbl, "nali", verbose = info) }
|
||||
if (identical(neom, as.name("guess_ab"))) { neom <- guess_ab(tbl, "neom", verbose = info) }
|
||||
if (identical(neti, as.name("guess_ab"))) { neti <- guess_ab(tbl, "neti", verbose = info) }
|
||||
if (identical(nitr, as.name("guess_ab"))) { nitr <- guess_ab(tbl, "nitr", verbose = info) }
|
||||
if (identical(novo, as.name("guess_ab"))) { novo <- guess_ab(tbl, "novo", verbose = info) }
|
||||
if (identical(norf, as.name("guess_ab"))) { norf <- guess_ab(tbl, "norf", verbose = info) }
|
||||
if (identical(oflo, as.name("guess_ab"))) { oflo <- guess_ab(tbl, "oflo", verbose = info) }
|
||||
if (identical(peni, as.name("guess_ab"))) { peni <- guess_ab(tbl, "peni", verbose = info) }
|
||||
if (identical(pipe, as.name("guess_ab"))) { pipe <- guess_ab(tbl, "pipe", verbose = info) }
|
||||
if (identical(pita, as.name("guess_ab"))) { pita <- guess_ab(tbl, "pita", verbose = info) }
|
||||
if (identical(poly, as.name("guess_ab"))) { poly <- guess_ab(tbl, "poly", verbose = info) }
|
||||
if (identical(qida, as.name("guess_ab"))) { qida <- guess_ab(tbl, "qida", verbose = info) }
|
||||
if (identical(rifa, as.name("guess_ab"))) { rifa <- guess_ab(tbl, "rifa", verbose = info) }
|
||||
if (identical(roxi, as.name("guess_ab"))) { roxi <- guess_ab(tbl, "roxi", verbose = info) }
|
||||
if (identical(siso, as.name("guess_ab"))) { siso <- guess_ab(tbl, "siso", verbose = info) }
|
||||
if (identical(teic, as.name("guess_ab"))) { teic <- guess_ab(tbl, "teic", verbose = info) }
|
||||
if (identical(tetr, as.name("guess_ab"))) { tetr <- guess_ab(tbl, "tetr", verbose = info) }
|
||||
if (identical(tica, as.name("guess_ab"))) { tica <- guess_ab(tbl, "tica", verbose = info) }
|
||||
if (identical(tige, as.name("guess_ab"))) { tige <- guess_ab(tbl, "tige", verbose = info) }
|
||||
if (identical(tobr, as.name("guess_ab"))) { tobr <- guess_ab(tbl, "tobr", verbose = info) }
|
||||
if (identical(trim, as.name("guess_ab"))) { trim <- guess_ab(tbl, "trim", verbose = info) }
|
||||
if (identical(trsu, as.name("guess_ab"))) { trsu <- guess_ab(tbl, "trsu", verbose = info) }
|
||||
if (identical(vanc, as.name("guess_ab"))) { vanc <- guess_ab(tbl, "vanc", verbose = info) }
|
||||
if (identical(amcl, as.name("guess_ab_col"))) { amcl <- guess_ab_col(tbl, "amcl", verbose = info) }
|
||||
if (identical(amik, as.name("guess_ab_col"))) { amik <- guess_ab_col(tbl, "amik", verbose = info) }
|
||||
if (identical(amox, as.name("guess_ab_col"))) { amox <- guess_ab_col(tbl, "amox", verbose = info) }
|
||||
if (identical(ampi, as.name("guess_ab_col"))) { ampi <- guess_ab_col(tbl, "ampi", verbose = info) }
|
||||
if (identical(azit, as.name("guess_ab_col"))) { azit <- guess_ab_col(tbl, "azit", verbose = info) }
|
||||
if (identical(aztr, as.name("guess_ab_col"))) { aztr <- guess_ab_col(tbl, "aztr", verbose = info) }
|
||||
if (identical(cefa, as.name("guess_ab_col"))) { cefa <- guess_ab_col(tbl, "cefa", verbose = info) }
|
||||
if (identical(cfra, as.name("guess_ab_col"))) { cfra <- guess_ab_col(tbl, "cfra", verbose = info) }
|
||||
if (identical(cfep, as.name("guess_ab_col"))) { cfep <- guess_ab_col(tbl, "cfep", verbose = info) }
|
||||
if (identical(cfot, as.name("guess_ab_col"))) { cfot <- guess_ab_col(tbl, "cfot", verbose = info) }
|
||||
if (identical(cfox, as.name("guess_ab_col"))) { cfox <- guess_ab_col(tbl, "cfox", verbose = info) }
|
||||
if (identical(cfta, as.name("guess_ab_col"))) { cfta <- guess_ab_col(tbl, "cfta", verbose = info) }
|
||||
if (identical(cftr, as.name("guess_ab_col"))) { cftr <- guess_ab_col(tbl, "cftr", verbose = info) }
|
||||
if (identical(cfur, as.name("guess_ab_col"))) { cfur <- guess_ab_col(tbl, "cfur", verbose = info) }
|
||||
if (identical(chlo, as.name("guess_ab_col"))) { chlo <- guess_ab_col(tbl, "chlo", verbose = info) }
|
||||
if (identical(cipr, as.name("guess_ab_col"))) { cipr <- guess_ab_col(tbl, "cipr", verbose = info) }
|
||||
if (identical(clar, as.name("guess_ab_col"))) { clar <- guess_ab_col(tbl, "clar", verbose = info) }
|
||||
if (identical(clin, as.name("guess_ab_col"))) { clin <- guess_ab_col(tbl, "clin", verbose = info) }
|
||||
if (identical(clox, as.name("guess_ab_col"))) { clox <- guess_ab_col(tbl, "clox", verbose = info) }
|
||||
if (identical(coli, as.name("guess_ab_col"))) { coli <- guess_ab_col(tbl, "coli", verbose = info) }
|
||||
if (identical(czol, as.name("guess_ab_col"))) { czol <- guess_ab_col(tbl, "czol", verbose = info) }
|
||||
if (identical(dapt, as.name("guess_ab_col"))) { dapt <- guess_ab_col(tbl, "dapt", verbose = info) }
|
||||
if (identical(doxy, as.name("guess_ab_col"))) { doxy <- guess_ab_col(tbl, "doxy", verbose = info) }
|
||||
if (identical(erta, as.name("guess_ab_col"))) { erta <- guess_ab_col(tbl, "erta", verbose = info) }
|
||||
if (identical(eryt, as.name("guess_ab_col"))) { eryt <- guess_ab_col(tbl, "eryt", verbose = info) }
|
||||
if (identical(fosf, as.name("guess_ab_col"))) { fosf <- guess_ab_col(tbl, "fosf", verbose = info) }
|
||||
if (identical(fusi, as.name("guess_ab_col"))) { fusi <- guess_ab_col(tbl, "fusi", verbose = info) }
|
||||
if (identical(gent, as.name("guess_ab_col"))) { gent <- guess_ab_col(tbl, "gent", verbose = info) }
|
||||
if (identical(imip, as.name("guess_ab_col"))) { imip <- guess_ab_col(tbl, "imip", verbose = info) }
|
||||
if (identical(kana, as.name("guess_ab_col"))) { kana <- guess_ab_col(tbl, "kana", verbose = info) }
|
||||
if (identical(levo, as.name("guess_ab_col"))) { levo <- guess_ab_col(tbl, "levo", verbose = info) }
|
||||
if (identical(linc, as.name("guess_ab_col"))) { linc <- guess_ab_col(tbl, "linc", verbose = info) }
|
||||
if (identical(line, as.name("guess_ab_col"))) { line <- guess_ab_col(tbl, "line", verbose = info) }
|
||||
if (identical(mero, as.name("guess_ab_col"))) { mero <- guess_ab_col(tbl, "mero", verbose = info) }
|
||||
if (identical(metr, as.name("guess_ab_col"))) { metr <- guess_ab_col(tbl, "metr", verbose = info) }
|
||||
if (identical(mino, as.name("guess_ab_col"))) { mino <- guess_ab_col(tbl, "mino", verbose = info) }
|
||||
if (identical(moxi, as.name("guess_ab_col"))) { moxi <- guess_ab_col(tbl, "moxi", verbose = info) }
|
||||
if (identical(nali, as.name("guess_ab_col"))) { nali <- guess_ab_col(tbl, "nali", verbose = info) }
|
||||
if (identical(neom, as.name("guess_ab_col"))) { neom <- guess_ab_col(tbl, "neom", verbose = info) }
|
||||
if (identical(neti, as.name("guess_ab_col"))) { neti <- guess_ab_col(tbl, "neti", verbose = info) }
|
||||
if (identical(nitr, as.name("guess_ab_col"))) { nitr <- guess_ab_col(tbl, "nitr", verbose = info) }
|
||||
if (identical(novo, as.name("guess_ab_col"))) { novo <- guess_ab_col(tbl, "novo", verbose = info) }
|
||||
if (identical(norf, as.name("guess_ab_col"))) { norf <- guess_ab_col(tbl, "norf", verbose = info) }
|
||||
if (identical(oflo, as.name("guess_ab_col"))) { oflo <- guess_ab_col(tbl, "oflo", verbose = info) }
|
||||
if (identical(peni, as.name("guess_ab_col"))) { peni <- guess_ab_col(tbl, "peni", verbose = info) }
|
||||
if (identical(pipe, as.name("guess_ab_col"))) { pipe <- guess_ab_col(tbl, "pipe", verbose = info) }
|
||||
if (identical(pita, as.name("guess_ab_col"))) { pita <- guess_ab_col(tbl, "pita", verbose = info) }
|
||||
if (identical(poly, as.name("guess_ab_col"))) { poly <- guess_ab_col(tbl, "poly", verbose = info) }
|
||||
if (identical(qida, as.name("guess_ab_col"))) { qida <- guess_ab_col(tbl, "qida", verbose = info) }
|
||||
if (identical(rifa, as.name("guess_ab_col"))) { rifa <- guess_ab_col(tbl, "rifa", verbose = info) }
|
||||
if (identical(roxi, as.name("guess_ab_col"))) { roxi <- guess_ab_col(tbl, "roxi", verbose = info) }
|
||||
if (identical(siso, as.name("guess_ab_col"))) { siso <- guess_ab_col(tbl, "siso", verbose = info) }
|
||||
if (identical(teic, as.name("guess_ab_col"))) { teic <- guess_ab_col(tbl, "teic", verbose = info) }
|
||||
if (identical(tetr, as.name("guess_ab_col"))) { tetr <- guess_ab_col(tbl, "tetr", verbose = info) }
|
||||
if (identical(tica, as.name("guess_ab_col"))) { tica <- guess_ab_col(tbl, "tica", verbose = info) }
|
||||
if (identical(tige, as.name("guess_ab_col"))) { tige <- guess_ab_col(tbl, "tige", verbose = info) }
|
||||
if (identical(tobr, as.name("guess_ab_col"))) { tobr <- guess_ab_col(tbl, "tobr", verbose = info) }
|
||||
if (identical(trim, as.name("guess_ab_col"))) { trim <- guess_ab_col(tbl, "trim", verbose = info) }
|
||||
if (identical(trsu, as.name("guess_ab_col"))) { trsu <- guess_ab_col(tbl, "trsu", verbose = info) }
|
||||
if (identical(vanc, as.name("guess_ab_col"))) { vanc <- guess_ab_col(tbl, "vanc", verbose = info) }
|
||||
col.list <- c(amcl, amik, amox, ampi, azit, aztr, cefa, cfra, cfep, cfot,
|
||||
cfox, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli,
|
||||
czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana,
|
||||
|
13
_pkgdown.yml
@ -53,6 +53,9 @@ navbar:
|
||||
- text: 'Use the G-test'
|
||||
icon: 'fa-clipboard-check'
|
||||
href: 'articles/G_test.html'
|
||||
- text: 'Other: benchmarks'
|
||||
icon: 'fa-shipping-fast'
|
||||
href: 'articles/benchmarks.html'
|
||||
- text: 'Manual'
|
||||
icon: 'fa-book-open'
|
||||
href: 'reference/'
|
||||
@ -73,7 +76,8 @@ navbar:
|
||||
reference:
|
||||
- title: 'Background information'
|
||||
desc: >
|
||||
Some pages about our package and its external sources.
|
||||
Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html)
|
||||
for more information about how to work with functions in this package.
|
||||
contents:
|
||||
- '`AMR`'
|
||||
- '`ITIS`'
|
||||
@ -85,7 +89,7 @@ reference:
|
||||
contents:
|
||||
- starts_with("as.")
|
||||
- '`eucast_rules`'
|
||||
- '`guess_ab`'
|
||||
- '`guess_ab_col`'
|
||||
- '`read.4D`'
|
||||
- title: 'Adding variables to your data'
|
||||
desc: >
|
||||
@ -129,7 +133,10 @@ reference:
|
||||
- '`microorganisms.umcg`'
|
||||
- '`supplementary_data`'
|
||||
- title: Other
|
||||
desc: ~
|
||||
desc: >
|
||||
These functions are mostly for internal use, but some of
|
||||
them may also be suitable for your analysis. Especially the
|
||||
'like' function can be useful: `if (x %like% y) {...}`.
|
||||
contents:
|
||||
- '`get_locale`'
|
||||
- '`like`'
|
||||
|
@ -149,6 +149,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -111,6 +111,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -171,7 +178,7 @@
|
||||
<h1>How to conduct AMR analysis</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">08 January 2019</h4>
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>AMR.Rmd</code></div>
|
||||
@ -180,7 +187,7 @@
|
||||
|
||||
|
||||
|
||||
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">RMarkdown</a>. However, the methodology remains unchanged. This page was generated on 08 January 2019.</p>
|
||||
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">RMarkdown</a>. However, the methodology remains unchanged. This page was generated on 11 January 2019.</p>
|
||||
<div id="introduction" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#introduction" class="anchor"></a>Introduction</h2>
|
||||
@ -196,21 +203,21 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">2019-01-08</td>
|
||||
<td align="center">2019-01-11</td>
|
||||
<td align="center">abcd</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2019-01-08</td>
|
||||
<td align="center">2019-01-11</td>
|
||||
<td align="center">abcd</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2019-01-08</td>
|
||||
<td align="center">2019-01-11</td>
|
||||
<td align="center">efgh</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
@ -268,18 +275,18 @@
|
||||
<div id="put-everything-together" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#put-everything-together" class="anchor"></a>Put everything together</h4>
|
||||
<p>Using the <code><a href="https://dplyr.tidyverse.org/reference/sample.html">sample()</a></code> function, we can randomly select items from all objects we defined earlier. To let our fake data reflect reality a bit, we will also approximately define the probabilities of bacteria and the antibiotic results with the <code>prob</code> parameter.</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">data <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">date =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(dates, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
|
||||
<a class="sourceLine" id="cb7-2" data-line-number="2"> <span class="dt">patient_id =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(patients, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
|
||||
<a class="sourceLine" id="cb7-3" data-line-number="3"> <span class="dt">hospital =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(hospitals, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.30</span>, <span class="fl">0.35</span>, <span class="fl">0.15</span>, <span class="fl">0.20</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-4" data-line-number="4"> <span class="dt">bacteria =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(bacteria, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.50</span>, <span class="fl">0.25</span>, <span class="fl">0.15</span>, <span class="fl">0.10</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-5" data-line-number="5"> <span class="dt">amox =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.60</span>, <span class="fl">0.05</span>, <span class="fl">0.35</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-6" data-line-number="6"> <span class="dt">amcl =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.75</span>, <span class="fl">0.10</span>, <span class="fl">0.15</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-7" data-line-number="7"> <span class="dt">cipr =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.80</span>, <span class="fl">0.00</span>, <span class="fl">0.20</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-8" data-line-number="8"> <span class="dt">gent =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.92</span>, <span class="fl">0.00</span>, <span class="fl">0.08</span>))</a>
|
||||
<p>Using the <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample()</a></code> function, we can randomly select items from all objects we defined earlier. To let our fake data reflect reality a bit, we will also approximately define the probabilities of bacteria and the antibiotic results with the <code>prob</code> parameter.</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">data <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/data.frame">data.frame</a></span>(<span class="dt">date =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(dates, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
|
||||
<a class="sourceLine" id="cb7-2" data-line-number="2"> <span class="dt">patient_id =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(patients, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>),</a>
|
||||
<a class="sourceLine" id="cb7-3" data-line-number="3"> <span class="dt">hospital =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(hospitals, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.30</span>, <span class="fl">0.35</span>, <span class="fl">0.15</span>, <span class="fl">0.20</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-4" data-line-number="4"> <span class="dt">bacteria =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(bacteria, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.50</span>, <span class="fl">0.25</span>, <span class="fl">0.15</span>, <span class="fl">0.10</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-5" data-line-number="5"> <span class="dt">amox =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.60</span>, <span class="fl">0.05</span>, <span class="fl">0.35</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-6" data-line-number="6"> <span class="dt">amcl =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.75</span>, <span class="fl">0.10</span>, <span class="fl">0.15</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-7" data-line-number="7"> <span class="dt">cipr =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.80</span>, <span class="fl">0.00</span>, <span class="fl">0.20</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-8" data-line-number="8"> <span class="dt">gent =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample</a></span>(ab_interpretations, <span class="dv">5000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>, <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.92</span>, <span class="fl">0.00</span>, <span class="fl">0.08</span>))</a>
|
||||
<a class="sourceLine" id="cb7-9" data-line-number="9"> )</a></code></pre></div>
|
||||
<p>Using the <code><a href="https://dplyr.tidyverse.org/reference/join.html">left_join()</a></code> function from the <code>dplyr</code> package, we can ‘map’ the gender to the patient ID using the <code>patients_table</code> object we created earlier:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/join.html">left_join</a></span>(patients_table)</a></code></pre></div>
|
||||
<p>Using the <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/join">left_join()</a></code> function from the <code>dplyr</code> package, we can ‘map’ the gender to the patient ID using the <code>patients_table</code> object we created earlier:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/join">left_join</a></span>(patients_table)</a></code></pre></div>
|
||||
<p>The resulting data set contains 5,000 blood culture isolates. With the <code><a href="https://www.rdocumentation.org/packages/utils/topics/head">head()</a></code> function we can preview the first 6 values of this data set:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data)</a></code></pre></div>
|
||||
<table class="table">
|
||||
@ -296,70 +303,70 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">2011-02-27</td>
|
||||
<td align="center">M6</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">2014-02-02</td>
|
||||
<td align="center">P8</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2012-07-12</td>
|
||||
<td align="center">C2</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2016-09-13</td>
|
||||
<td align="center">O7</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2016-12-05</td>
|
||||
<td align="center">E4</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">2013-10-26</td>
|
||||
<td align="center">Q1</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2017-06-12</td>
|
||||
<td align="center">E5</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2013-06-16</td>
|
||||
<td align="center">K7</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2017-10-05</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">2013-01-11</td>
|
||||
<td align="center">M4</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">R</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">2012-02-22</td>
|
||||
<td align="center">H9</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">2016-11-18</td>
|
||||
<td align="center">W10</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -379,15 +386,15 @@
|
||||
#
|
||||
# Item Count Percent Cum. Count Cum. Percent
|
||||
# --- ----- ------ -------- ----------- -------------
|
||||
# 1 M 2,635 52.7% 2,635 52.7%
|
||||
# 2 F 2,365 47.3% 5,000 100.0%</code></pre>
|
||||
# 1 M 2,598 52.0% 2,598 52.0%
|
||||
# 2 F 2,402 48.0% 5,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>
|
||||
<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://www.rdocumentation.org/packages/dplyr/topics/mutate">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" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">bacteria =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(bacteria))</a></code></pre></div>
|
||||
<p>We also want to transform the antibiotics, because in real life data we don’t know if they are really clean. The <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function ensures reliability and reproducibility in these kind of variables. The <code><a href="https://dplyr.tidyverse.org/reference/summarise_all.html">mutate_at()</a></code> will run the <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function on defined variables:</p>
|
||||
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/mutate">mutate</a></span>(<span class="dt">bacteria =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(bacteria))</a></code></pre></div>
|
||||
<p>We also want to transform the antibiotics, because in real life data we don’t know if they are really clean. The <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function ensures reliability and reproducibility in these kind of variables. The <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise_all">mutate_at()</a></code> will run the <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function on defined variables:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(amox<span class="op">:</span>gent), as.rsi)</a></code></pre></div>
|
||||
<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise_all">mutate_at</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/vars">vars</a></span>(amox<span class="op">:</span>gent), as.rsi)</a></code></pre></div>
|
||||
<p>Finally, we will apply <a href="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST rules</a> on our antimicrobial results. In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
|
||||
<p>Because the amoxicillin (column <code>amox</code>) and amoxicillin/clavulanic acid (column <code>amcl</code>) in our data were generated randomly, some rows will undoubtedly contain amox = S and amcl = R, which is technically impossible. The <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> fixes this:</p>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" data-line-number="1">data <-<span class="st"> </span><span class="kw"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(data, <span class="dt">col_mo =</span> <span class="st">"bacteria"</span>)</a>
|
||||
@ -411,10 +418,10 @@
|
||||
<a class="sourceLine" id="cb14-19" data-line-number="19"><span class="co"># Kingella kingae (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-20" data-line-number="20"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb14-21" data-line-number="21"><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
|
||||
<a class="sourceLine" id="cb14-22" data-line-number="22"><span class="co"># Table 1: Intrinsic resistance in Enterobacteriaceae (349 changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-22" data-line-number="22"><span class="co"># Table 1: Intrinsic resistance in Enterobacteriaceae (333 changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-23" data-line-number="23"><span class="co"># Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-24" data-line-number="24"><span class="co"># Table 3: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-25" data-line-number="25"><span class="co"># Table 4: Intrinsic resistance in Gram-positive bacteria (694 changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-25" data-line-number="25"><span class="co"># Table 4: Intrinsic resistance in Gram-positive bacteria (692 changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-26" data-line-number="26"><span class="co"># Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-27" data-line-number="27"><span class="co"># Table 9: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-28" data-line-number="28"><span class="co"># Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria (no changes)</span></a>
|
||||
@ -430,14 +437,14 @@
|
||||
<a class="sourceLine" id="cb14-38" data-line-number="38"><span class="co"># Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-39" data-line-number="39"><span class="co"># Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-40" data-line-number="40"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb14-41" data-line-number="41"><span class="co"># => EUCAST rules affected 1,854 out of 5,000 rows -> changed 1,043 test results.</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb14-41" data-line-number="41"><span class="co"># => EUCAST rules affected 1,830 out of 5,000 rows -> changed 1,025 test results.</span></a></code></pre></div>
|
||||
</div>
|
||||
<div id="adding-new-variables" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#adding-new-variables" class="anchor"></a>Adding new variables</h2>
|
||||
<p>Now that we have the microbial ID, we can add some taxonomic properties:</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb15-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">gramstain =</span> <span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(bacteria),</a>
|
||||
<a class="sourceLine" id="cb15-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/mutate">mutate</a></span>(<span class="dt">gramstain =</span> <span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(bacteria),</a>
|
||||
<a class="sourceLine" id="cb15-3" data-line-number="3"> <span class="dt">genus =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(bacteria),</a>
|
||||
<a class="sourceLine" id="cb15-4" data-line-number="4"> <span class="dt">species =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(bacteria))</a></code></pre></div>
|
||||
<div id="first-isolates" class="section level3">
|
||||
@ -451,14 +458,14 @@
|
||||
</blockquote>
|
||||
<p>This <code>AMR</code> package includes this methodology with the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function. It adopts the episode of a year (can be changed by user) and it starts counting days after every selected isolate. This new variable can easily be added to our data:</p>
|
||||
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">first =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</a>
|
||||
<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/mutate">mutate</a></span>(<span class="dt">first =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</a>
|
||||
<a class="sourceLine" id="cb16-3" data-line-number="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" data-line-number="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" data-line-number="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" data-line-number="6"><span class="co"># => Found 2,929 first isolates (58.6% of total)</span></a></code></pre></div>
|
||||
<p>So only 58.6% is suitable for resistance analysis! We can now filter on is 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" data-line-number="6"><span class="co"># => Found 2,962 first isolates (59.2% of total)</span></a></code></pre></div>
|
||||
<p>So only 59.2% is suitable for resistance analysis! We can now filter on is with the <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/filter">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" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb17-2" data-line-number="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>
|
||||
<a class="sourceLine" id="cb17-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/filter">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>
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>()</a></code></pre></div>
|
||||
@ -482,21 +489,21 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-31</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2010-05-23</td>
|
||||
<td align="center">E7</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">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-08-01</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2010-08-03</td>
|
||||
<td align="center">E7</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>
|
||||
@ -504,52 +511,52 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-12-29</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-01-20</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">I</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">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2011-01-21</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-02-21</td>
|
||||
<td align="center">E7</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">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2011-02-06</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-08-04</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</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">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2011-05-30</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-11-15</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">I</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">7</td>
|
||||
<td align="center">2011-08-16</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2012-01-13</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -559,8 +566,8 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2012-01-15</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2012-03-10</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -570,22 +577,22 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2014-07-16</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2012-11-09</td>
|
||||
<td align="center">E7</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">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2014-09-19</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2013-04-06</td>
|
||||
<td align="center">E7</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>
|
||||
@ -595,8 +602,8 @@
|
||||
<p>Only 3 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and show be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
|
||||
<p>If a column exists with a name like ‘key(…)ab’ the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb19-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb19-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">first_weighted =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</a>
|
||||
<a class="sourceLine" id="cb19-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/mutate">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb19-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/mutate">mutate</a></span>(<span class="dt">first_weighted =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</a>
|
||||
<a class="sourceLine" id="cb19-4" data-line-number="4"><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="cb19-5" data-line-number="5"><span class="co"># amox amcl cipr gent </span></a>
|
||||
<a class="sourceLine" id="cb19-6" data-line-number="6"><span class="co"># "amox" "amcl" "cipr" "gent" </span></a>
|
||||
@ -608,7 +615,7 @@
|
||||
<a class="sourceLine" id="cb19-12" data-line-number="12"><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-13" data-line-number="13"><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-14" data-line-number="14"><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
|
||||
<a class="sourceLine" id="cb19-15" data-line-number="15"><span class="co"># => Found 4,435 first weighted isolates (88.7% of total)</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb19-15" data-line-number="15"><span class="co"># => Found 4,399 first weighted isolates (88.0% of total)</span></a></code></pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="center">isolate</th>
|
||||
@ -625,80 +632,80 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-31</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2010-05-23</td>
|
||||
<td align="center">E7</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">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-08-01</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2010-08-03</td>
|
||||
<td align="center">E7</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>
|
||||
<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-12-29</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-01-20</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">I</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">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2011-01-21</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-02-21</td>
|
||||
<td align="center">E7</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">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2011-02-06</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-08-04</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</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">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2011-05-30</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2011-11-15</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">I</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">7</td>
|
||||
<td align="center">2011-08-16</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2012-01-13</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -709,8 +716,8 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2012-01-15</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2012-03-10</td>
|
||||
<td align="center">E7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -721,23 +728,23 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2014-07-16</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2012-11-09</td>
|
||||
<td align="center">E7</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">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2014-09-19</td>
|
||||
<td align="center">L4</td>
|
||||
<td align="center">2013-04-06</td>
|
||||
<td align="center">E7</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>
|
||||
@ -745,14 +752,14 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Instead of 3, now 8 isolates are flagged. In total, 88.7% of all isolates are marked ‘first weighted’ - 147.3% 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 3, now 10 isolates are flagged. In total, 88% of all isolates are marked ‘first weighted’ - 147.2% 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" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb20-2" data-line-number="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 4,435 isolates for analysis.</p>
|
||||
<p>So we end up with 4,399 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" data-line-number="1">data_1st <-<span class="st"> </span>data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb21-2" data-line-number="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>
|
||||
<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/select">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>
|
||||
<p>Now our data looks like:</p>
|
||||
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" data-line-number="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">
|
||||
@ -775,43 +782,11 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>1</td>
|
||||
<td align="center">2011-02-27</td>
|
||||
<td align="center">M6</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">2014-02-02</td>
|
||||
<td align="center">P8</td>
|
||||
<td align="center">Hospital D</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">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>2</td>
|
||||
<td align="center">2012-07-12</td>
|
||||
<td align="center">C2</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_STRPTC_PNE</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">M</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="odd">
|
||||
<td>3</td>
|
||||
<td align="center">2016-09-13</td>
|
||||
<td align="center">O7</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -822,30 +797,30 @@
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>5</td>
|
||||
<td align="center">2017-10-05</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td>2</td>
|
||||
<td align="center">2013-10-26</td>
|
||||
<td align="center">Q1</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</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>6</td>
|
||||
<td align="center">2012-02-22</td>
|
||||
<td align="center">H9</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td>3</td>
|
||||
<td align="center">2017-06-12</td>
|
||||
<td align="center">E5</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">B_STRPTC_PNE</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">Gram positive</td>
|
||||
@ -854,15 +829,47 @@
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>7</td>
|
||||
<td align="center">2011-01-13</td>
|
||||
<td align="center">S6</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td>4</td>
|
||||
<td align="center">2013-06-16</td>
|
||||
<td align="center">K7</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">I</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="odd">
|
||||
<td>5</td>
|
||||
<td align="center">2013-01-11</td>
|
||||
<td align="center">M4</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_STPHY_AUR</td>
|
||||
<td align="center">I</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">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>7</td>
|
||||
<td align="center">2012-01-05</td>
|
||||
<td align="center">S10</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">B_STPHY_AUR</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram positive</td>
|
||||
<td align="center">Staphylococcus</td>
|
||||
@ -884,7 +891,7 @@
|
||||
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" data-line-number="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></strong><br>
|
||||
Columns: 2<br>
|
||||
Length: 4,435 (of which NA: 0 = 0.00%)<br>
|
||||
Length: 4,399 (of which NA: 0 = 0.00%)<br>
|
||||
Unique: 4</p>
|
||||
<p>Shortest: 16<br>
|
||||
Longest: 24</p>
|
||||
@ -901,33 +908,33 @@ Longest: 24</p>
|
||||
<tr class="odd">
|
||||
<td align="left">1</td>
|
||||
<td align="left">Escherichia coli</td>
|
||||
<td align="right">2,203</td>
|
||||
<td align="right">49.7%</td>
|
||||
<td align="right">2,203</td>
|
||||
<td align="right">49.7%</td>
|
||||
<td align="right">2,138</td>
|
||||
<td align="right">48.6%</td>
|
||||
<td align="right">2,138</td>
|
||||
<td align="right">48.6%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Staphylococcus aureus</td>
|
||||
<td align="right">1,072</td>
|
||||
<td align="right">24.2%</td>
|
||||
<td align="right">3,275</td>
|
||||
<td align="right">73.8%</td>
|
||||
<td align="right">1,070</td>
|
||||
<td align="right">24.3%</td>
|
||||
<td align="right">3,208</td>
|
||||
<td align="right">72.9%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">Streptococcus pneumoniae</td>
|
||||
<td align="right">689</td>
|
||||
<td align="right">15.5%</td>
|
||||
<td align="right">3,964</td>
|
||||
<td align="right">89.4%</td>
|
||||
<td align="right">697</td>
|
||||
<td align="right">15.8%</td>
|
||||
<td align="right">3,905</td>
|
||||
<td align="right">88.8%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
<td align="left">Klebsiella pneumoniae</td>
|
||||
<td align="right">471</td>
|
||||
<td align="right">10.6%</td>
|
||||
<td align="right">4,435</td>
|
||||
<td align="right">494</td>
|
||||
<td align="right">11.2%</td>
|
||||
<td align="right">4,399</td>
|
||||
<td align="right">100.0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -937,11 +944,11 @@ Longest: 24</p>
|
||||
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h3>
|
||||
<p>The functions <code>portion_R</code>, <code>portion_RI</code>, <code>portion_I</code>, <code>portion_IS</code> and <code>portion_S</code> can be used to determine the portion of a specific antimicrobial outcome. They 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" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(amox)</a>
|
||||
<a class="sourceLine" id="cb25-2" data-line-number="2"><span class="co"># [1] 0.4617813</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>
|
||||
<a class="sourceLine" id="cb25-2" data-line-number="2"><span class="co"># [1] 0.4819277</span></a></code></pre></div>
|
||||
<p>Or can be used in conjuction with <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by()</a></code> and <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">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" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb26-2" data-line-number="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>
|
||||
<a class="sourceLine" id="cb26-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(amox))</a></code></pre></div>
|
||||
<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by</a></span>(hospital) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb26-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(amox))</a></code></pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="center">hospital</th>
|
||||
@ -950,26 +957,26 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">0.4504164</td>
|
||||
<td align="center">0.4591382</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4782034</td>
|
||||
<td align="center">0.5000000</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4670571</td>
|
||||
<td align="center">0.4682171</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4471101</td>
|
||||
<td align="center">0.4953380</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Of course it would be very convenient to know the number of isolates responsible for the percentages. For that purpose the <code><a href="../reference/count.html">n_rsi()</a></code> can be used, which works exactly like <code><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct()</a></code> from the <code>dplyr</code> package. It counts all isolates available for every group (i.e. values S, I or R):</p>
|
||||
<p>Of course it would be very convenient to know the number of isolates responsible for the percentages. For that purpose the <code><a href="../reference/count.html">n_rsi()</a></code> can be used, which works exactly like <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/n_distinct">n_distinct()</a></code> from the <code>dplyr</code> package. It counts all isolates available for every group (i.e. values S, I or R):</p>
|
||||
<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb27-2" data-line-number="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>
|
||||
<a class="sourceLine" id="cb27-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(amox),</a>
|
||||
<a class="sourceLine" id="cb27-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by</a></span>(hospital) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb27-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(amox),</a>
|
||||
<a class="sourceLine" id="cb27-4" data-line-number="4"> <span class="dt">available =</span> <span class="kw"><a href="../reference/count.html">n_rsi</a></span>(amox))</a></code></pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
@ -980,30 +987,30 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">0.4504164</td>
|
||||
<td align="center">1321</td>
|
||||
<td align="center">0.4591382</td>
|
||||
<td align="center">1346</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4782034</td>
|
||||
<td align="center">1514</td>
|
||||
<td align="center">0.5000000</td>
|
||||
<td align="center">1550</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4670571</td>
|
||||
<td align="center">683</td>
|
||||
<td align="center">0.4682171</td>
|
||||
<td align="center">645</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4471101</td>
|
||||
<td align="center">917</td>
|
||||
<td align="center">0.4953380</td>
|
||||
<td align="center">858</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>These functions can also be used to get the portion of multiple antibiotics, to calculate co-resistance very easily:</p>
|
||||
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb28-1" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb28-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb28-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl),</a>
|
||||
<a class="sourceLine" id="cb28-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by</a></span>(genus) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb28-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl),</a>
|
||||
<a class="sourceLine" id="cb28-4" data-line-number="4"> <span class="dt">gentamicin =</span> <span class="kw"><a href="../reference/portion.html">portion_S</a></span>(gent),</a>
|
||||
<a class="sourceLine" id="cb28-5" data-line-number="5"> <span class="st">"amox + gent"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent))</a></code></pre></div>
|
||||
<table class="table">
|
||||
@ -1016,37 +1023,37 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">0.7162960</td>
|
||||
<td align="center">0.9051294</td>
|
||||
<td align="center">0.9786655</td>
|
||||
<td align="center">0.7193639</td>
|
||||
<td align="center">0.9111319</td>
|
||||
<td align="center">0.9742750</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Klebsiella</td>
|
||||
<td align="center">0.7494692</td>
|
||||
<td align="center">0.9129512</td>
|
||||
<td align="center">0.9766454</td>
|
||||
<td align="center">0.7226721</td>
|
||||
<td align="center">0.9028340</td>
|
||||
<td align="center">0.9777328</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">0.7341418</td>
|
||||
<td align="center">0.9244403</td>
|
||||
<td align="center">0.9776119</td>
|
||||
<td align="center">0.7392523</td>
|
||||
<td align="center">0.9084112</td>
|
||||
<td align="center">0.9831776</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Streptococcus</td>
|
||||
<td align="center">0.7576197</td>
|
||||
<td align="center">0.7532281</td>
|
||||
<td align="center">0.0000000</td>
|
||||
<td align="center">0.7576197</td>
|
||||
<td align="center">0.7532281</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>To make a transition to the next part, let’s see how this difference could be plotted:</p>
|
||||
<div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb29-1" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb29-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb29-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="st">"1. Amoxicillin"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl),</a>
|
||||
<a class="sourceLine" id="cb29-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by</a></span>(genus) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb29-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">summarise</a></span>(<span class="st">"1. Amoxicillin"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl),</a>
|
||||
<a class="sourceLine" id="cb29-4" data-line-number="4"> <span class="st">"2. Gentamicin"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(gent),</a>
|
||||
<a class="sourceLine" id="cb29-5" data-line-number="5"> <span class="st">"3. Amox + gent"</span> =<span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent)) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb29-6" data-line-number="6"><span class="st"> </span>tidyr<span class="op">::</span><span class="kw"><a href="https://tidyr.tidyverse.org/reference/gather.html">gather</a></span>(<span class="st">"Antibiotic"</span>, <span class="st">"S"</span>, <span class="op">-</span>genus) <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb29-6" data-line-number="6"><span class="st"> </span>tidyr<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/tidyr/topics/gather">gather</a></span>(<span class="st">"Antibiotic"</span>, <span class="st">"S"</span>, <span class="op">-</span>genus) <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb29-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span>(<span class="kw"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span>(<span class="dt">x =</span> genus,</a>
|
||||
<a class="sourceLine" id="cb29-8" data-line-number="8"> <span class="dt">y =</span> S,</a>
|
||||
<a class="sourceLine" id="cb29-9" data-line-number="9"> <span class="dt">fill =</span> Antibiotic)) <span class="op">+</span></a>
|
||||
@ -1076,7 +1083,7 @@ Longest: 24</p>
|
||||
<p>Omit the <code>translate_ab = FALSE</code> to have the antibiotic codes (amox, amcl, cipr, gent) translated to official WHO names (amoxicillin, amoxicillin and betalactamase inhibitor, ciprofloxacin, gentamicin).</p>
|
||||
<p>If we group on e.g. the <code>genus</code> column and add some additional functions from our package, we can create this:</p>
|
||||
<div class="sourceCode" id="cb32"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb32-1" data-line-number="1"><span class="co"># group the data on `genus`</span></a>
|
||||
<a class="sourceLine" id="cb32-2" data-line-number="2"><span class="kw"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span>(data_1st <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus)) <span class="op">+</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb32-2" data-line-number="2"><span class="kw"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span>(data_1st <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by</a></span>(genus)) <span class="op">+</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb32-3" data-line-number="3"><span class="st"> </span><span class="co"># create bars with genus on x axis</span></a>
|
||||
<a class="sourceLine" id="cb32-4" data-line-number="4"><span class="st"> </span><span class="co"># it looks for variables with class `rsi`,</span></a>
|
||||
<a class="sourceLine" id="cb32-5" data-line-number="5"><span class="st"> </span><span class="co"># of which we have 4 (earlier created with `as.rsi`)</span></a>
|
||||
@ -1098,7 +1105,7 @@ Longest: 24</p>
|
||||
<p><img src="AMR_files/figure-html/plot%204-1.png" width="720"></p>
|
||||
<p>To simplify this, we also created the <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> function, which combines almost all above functions:</p>
|
||||
<div class="sourceCode" id="cb33"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb33-1" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb33-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(genus) <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb33-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by</a></span>(genus) <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb33-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/ggplot_rsi.html">ggplot_rsi</a></span>(<span class="dt">x =</span> <span class="st">"genus"</span>,</a>
|
||||
<a class="sourceLine" id="cb33-4" data-line-number="4"> <span class="dt">facet =</span> <span class="st">"Antibiotic"</span>,</a>
|
||||
<a class="sourceLine" id="cb33-5" data-line-number="5"> <span class="dt">breaks =</span> <span class="dv">0</span><span class="op">:</span><span class="dv">4</span> <span class="op">*</span><span class="st"> </span><span class="dv">25</span>,</a>
|
||||
@ -1132,12 +1139,12 @@ Longest: 24</p>
|
||||
</table>
|
||||
<p>We can transform the data and apply the test in only a couple of lines:</p>
|
||||
<div class="sourceCode" id="cb34"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb34-1" data-line-number="1">septic_patients <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb34-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(hospital_id <span class="op">%in%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"A"</span>, <span class="st">"D"</span>)) <span class="op">%>%</span><span class="st"> </span><span class="co"># filter on only hospitals A and D</span></a>
|
||||
<a class="sourceLine" id="cb34-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(hospital_id, fosf) <span class="op">%>%</span><span class="st"> </span><span class="co"># select the hospitals and fosfomycin</span></a>
|
||||
<a class="sourceLine" id="cb34-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital_id) <span class="op">%>%</span><span class="st"> </span><span class="co"># group on the hospitals</span></a>
|
||||
<a class="sourceLine" id="cb34-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/filter">filter</a></span>(hospital_id <span class="op">%in%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"A"</span>, <span class="st">"D"</span>)) <span class="op">%>%</span><span class="st"> </span><span class="co"># filter on only hospitals A and D</span></a>
|
||||
<a class="sourceLine" id="cb34-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/select">select</a></span>(hospital_id, fosf) <span class="op">%>%</span><span class="st"> </span><span class="co"># select the hospitals and fosfomycin</span></a>
|
||||
<a class="sourceLine" id="cb34-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/group_by">group_by</a></span>(hospital_id) <span class="op">%>%</span><span class="st"> </span><span class="co"># group on the hospitals</span></a>
|
||||
<a class="sourceLine" id="cb34-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_df</a></span>(<span class="dt">combine_IR =</span> <span class="ot">TRUE</span>) <span class="op">%>%</span><span class="st"> </span><span class="co"># count all isolates per group (hospital_id)</span></a>
|
||||
<a class="sourceLine" id="cb34-6" data-line-number="6"><span class="st"> </span>tidyr<span class="op">::</span><span class="kw"><a href="https://tidyr.tidyverse.org/reference/spread.html">spread</a></span>(hospital_id, Value) <span class="op">%>%</span><span class="st"> </span><span class="co"># transform output so A and D are columns</span></a>
|
||||
<a class="sourceLine" id="cb34-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(A, D) <span class="op">%>%</span><span class="st"> </span><span class="co"># and select these only</span></a>
|
||||
<a class="sourceLine" id="cb34-6" data-line-number="6"><span class="st"> </span>tidyr<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/tidyr/topics/spread">spread</a></span>(hospital_id, Value) <span class="op">%>%</span><span class="st"> </span><span class="co"># transform output so A and D are columns</span></a>
|
||||
<a class="sourceLine" id="cb34-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/select">select</a></span>(A, D) <span class="op">%>%</span><span class="st"> </span><span class="co"># and select these only</span></a>
|
||||
<a class="sourceLine" id="cb34-8" data-line-number="8"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">as.matrix</a></span>() <span class="op">%>%</span><span class="st"> </span><span class="co"># transform to good old matrix for fisher.test()</span></a>
|
||||
<a class="sourceLine" id="cb34-9" data-line-number="9"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/fisher.test">fisher.test</a></span>() <span class="co"># do Fisher's Exact Test</span></a>
|
||||
<a class="sourceLine" id="cb34-10" data-line-number="10"><span class="co"># </span></a>
|
||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
@ -111,6 +111,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -171,7 +178,7 @@
|
||||
<h1>How to apply EUCAST rules</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">08 January 2019</h4>
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>EUCAST.Rmd</code></div>
|
||||
|
@ -111,6 +111,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -171,7 +178,7 @@
|
||||
<h1>How to use the <em>G</em>-test</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">08 January 2019</h4>
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>G_test.Rmd</code></div>
|
||||
|
@ -111,6 +111,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -171,7 +178,7 @@
|
||||
<h1>How to predict antimicrobial resistance</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">08 January 2019</h4>
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>Predict.Rmd</code></div>
|
||||
|
@ -111,6 +111,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -171,7 +178,7 @@
|
||||
<h1>How to get properties of an antibiotic</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">08 January 2019</h4>
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>ab_property.Rmd</code></div>
|
||||
|
371
docs/articles/benchmarks.html
Normal file
@ -0,0 +1,371 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Benchmarks • AMR (for R)</title>
|
||||
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
|
||||
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
|
||||
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
|
||||
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous">
|
||||
<link href="../docsearch.css" rel="stylesheet">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
|
||||
<script src="../extra.js"></script><meta property="og:title" content="Benchmarks">
|
||||
<meta property="og:description" content="">
|
||||
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="container template-article">
|
||||
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</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.5.0.9009</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="../index.html">
|
||||
<span class="fa fa-home"></span>
|
||||
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fa fa-question-circle"></span>
|
||||
|
||||
How to
|
||||
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="../articles/AMR.html">
|
||||
<span class="fa fa-directions"></span>
|
||||
|
||||
Conduct AMR analysis
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/Predict.html">
|
||||
<span class="fa fa-dice"></span>
|
||||
|
||||
Predict antimicrobial resistance
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/EUCAST.html">
|
||||
<span class="fa fa-exchange-alt"></span>
|
||||
|
||||
Apply EUCAST rules
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/mo_property.html">
|
||||
<span class="fa fa-bug"></span>
|
||||
|
||||
Get properties of a microorganism
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/ab_property.html">
|
||||
<span class="fa fa-capsules"></span>
|
||||
|
||||
Get properties of an antibiotic
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/freq.html">
|
||||
<span class="fa fa-sort-amount-down"></span>
|
||||
|
||||
Create frequency tables
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/G_test.html">
|
||||
<span class="fa fa-clipboard-check"></span>
|
||||
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../reference/">
|
||||
<span class="fa fa-book-open"></span>
|
||||
|
||||
Manual
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../authors.html">
|
||||
<span class="fa fa-users"></span>
|
||||
|
||||
Authors
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../news/">
|
||||
<span class="far fa far fa-newspaper"></span>
|
||||
|
||||
Changelog
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="https://gitlab.com/msberends/AMR">
|
||||
<span class="fab fa fab fa-gitlab"></span>
|
||||
|
||||
Source Code
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../LICENSE-text.html">
|
||||
<span class="fa fa-book"></span>
|
||||
|
||||
Licence
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="navbar-form navbar-right" role="search">
|
||||
<div class="form-group">
|
||||
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
</div>
|
||||
<!--/.container -->
|
||||
</div>
|
||||
<!--/.navbar -->
|
||||
|
||||
|
||||
</header><div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header toc-ignore">
|
||||
<h1>Benchmarks</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>benchmarks.Rmd</code></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>One of the most important features of this package is the complete microbial taxonomic database, supplied by ITIS (<a href="https://www.itis.gov" class="uri">https://www.itis.gov</a>). We created a function <code><a href="../reference/as.mo.html">as.mo()</a></code> that transforms any user input value to a valid microbial ID by using AI (Artificial Intelligence) and based on the taxonomic tree of ITIS.</p>
|
||||
<p>Using the <code>microbenchmark</code> package, we can review the calculation performance of this function.</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(microbenchmark)</a></code></pre></div>
|
||||
<p>In the next test, we try to ‘coerce’ different input values for <em>Staphylococcus aureus</em>. The actual result is the same every time: it returns its MO code <code>B_STPHY_AUR</code> (<em>B</em> stands for <em>Bacteria</em>, the taxonomic kingdom).</p>
|
||||
<p>But the calculation time differs a lot. Here, the AI effect can be reviewed best:</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><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/as.mo.html">as.mo</a></span>(<span class="st">"stau"</span>),</a>
|
||||
<a class="sourceLine" id="cb2-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"staaur"</span>),</a>
|
||||
<a class="sourceLine" id="cb2-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb2-4" data-line-number="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb2-5" data-line-number="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"STAAUR"</span>),</a>
|
||||
<a class="sourceLine" id="cb2-6" data-line-number="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb2-7" data-line-number="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"B_STPHY_AUR"</span>),</a>
|
||||
<a class="sourceLine" id="cb2-8" data-line-number="8"> <span class="dt">times =</span> <span class="dv">10</span>,</a>
|
||||
<a class="sourceLine" id="cb2-9" data-line-number="9"> <span class="dt">unit =</span> <span class="st">"ms"</span>)</a>
|
||||
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># A 34.745551 34.798630 35.2596102 34.8994810 35.258325 38.067062 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># B 7.095386 7.125348 7.2219948 7.1613865 7.240377 7.495857 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="co"># C 11.677114 11.733826 11.8304789 11.7715050 11.843756 12.317559 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" data-line-number="15"><span class="co"># D 11.694435 11.730054 11.9859313 11.8775585 12.206371 12.750016 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" data-line-number="16"><span class="co"># E 7.044402 7.117387 7.2271630 7.1923610 7.246104 7.742396 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="co"># F 6.642326 6.778446 6.8988042 6.8753165 6.923577 7.513945 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># G 0.106788 0.131023 0.1351229 0.1357725 0.144014 0.146458 10</span></a></code></pre></div>
|
||||
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds), tested on a quite regular Linux server from 2007 (Core 2 Duo 2.7 GHz, 2 GB DDR2 RAM). A value of 6.9 milliseconds means it will roughly determine 144 input values per second. It case of 39.2 milliseconds, this is only 26 input values per second. The more an input value resembles a full name (like C, D and F), the faster the result will be found. In case of G, the input is already a valid MO code, so it only almost takes no time at all (0.0001 seconds on our server).</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 far less faster. See this example for the ID of <em>Burkholderia nodosa</em> (<code>B_BRKHL_NOD</code>):</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><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/as.mo.html">as.mo</a></span>(<span class="st">"buno"</span>),</a>
|
||||
<a class="sourceLine" id="cb3-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"burnod"</span>),</a>
|
||||
<a class="sourceLine" id="cb3-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"B. nodosa"</span>),</a>
|
||||
<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"B. nodosa"</span>),</a>
|
||||
<a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"BURNOD"</span>),</a>
|
||||
<a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Burkholderia nodosa"</span>),</a>
|
||||
<a class="sourceLine" id="cb3-7" data-line-number="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"B_BRKHL_NOD"</span>),</a>
|
||||
<a class="sourceLine" id="cb3-8" data-line-number="8"> <span class="dt">times =</span> <span class="dv">10</span>,</a>
|
||||
<a class="sourceLine" id="cb3-9" data-line-number="9"> <span class="dt">unit =</span> <span class="st">"ms"</span>)</a>
|
||||
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># A 124.175427 124.474837 125.8610536 125.3750560 126.160945 131.485994 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># B 154.249713 155.364729 160.9077032 156.8738940 157.136183 197.315105 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># C 66.066571 66.162393 66.5538611 66.4488130 66.698077 67.623404 10</span></a>
|
||||
<a class="sourceLine" id="cb3-15" data-line-number="15"><span class="co"># D 86.747693 86.918665 90.7831016 87.8149725 89.440982 116.767991 10</span></a>
|
||||
<a class="sourceLine" id="cb3-16" data-line-number="16"><span class="co"># E 154.863827 155.208563 162.6535954 158.4062465 168.593785 187.378088 10</span></a>
|
||||
<a class="sourceLine" id="cb3-17" data-line-number="17"><span class="co"># F 32.427028 32.638648 32.9929454 32.7860475 32.992813 34.674241 10</span></a>
|
||||
<a class="sourceLine" id="cb3-18" data-line-number="18"><span class="co"># G 0.213155 0.216578 0.2369226 0.2338985 0.253734 0.285581 10</span></a></code></pre></div>
|
||||
<p>That takes up to 11 times as much time! A value of 158.4 milliseconds means it can only determine ~6 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.</p>
|
||||
<p>To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
||||
<div id="repetitive-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#repetitive-results" class="anchor"></a>Repetitive results</h3>
|
||||
<p>Repetitive results mean that unique values are present more than once. Unique values will only be calculated once by <code><a href="../reference/as.mo.html">as.mo()</a></code>. We will use <code><a href="../reference/mo_property.html">mo_fullname()</a></code> for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) and uses <code><a href="../reference/as.mo.html">as.mo()</a></code> internally.</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a>
|
||||
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="co"># take 500,000 random MO codes from the septic_patients data set</span></a>
|
||||
<a class="sourceLine" id="cb4-3" data-line-number="3">x =<span class="st"> </span>septic_patients <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/sample">sample_n</a></span>(<span class="dv">500000</span>, <span class="dt">replace =</span> <span class="ot">TRUE</span>) <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/pull">pull</a></span>(mo)</a>
|
||||
<a class="sourceLine" id="cb4-6" data-line-number="6"> </a>
|
||||
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="co"># got the right length?</span></a>
|
||||
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/length">length</a></span>(x)</a>
|
||||
<a class="sourceLine" id="cb4-9" data-line-number="9"><span class="co"># [1] 500000</span></a>
|
||||
<a class="sourceLine" id="cb4-10" data-line-number="10"></a>
|
||||
<a class="sourceLine" id="cb4-11" data-line-number="11"><span class="co"># and how many unique values do we have?</span></a>
|
||||
<a class="sourceLine" id="cb4-12" data-line-number="12"><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/n_distinct">n_distinct</a></span>(x)</a>
|
||||
<a class="sourceLine" id="cb4-13" data-line-number="13"><span class="co"># [1] 96</span></a>
|
||||
<a class="sourceLine" id="cb4-14" data-line-number="14"></a>
|
||||
<a class="sourceLine" id="cb4-15" data-line-number="15"><span class="co"># only 96, but distributed in 500,000 results. now let's see:</span></a>
|
||||
<a class="sourceLine" id="cb4-16" data-line-number="16"><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">X =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(x),</a>
|
||||
<a class="sourceLine" id="cb4-17" data-line-number="17"> <span class="dt">times =</span> <span class="dv">10</span>,</a>
|
||||
<a class="sourceLine" id="cb4-18" data-line-number="18"> <span class="dt">unit =</span> <span class="st">"ms"</span>)</a>
|
||||
<a class="sourceLine" id="cb4-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb4-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb4-21" data-line-number="21"><span class="co"># X 114.9342 117.1076 129.6448 120.2047 131.5005 168.6371 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!) of 96 unique values only takes 0.12 seconds (120 ms). You only lose time on your unique input values.</p>
|
||||
<p>Results of a tenfold - 5,000,000 values:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="co"># X 882.9045 901.3011 1001.677 940.3421 1168.088 1226.846 10</span></a></code></pre></div>
|
||||
<p>Even the full names of 5 <em>Million</em> values are calculated within a second.</p>
|
||||
</div>
|
||||
<div id="precalculated-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#precalculated-results" class="anchor"></a>Precalculated results</h3>
|
||||
<p>What about precalculated results? If the input is an already precalculated result of a helper function like <code><a href="../reference/mo_property.html">mo_fullname()</a></code>, it almost doesn’t take any time at all (see ‘C’ below):</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><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_fullname</a></span>(<span class="st">"B_STPHY_AUR"</span>),</a>
|
||||
<a class="sourceLine" id="cb6-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb6-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb6-4" data-line-number="4"> <span class="dt">times =</span> <span class="dv">10</span>,</a>
|
||||
<a class="sourceLine" id="cb6-5" data-line-number="5"> <span class="dt">unit =</span> <span class="st">"ms"</span>)</a>
|
||||
<a class="sourceLine" id="cb6-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb6-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" data-line-number="8"><span class="co"># A 11.364086 11.460537 11.5104799 11.4795330 11.524860 11.818263 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" data-line-number="9"><span class="co"># B 11.976454 12.012352 12.1704592 12.0853020 12.210004 12.881737 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" data-line-number="10"><span class="co"># C 0.095823 0.102528 0.1167754 0.1153785 0.132629 0.140661 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.0001 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" data-line-number="1"><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" data-line-number="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>
|
||||
<a class="sourceLine" id="cb7-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-4" data-line-number="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="st">"Staphylococcaceae"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-5" data-line-number="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="st">"Bacillales"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-6" data-line-number="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/mo_property.html">mo_class</a></span>(<span class="st">"Bacilli"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-7" data-line-number="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/mo_property.html">mo_phylum</a></span>(<span class="st">"Firmicutes"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-8" data-line-number="8"> <span class="dt">H =</span> <span class="kw"><a href="../reference/mo_property.html">mo_subkingdom</a></span>(<span class="st">"Posibacteria"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-9" data-line-number="9"> <span class="dt">I =</span> <span class="kw"><a href="../reference/mo_property.html">mo_kingdom</a></span>(<span class="st">"Bacteria"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-10" data-line-number="10"> <span class="dt">times =</span> <span class="dv">10</span>,</a>
|
||||
<a class="sourceLine" id="cb7-11" data-line-number="11"> <span class="dt">unit =</span> <span class="st">"ms"</span>)</a>
|
||||
<a class="sourceLine" id="cb7-12" data-line-number="12"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb7-13" data-line-number="13"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb7-14" data-line-number="14"><span class="co"># A 0.105181 0.121314 0.1478538 0.1465265 0.166711 0.211409 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" data-line-number="15"><span class="co"># B 0.132558 0.146388 0.1584278 0.1499835 0.164895 0.208477 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" data-line-number="16"><span class="co"># C 0.135492 0.160355 0.2341847 0.1884665 0.348857 0.395931 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" data-line-number="17"><span class="co"># D 0.109650 0.115727 0.1270481 0.1264130 0.128648 0.168317 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" data-line-number="18"><span class="co"># E 0.081574 0.096940 0.0992582 0.0980915 0.101479 0.120477 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" data-line-number="19"><span class="co"># F 0.081575 0.088489 0.0988463 0.0989650 0.103365 0.126482 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" data-line-number="20"><span class="co"># G 0.091981 0.095333 0.1043568 0.1001530 0.111327 0.129625 10</span></a>
|
||||
<a class="sourceLine" id="cb7-21" data-line-number="21"><span class="co"># H 0.092610 0.093169 0.1009135 0.0985455 0.101828 0.120406 10</span></a>
|
||||
<a class="sourceLine" id="cb7-22" data-line-number="22"><span class="co"># I 0.087371 0.091213 0.1069758 0.0941815 0.109302 0.192831 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 microorganisms (according to ITIS), it can just return the initial value immediately.</p>
|
||||
</div>
|
||||
<div id="results-in-other-languages" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#results-in-other-languages" class="anchor"></a>Results in other languages</h3>
|
||||
<p>When the system language is non-English and supported by this <code>AMR</code> package, some functions take a little while longer:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>) <span class="co"># or just mo_fullname("CoNS") on an English system</span></a>
|
||||
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="co"># "Coagulase Negative Staphylococcus (CoNS)"</span></a>
|
||||
<a class="sourceLine" id="cb8-3" data-line-number="3"></a>
|
||||
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>) <span class="co"># or just mo_fullname("CoNS") on a French system</span></a>
|
||||
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="co"># "Staphylococcus à coagulase négative (CoNS)"</span></a>
|
||||
<a class="sourceLine" id="cb8-6" data-line-number="6"></a>
|
||||
<a class="sourceLine" id="cb8-7" data-line-number="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">en =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-8" data-line-number="8"> <span class="dt">de =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"de"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-9" data-line-number="9"> <span class="dt">nl =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-10" data-line-number="10"> <span class="dt">es =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-11" data-line-number="11"> <span class="dt">it =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"it"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-12" data-line-number="12"> <span class="dt">fr =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-13" data-line-number="13"> <span class="dt">pt =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-14" data-line-number="14"> <span class="dt">times =</span> <span class="dv">10</span>,</a>
|
||||
<a class="sourceLine" id="cb8-15" data-line-number="15"> <span class="dt">unit =</span> <span class="st">"ms"</span>)</a>
|
||||
<a class="sourceLine" id="cb8-16" data-line-number="16"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb8-17" data-line-number="17"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-18" data-line-number="18"><span class="co"># en 6.093583 6.51724 6.555105 6.562986 6.630663 6.99698 100</span></a>
|
||||
<a class="sourceLine" id="cb8-19" data-line-number="19"><span class="co"># de 13.934874 14.35137 16.891587 14.462210 14.764658 43.63956 100</span></a>
|
||||
<a class="sourceLine" id="cb8-20" data-line-number="20"><span class="co"># nl 13.900092 14.34729 15.943268 14.424565 14.581535 43.76283 100</span></a>
|
||||
<a class="sourceLine" id="cb8-21" data-line-number="21"><span class="co"># es 13.833813 14.34596 14.574783 14.439757 14.653994 17.49168 100</span></a>
|
||||
<a class="sourceLine" id="cb8-22" data-line-number="22"><span class="co"># it 13.811883 14.36621 15.179060 14.453515 14.812359 43.64284 100</span></a>
|
||||
<a class="sourceLine" id="cb8-23" data-line-number="23"><span class="co"># fr 13.798683 14.37019 16.344731 14.468775 14.697610 48.62923 100</span></a>
|
||||
<a class="sourceLine" id="cb8-24" data-line-number="24"><span class="co"># pt 13.789674 14.36244 15.706321 14.443772 14.679905 44.76701 100</span></a></code></pre></div>
|
||||
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer><div class="copyright">
|
||||
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/">Alex W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a>.</p>
|
||||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
|
||||
docsearch({
|
||||
|
||||
|
||||
apiKey: 'f737050abfd4d726c63938e18f8c496e',
|
||||
indexName: 'amr',
|
||||
inputSelector: 'input#search-input.form-control',
|
||||
transformData: function(hits) {
|
||||
return hits.map(function (hit) {
|
||||
hit.url = updateHitURL(hit);
|
||||
return hit;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -111,6 +111,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -171,7 +178,7 @@
|
||||
<h1>How to create frequency tables</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">08 January 2019</h4>
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>freq.Rmd</code></div>
|
||||
|
@ -149,6 +149,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -220,6 +227,7 @@
|
||||
<li><a href="G_test.html">How to use the *G*-test</a></li>
|
||||
<li><a href="Predict.html">How to predict antimicrobial resistance</a></li>
|
||||
<li><a href="ab_property.html">How to get properties of an antibiotic</a></li>
|
||||
<li><a href="benchmarks.html">Benchmarks</a></li>
|
||||
<li><a href="freq.html">How to create frequency tables</a></li>
|
||||
<li><a href="mo_property.html">How to get properties of a microorganism</a></li>
|
||||
</ul>
|
||||
|
@ -111,6 +111,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -171,7 +178,7 @@
|
||||
<h1>How to get properties of a microorganism</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">08 January 2019</h4>
|
||||
<h4 class="date">11 January 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>mo_property.Rmd</code></div>
|
||||
|
@ -149,6 +149,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -50,6 +50,7 @@ a, a:hover, a:focus {
|
||||
}
|
||||
a[href], a[href]:hover, a[href]:focus,
|
||||
code a[href], code a[href]:hover, code a[href]:focus,
|
||||
a[href] code, a[href] code:hover, a[href] code:focus,
|
||||
pre a[href], pre a[href]:hover, pre a[href]:focus,
|
||||
a code[href], a code[href]:hover, a code[href]:focus,
|
||||
a pre[href], a pre[href]:hover, a pre[href]:focus {
|
||||
@ -139,3 +140,9 @@ thead {
|
||||
tbody {
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
table a:not(.btn), .table a:not(.btn) {
|
||||
text-decoration: inherit;
|
||||
}
|
||||
table a:not(.btn):hover, .table a:not(.btn):hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
@ -113,6 +113,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -228,7 +235,8 @@
|
||||
<a href="#short-introduction" class="anchor"></a>Short introduction</h3>
|
||||
<p><img src="reference/figures/itis_logo.jpg" height="60px"></p>
|
||||
<p>This package contains the <strong>complete microbial taxonomic data</strong> (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, <a href="https://www.itis.gov" class="uri">https://www.itis.gov</a>).</p>
|
||||
<p>All (sub)species from <strong>the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package</strong>, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria. ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists.</p>
|
||||
<p>All (sub)species from <strong>the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package</strong>, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.</p>
|
||||
<p>Read more about ITIS <a href="./reference/ITIS.html">in our manual</a>.</p>
|
||||
<p>The <code>AMR</code> package basically does four important things:</p>
|
||||
<ol>
|
||||
<li>
|
||||
|
@ -149,6 +149,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -229,7 +236,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li>Support for <a href="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</li>
|
||||
<li>Function <code>guess_ab</code> to find an antibiotic column in a table</li>
|
||||
<li>Function <code>guess_ab_col</code> to find an antibiotic column in a table</li>
|
||||
<li>Function <code><a href="../reference/mo_failures.html">mo_failures()</a></code> to review values that could not be coerced to a valid MO code, using <code><a href="../reference/as.mo.html">as.mo()</a></code>. This latter function will now only show a maximum of 25 uncoerced values.</li>
|
||||
<li>Function <code><a href="../reference/mo_renamed.html">mo_renamed()</a></code> to get a list of all returned values from <code><a href="../reference/as.mo.html">as.mo()</a></code> that have had taxonomic renaming</li>
|
||||
<li>Function <code><a href="../reference/age.html">age()</a></code> to calculate the (patients) age in years</li>
|
||||
|
@ -7,6 +7,7 @@ articles:
|
||||
G_test: G_test.html
|
||||
Predict: Predict.html
|
||||
ab_property: ab_property.html
|
||||
benchmarks: benchmarks.html
|
||||
freq: freq.html
|
||||
mo_property: mo_property.html
|
||||
urls:
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -289,11 +296,11 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='co'># resistance of ciprofloxacine per age group</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>age_group</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>age_group</span>,
|
||||
<span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='ggplot_rsi.html'>ggplot_rsi</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
|
||||
<span class='co'># }</span></pre>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -357,16 +364,16 @@ The <code><a href='mo_property.html'>mo_property</a></code> functions (like <cod
|
||||
<span class='co'># the select function of tidyverse is also supported:</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>as.mo</span>()
|
||||
|
||||
<span class='co'># and can even contain 2 columns, which is convenient for genus/species combinations:</span>
|
||||
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>as.mo</span>()
|
||||
<span class='co'># although this works easier and does the same:</span>
|
||||
<span class='no'>df</span> <span class='kw'><-</span> <span class='no'>df</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)))
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)))
|
||||
<span class='co'># }</span></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -270,11 +277,11 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='co'># using dplyr's mutate</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise_all.html'>mutate_at</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='no'>peni</span>:<span class='no'>rifa</span>), <span class='no'>as.rsi</span>)
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise_all'>mutate_at</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/vars'>vars</a></span>(<span class='no'>peni</span>:<span class='no'>rifa</span>), <span class='no'>as.rsi</span>)
|
||||
|
||||
<span class='co'># fastest way to transform all columns with already valid AB results to class `rsi`:</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise_all.html'>mutate_if</a></span>(<span class='no'>is.rsi.eligible</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise_all'>mutate_if</a></span>(<span class='no'>is.rsi.eligible</span>,
|
||||
<span class='no'>as.rsi</span>)
|
||||
<span class='co'># }</span></pre>
|
||||
</div>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -152,6 +152,13 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -275,7 +282,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>These functions are meant to count isolates. Use the <code><a href='portion.html'>portion</a>_*</code> functions to calculate microbial resistance.</p>
|
||||
<p><code>n_rsi</code> is an alias of <code>count_all</code>. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to <code><a href='https://dplyr.tidyverse.org/reference/n_distinct.html'>n_distinct</a></code>. Their function is equal to <code>count_S(...) + count_IR(...)</code>.</p>
|
||||
<p><code>n_rsi</code> is an alias of <code>count_all</code>. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to <code><a href='https://www.rdocumentation.org/packages/dplyr/topics/n_distinct'>n_distinct</a></code>. Their function is equal to <code>count_S(...) + count_IR(...)</code>.</p>
|
||||
<p><code>count_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code><a href='as.rsi.html'>as.rsi</a></code>) and counts the amounts of R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||
@ -314,13 +321,13 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>count_R</span>(<span class='no'>cipr</span>),
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>count_R</span>(<span class='no'>cipr</span>),
|
||||
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>count_I</span>(<span class='no'>cipr</span>),
|
||||
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>count_S</span>(<span class='no'>cipr</span>),
|
||||
<span class='kw'>n1</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>), <span class='co'># the actual total; sum of all three</span>
|
||||
<span class='kw'>n2</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>), <span class='co'># same - analogous to n_distinct</span>
|
||||
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/n.html'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
||||
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/n'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
||||
|
||||
<span class='co'># Count co-resistance between amoxicillin/clav acid and gentamicin,</span>
|
||||
<span class='co'># so we can see that combination therapy does a lot more than mono therapy.</span>
|
||||
@ -338,13 +345,13 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||
|
||||
<span class='co'># It also supports grouping variables</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||
|
||||
<span class='co'># }</span></pre>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -222,27 +229,38 @@
|
||||
|
||||
<pre class="usage"><span class='fu'>eucast_rules</span>(<span class='no'>tbl</span>, <span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>rules</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"breakpoints"</span>, <span class='st'>"expert"</span>, <span class='st'>"other"</span>, <span class='st'>"all"</span>), <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
||||
<span class='kw'>amcl</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>amik</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>amox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>ampi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>azit</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>azlo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>aztr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cefa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfep</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>cfot</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfra</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>cfta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cftr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfur</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>chlo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cipr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>clar</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>clin</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>clox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>coli</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>czol</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>dapt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>doxy</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>erta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>eryt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>fosf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>fusi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>gent</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>imip</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>kana</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>levo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>linc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>line</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>mero</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>mezl</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>mino</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>moxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>nali</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>neom</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>neti</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>nitr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>norf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>novo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>oflo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>oxac</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>peni</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>pipe</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>pita</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>poly</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>pris</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>qida</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>rifa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>roxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>siso</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>teic</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>tetr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>tica</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>tige</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>tobr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>trim</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>trsu</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>vanc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>())
|
||||
<span class='kw'>amcl</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>amik</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>amox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>ampi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>azit</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>azlo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>aztr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cefa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cfep</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cfot</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cfox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cfra</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cfta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cftr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cfur</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>chlo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cipr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>clar</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>clin</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>clox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>coli</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>czol</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>dapt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>doxy</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>erta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>eryt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>fosf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>fusi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>gent</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>imip</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>kana</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>levo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>linc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>line</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>mero</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>mezl</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>mino</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>moxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>nali</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>neom</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>neti</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>nitr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>norf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>novo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>oflo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>oxac</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>peni</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>pipe</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>pita</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>poly</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>pris</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>qida</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>rifa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>roxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>siso</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>teic</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>tetr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>tica</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>tige</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>tobr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>trim</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>trsu</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>vanc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>())
|
||||
|
||||
<span class='fu'>EUCAST_rules</span>(<span class='no'>...</span>)
|
||||
|
||||
@ -300,7 +318,7 @@
|
||||
<h2 class="hasAnchor" id="antibiotics"><a class="anchor" href="#antibiotics"></a>Antibiotics</h2>
|
||||
|
||||
|
||||
<p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab.html'>guess_ab</a></code> or input a text (case-insensitive) or use <code>NULL</code> to skip a column (e.g. <code>tica = NULL</code>). Non-existing columns will anyway be skipped with a warning.</p>
|
||||
<p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab_col.html'>guess_ab_col</a></code> or input a text (case-insensitive) or use <code>NULL</code> to skip a column (e.g. <code>tica = NULL</code>). Non-existing columns will anyway be skipped with a warning.</p>
|
||||
<p>Abbrevations of the column containing antibiotics in the form: <strong>abbreviation</strong>: generic name (<em>ATC code</em>)</p>
|
||||
<p><strong>amcl</strong>: amoxicillin+clavulanic acid (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CR02'>J01CR02</a>),
|
||||
<strong>amik</strong>: amikacin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01GB06'>J01GB06</a>),
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -361,11 +368,11 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='co'># Filter on first isolates:</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
|
||||
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
||||
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
|
||||
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>)
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>)
|
||||
|
||||
<span class='co'># Which can be shortened to:</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
@ -376,14 +383,14 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
<span class='co'># Now let's see if first isolates matter:</span>
|
||||
<span class='no'>A</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
||||
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
|
||||
|
||||
<span class='no'>B</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>filter_first_weighted_isolate</span>() <span class='kw'>%>%</span> <span class='co'># the 1st isolate filter</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
|
||||
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
|
||||
|
||||
<span class='co'># Have a look at A and B.</span>
|
||||
|
@ -152,6 +152,13 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -378,34 +385,34 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
<span class='co'># you could also use `select` or `pull` to get your variables</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>freq</span>()
|
||||
|
||||
|
||||
<span class='co'># multiple selected variables will be pasted together</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='no'>left_join_microorganisms</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>freq</span>(<span class='no'>genus</span>, <span class='no'>species</span>)
|
||||
|
||||
|
||||
<span class='co'># group a variable and analyse another</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>freq</span>(<span class='no'>gender</span>)
|
||||
|
||||
|
||||
<span class='co'># get top 10 bugs of hospital A as a vector</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>freq</span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>top_freq</span>(<span class='fl'>10</span>)
|
||||
|
||||
|
||||
<span class='co'># save frequency table to an object</span>
|
||||
<span class='no'>years</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'>freq</span>(<span class='no'>year</span>)
|
||||
|
||||
|
||||
@ -456,11 +463,11 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='co'># only get selected columns</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>freq</span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>item</span>, <span class='no'>percent</span>)
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>item</span>, <span class='no'>percent</span>)
|
||||
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'>freq</span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(-<span class='no'>count</span>, -<span class='no'>cum_count</span>)
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(-<span class='no'>count</span>, -<span class='no'>cum_count</span>)
|
||||
|
||||
|
||||
<span class='co'># check differences between frequency tables</span>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -327,7 +334,7 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>ggplot2</span>)
|
||||
|
||||
<span class='co'># get antimicrobial results for drugs against a UTI:</span>
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>)) +
|
||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>)) +
|
||||
<span class='fu'>geom_rsi</span>()
|
||||
|
||||
<span class='co'># prettify the plot using some additional functions:</span>
|
||||
@ -341,17 +348,17 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
<span class='co'># or better yet, simplify this using the wrapper function - a single command:</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>ggplot_rsi</span>()
|
||||
|
||||
<span class='co'># get only portions and no counts:</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>fun</span> <span class='kw'>=</span> <span class='no'>portion_df</span>)
|
||||
|
||||
<span class='co'># add other ggplot2 parameters as you like:</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>width</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
|
||||
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"black"</span>,
|
||||
<span class='kw'>size</span> <span class='kw'>=</span> <span class='fl'>1</span>,
|
||||
@ -360,25 +367,25 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
<span class='co'># resistance of ciprofloxacine per age group</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='co'># `age_group` is also a function of this package:</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'><a href='age_groups.html'>age_groups</a></span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>age_group</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'><a href='age_groups.html'>age_groups</a></span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>age_group</span>,
|
||||
<span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
|
||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||
<span class='co'># for colourblind mode, use divergent colours from the viridis package:</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>ggplot_rsi</span>() + <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_fill_viridis_d</a></span>()
|
||||
|
||||
|
||||
<span class='co'># it also supports groups (don't forget to use the group var on `x` or `facet`):</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>hospital_id</span>,
|
||||
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
|
||||
<span class='kw'>nrow</span> <span class='kw'>=</span> <span class='fl'>1</span>) +
|
||||
@ -388,22 +395,22 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='co'># genuine analysis: check 2 most prevalent microorganisms</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='co'># create new bacterial ID's, with all CoNS under the same group (Becker et al.)</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
||||
<span class='co'># filter on top three bacterial ID's</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'><a href='freq.html'>top_freq</a></span>(<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'><a href='freq.html'>top_freq</a></span>(<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%>%</span>
|
||||
<span class='co'># determine first isolates</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>,
|
||||
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
||||
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
|
||||
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='co'># filter on first isolates</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
||||
<span class='co'># get short MO names (like "E. coli")</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='mo_property.html'>mo_shortname</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='mo_property.html'>mo_shortname</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%>%</span>
|
||||
<span class='co'># select this short name and some antiseptic drugs</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>mo</span>, <span class='no'>cfur</span>, <span class='no'>gent</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>mo</span>, <span class='no'>cfur</span>, <span class='no'>gent</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='co'># group by MO</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>mo</span>) <span class='kw'>%>%</span>
|
||||
<span class='co'># plot the thing, putting MOs on the facet</span>
|
||||
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
|
||||
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>mo</span>,
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
316
docs/reference/guess_ab_col.html
Normal file
@ -0,0 +1,316 @@
|
||||
<!-- Generated by pkgdown: do not edit by hand -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Guess antibiotic column — guess_ab_col • AMR (for R)</title>
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png" />
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png" />
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png" />
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png" />
|
||||
<!-- jquery -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
|
||||
<!-- Bootstrap -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Font Awesome icons -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
|
||||
|
||||
<!-- clipboard.js -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- sticky kit -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- pkgdown -->
|
||||
<link href="../pkgdown.css" rel="stylesheet">
|
||||
<script src="../pkgdown.js"></script>
|
||||
|
||||
|
||||
<!-- docsearch -->
|
||||
<script src="../docsearch.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous" />
|
||||
<link href="../docsearch.css" rel="stylesheet">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script>
|
||||
|
||||
|
||||
<link href="../extra.css" rel="stylesheet">
|
||||
<script src="../extra.js"></script>
|
||||
<meta property="og:title" content="Guess antibiotic column — guess_ab_col" />
|
||||
|
||||
<meta property="og:description" content="This tries to find a column name in a data set based on information from the antibiotics data set. You can look for an antibiotic (trade) of abbreviation and it will search the data for any column containing a name or ATC code of that antibiotic." />
|
||||
|
||||
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<!-- mathjax -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container template-reference-topic">
|
||||
<header>
|
||||
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</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.5.0.9009</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="../index.html">
|
||||
<span class="fa fa-home"></span>
|
||||
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
<span class="fa fa-question-circle"></span>
|
||||
|
||||
How to
|
||||
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="../articles/AMR.html">
|
||||
<span class="fa fa-directions"></span>
|
||||
|
||||
Conduct AMR analysis
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/Predict.html">
|
||||
<span class="fa fa-dice"></span>
|
||||
|
||||
Predict antimicrobial resistance
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/EUCAST.html">
|
||||
<span class="fa fa-exchange-alt"></span>
|
||||
|
||||
Apply EUCAST rules
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/mo_property.html">
|
||||
<span class="fa fa-bug"></span>
|
||||
|
||||
Get properties of a microorganism
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/ab_property.html">
|
||||
<span class="fa fa-capsules"></span>
|
||||
|
||||
Get properties of an antibiotic
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/freq.html">
|
||||
<span class="fa fa-sort-amount-down"></span>
|
||||
|
||||
Create frequency tables
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/G_test.html">
|
||||
<span class="fa fa-clipboard-check"></span>
|
||||
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../reference/">
|
||||
<span class="fa fa-book-open"></span>
|
||||
|
||||
Manual
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../authors.html">
|
||||
<span class="fa fa-users"></span>
|
||||
|
||||
Authors
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../news/">
|
||||
<span class="far fa far fa-newspaper"></span>
|
||||
|
||||
Changelog
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="https://gitlab.com/msberends/AMR">
|
||||
<span class="fab fa fab fa-gitlab"></span>
|
||||
|
||||
Source Code
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../LICENSE-text.html">
|
||||
<span class="fa fa-book"></span>
|
||||
|
||||
Licence
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<form class="navbar-form navbar-right" role="search">
|
||||
<div class="form-group">
|
||||
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div><!--/.nav-collapse -->
|
||||
</div><!--/.container -->
|
||||
</div><!--/.navbar -->
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9 contents">
|
||||
<div class="page-header">
|
||||
<h1>Guess antibiotic column</h1>
|
||||
|
||||
<div class="hidden name"><code>guess_ab_col.Rd</code></div>
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
|
||||
<p>This tries to find a column name in a data set based on information from the <code><a href='antibiotics.html'>antibiotics</a></code> data set. You can look for an antibiotic (trade) of abbreviation and it will search the data for any column containing a name or ATC code of that antibiotic.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>guess_ab_col</span>(<span class='kw'>tbl</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>col</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</pre>
|
||||
|
||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||
<table class="ref-arguments">
|
||||
<colgroup><col class="name" /><col class="desc" /></colgroup>
|
||||
<tr>
|
||||
<th>tbl</th>
|
||||
<td><p>a <code>data.frame</code></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>col</th>
|
||||
<td><p>a character to look for</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>verbose</th>
|
||||
<td><p>a logical to indicate whether additional info should be printed</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||
|
||||
|
||||
<p><img src='figures/logo.png' height=40px style=margin-bottom:5px /> <br />
|
||||
On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitlab.io/AMR</a> you can find <a href='https://msberends.gitlab.io/AMR/articles/AMR.html'>a omprehensive tutorial</a> about how to conduct AMR analysis and find <a href='https://msberends.gitlab.io/AMR/reference'>the complete documentation of all functions</a>, which reads a lot easier than in R.</p>
|
||||
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># NOT RUN {</span>
|
||||
<span class='no'>df</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></span>(<span class='kw'>amox</span> <span class='kw'>=</span> <span class='st'>"S"</span>,
|
||||
<span class='kw'>tetr</span> <span class='kw'>=</span> <span class='st'>"R"</span>)
|
||||
|
||||
<span class='fu'>guess_ab_col</span>(<span class='no'>df</span>, <span class='st'>"amoxicillin"</span>)
|
||||
<span class='co'># [1] "amox"</span>
|
||||
<span class='fu'>guess_ab_col</span>(<span class='no'>df</span>, <span class='st'>"J01AA07"</span>) <span class='co'># ATC code of Tetracycline</span>
|
||||
<span class='co'># [1] "tetr"</span>
|
||||
|
||||
<span class='fu'>guess_ab_col</span>(<span class='no'>df</span>, <span class='st'>"J01AA07"</span>, <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
|
||||
<span class='co'># using column `tetr` for col "J01AA07"</span>
|
||||
<span class='co'># [1] "tetr"</span>
|
||||
<span class='co'># }</span></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li><a href="#arguments">Arguments</a></li>
|
||||
|
||||
<li><a href="#read-more-on-our-website-">Read more on our website!</a></li>
|
||||
|
||||
<li><a href="#examples">Examples</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="copyright">
|
||||
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>.</p>
|
||||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
docsearch({
|
||||
|
||||
|
||||
apiKey: 'f737050abfd4d726c63938e18f8c496e',
|
||||
indexName: 'amr',
|
||||
inputSelector: 'input#search-input.form-control',
|
||||
transformData: function(hits) {
|
||||
return hits.map(function (hit) {
|
||||
hit.url = updateHitURL(hit);
|
||||
return hit;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -149,6 +149,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -222,7 +229,7 @@
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2 id="section-background-information" class="hasAnchor"><a href="#section-background-information" class="anchor"></a>Background information</h2>
|
||||
<p class="section-desc"><p>Some pages about our package and its external sources.</p></p>
|
||||
<p class="section-desc"><p>Some pages about our package and its external sources. Be sure to read our <a href="./../articles/index.html">How To’s</a> for more information about how to work with functions in this package.</p></p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -278,7 +285,7 @@
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="guess_ab.html">guess_ab()</a></code> </p>
|
||||
<p><code><a href="guess_ab_col.html">guess_ab_col()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Guess antibiotic column</p></td>
|
||||
</tr><tr>
|
||||
@ -478,7 +485,7 @@
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2 id="section-other" class="hasAnchor"><a href="#section-other" class="anchor"></a>Other</h2>
|
||||
<p class="section-desc"></p>
|
||||
<p class="section-desc"><p>These functions are mostly for internal use, but some of them may also be suitable for your analysis. Especially the ‘like’ function can be useful: <code>if (x %like% y) {...}</code>.</p></p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -220,17 +227,20 @@
|
||||
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>key_antibiotics</span>(<span class='no'>tbl</span>, <span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>universal_1</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"amox"</span>), <span class='kw'>universal_2</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"amcl"</span>),
|
||||
<span class='kw'>universal_3</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"cfur"</span>), <span class='kw'>universal_4</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"pita"</span>), <span class='kw'>universal_5</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"cipr"</span>),
|
||||
<span class='kw'>universal_6</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"trsu"</span>), <span class='kw'>GramPos_1</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"vanc"</span>), <span class='kw'>GramPos_2</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"teic"</span>), <span class='kw'>GramPos_3</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"tetr"</span>), <span class='kw'>GramPos_4</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"eryt"</span>), <span class='kw'>GramPos_5</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"oxac"</span>), <span class='kw'>GramPos_6</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"rifa"</span>), <span class='kw'>GramNeg_1</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"gent"</span>), <span class='kw'>GramNeg_2</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"tobr"</span>), <span class='kw'>GramNeg_3</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"coli"</span>), <span class='kw'>GramNeg_4</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"cfot"</span>), <span class='kw'>GramNeg_5</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"cfta"</span>), <span class='kw'>GramNeg_6</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(<span class='no'>tbl</span>, <span class='st'>"mero"</span>), <span class='kw'>warnings</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='no'>...</span>)
|
||||
<pre class="usage"><span class='fu'>key_antibiotics</span>(<span class='no'>tbl</span>, <span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>universal_1</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"amox"</span>), <span class='kw'>universal_2</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"amcl"</span>),
|
||||
<span class='kw'>universal_3</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"cfur"</span>),
|
||||
<span class='kw'>universal_4</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"pita"</span>),
|
||||
<span class='kw'>universal_5</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"cipr"</span>),
|
||||
<span class='kw'>universal_6</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"trsu"</span>),
|
||||
<span class='kw'>GramPos_1</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"vanc"</span>), <span class='kw'>GramPos_2</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"teic"</span>), <span class='kw'>GramPos_3</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"tetr"</span>),
|
||||
<span class='kw'>GramPos_4</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"eryt"</span>), <span class='kw'>GramPos_5</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"oxac"</span>), <span class='kw'>GramPos_6</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"rifa"</span>),
|
||||
<span class='kw'>GramNeg_1</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"gent"</span>), <span class='kw'>GramNeg_2</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"tobr"</span>), <span class='kw'>GramNeg_3</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"coli"</span>),
|
||||
<span class='kw'>GramNeg_4</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"cfot"</span>), <span class='kw'>GramNeg_5</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>,
|
||||
<span class='st'>"cfta"</span>), <span class='kw'>GramNeg_6</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(<span class='no'>tbl</span>, <span class='st'>"mero"</span>), <span class='kw'>warnings</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='no'>...</span>)
|
||||
|
||||
<span class='fu'>key_antibiotics_equal</span>(<span class='no'>x</span>, <span class='no'>y</span>, <span class='kw'>type</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"keyantibiotics"</span>, <span class='st'>"points"</span>),
|
||||
<span class='kw'>ignore_I</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>points_threshold</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</pre>
|
||||
@ -248,15 +258,15 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>universal_1, universal_2, universal_3, universal_4, universal_5, universal_6</th>
|
||||
<td><p>column names of <strong>broad-spectrum</strong> antibiotics, case-insensitive</p></td>
|
||||
<td><p>column names of <strong>broad-spectrum</strong> antibiotics, case-insensitive. At default, the columns containing these antibiotics will be guessed with <code><a href='guess_ab_col.html'>guess_ab_col</a></code>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>GramPos_1, GramPos_2, GramPos_3, GramPos_4, GramPos_5, GramPos_6</th>
|
||||
<td><p>column names of antibiotics for <strong>Gram positives</strong>, case-insensitive</p></td>
|
||||
<td><p>column names of antibiotics for <strong>Gram positives</strong>, case-insensitive. At default, the columns containing these antibiotics will be guessed with <code><a href='guess_ab_col.html'>guess_ab_col</a></code>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>GramNeg_1, GramNeg_2, GramNeg_3, GramNeg_4, GramNeg_5, GramNeg_6</th>
|
||||
<td><p>column names of antibiotics for <strong>Gram negatives</strong>, case-insensitive</p></td>
|
||||
<td><p>column names of antibiotics for <strong>Gram negatives</strong>, case-insensitive. At default, the columns containing these antibiotics will be guessed with <code><a href='guess_ab_col.html'>guess_ab_col</a></code>.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>warnings</th>
|
||||
@ -290,7 +300,7 @@
|
||||
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>The function <code>key_antibiotics</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>). The <code><a href='first_isolate.html'>first_isolate</a></code> function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) found within the same episode (see <code>episode</code> parameter of <code><a href='first_isolate.html'>first_isolate</a></code>). Without key antibiotic comparison it wouldn't.</p>
|
||||
<p>The function <code>key_antibiotics</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>). The <code><a href='first_isolate.html'>first_isolate</a></code> function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) found within the same episode (see <code>episode</code> parameter of <code><a href='first_isolate.html'>first_isolate</a></code>). Without key antibiotic comparison it would not.</p>
|
||||
<p>At default, the antibiotics that are used for <strong>Gram positive bacteria</strong> are (colum names): <br />
|
||||
<code>"amox"</code>, <code>"amcl"</code>, <code>"cfur"</code>, <code>"pita"</code>, <code>"cipr"</code>, <code>"trsu"</code> (until here is universal), <code>"vanc"</code>, <code>"teic"</code>, <code>"tetr"</code>, <code>"eryt"</code>, <code>"oxac"</code>, <code>"rifa"</code>.</p>
|
||||
<p>At default, the antibiotics that are used for <strong>Gram negative bacteria</strong> are (colum names): <br />
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -288,7 +295,7 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='join.html'>left_join_microorganisms</a></span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>%like%</span> <span class='st'>'^ent'</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>%like%</span> <span class='st'>'^ent'</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)
|
||||
<span class='co'># }</span></pre>
|
||||
</div>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -221,26 +228,36 @@
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='fu'>mdro</span>(<span class='no'>tbl</span>, <span class='kw'>country</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>amcl</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>amik</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>amox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>ampi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>azit</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>aztr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>cefa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfra</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfep</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>cfot</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>cftr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>cfur</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>chlo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>cipr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>clar</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>clin</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>clox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>coli</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>czol</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>dapt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>doxy</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>erta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>eryt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>fosf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>fusi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>gent</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>imip</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>kana</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>levo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>linc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>line</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>mero</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>metr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>mino</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>moxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>nali</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>neom</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>neti</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>nitr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>novo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>norf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>oflo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>peni</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>pipe</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>pita</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>poly</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>qida</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>rifa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>roxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>siso</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>teic</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>tetr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>tica</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>tige</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>tobr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(),
|
||||
<span class='kw'>trim</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>trsu</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>(), <span class='kw'>vanc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab.html'>guess_ab</a></span>())
|
||||
<span class='kw'>amcl</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>amik</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>amox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>ampi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>azit</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>aztr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cefa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cfra</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cfep</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cfot</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cfox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cfta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>cftr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cfur</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>chlo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>cipr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>clar</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>clin</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>clox</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>coli</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>czol</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>dapt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>doxy</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>erta</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>eryt</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>fosf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>fusi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>gent</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>imip</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>kana</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>levo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>linc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>line</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>mero</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>metr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>mino</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>moxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>nali</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>neom</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>neti</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>nitr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>novo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>norf</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>oflo</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>peni</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>pipe</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>pita</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>poly</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>qida</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>rifa</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>roxi</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>siso</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>teic</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>tetr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>tica</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>tige</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>tobr</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>trim</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(),
|
||||
<span class='kw'>trsu</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>(), <span class='kw'>vanc</span> <span class='kw'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span>())
|
||||
|
||||
<span class='fu'>brmo</span>(<span class='no'>...</span>, <span class='kw'>country</span> <span class='kw'>=</span> <span class='st'>"nl"</span>)
|
||||
|
||||
@ -524,7 +541,7 @@
|
||||
<h2 class="hasAnchor" id="antibiotics"><a class="anchor" href="#antibiotics"></a>Antibiotics</h2>
|
||||
|
||||
|
||||
<p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab.html'>guess_ab</a></code> or input a text (case-insensitive) or use <code>NULL</code> to skip a column (e.g. <code>tica = NULL</code>). Non-existing columns will anyway be skipped with a warning.</p>
|
||||
<p>To define antibiotics column names, leave as it is to determine it automatically with <code><a href='guess_ab_col.html'>guess_ab_col</a></code> or input a text (case-insensitive) or use <code>NULL</code> to skip a column (e.g. <code>tica = NULL</code>). Non-existing columns will anyway be skipped with a warning.</p>
|
||||
<p>Abbrevations of the column containing antibiotics in the form: <strong>abbreviation</strong>: generic name (<em>ATC code</em>)</p>
|
||||
<p><strong>amcl</strong>: amoxicillin+clavulanic acid (<a href='https://www.whocc.no/atc_ddd_index/?code=J01CR02'>J01CR02</a>),
|
||||
<strong>amik</strong>: amikacin (<a href='https://www.whocc.no/atc_ddd_index/?code=J01GB06'>J01GB06</a>),
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -152,6 +152,13 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -333,17 +340,17 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span> <span class='fu'>portion_SI</span>(<span class='no'>amox</span>)
|
||||
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>),
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>),
|
||||
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>cipr</span>)) <span class='co'># n_rsi works like n_distinct in dplyr</span>
|
||||
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>portion_R</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>portion_R</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>portion_I</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>cipr</span>), <span class='co'># works like n_distinct in dplyr</span>
|
||||
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/n.html'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
||||
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/n'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
|
||||
|
||||
<span class='co'># Calculate co-resistance between amoxicillin/clav acid and gentamicin,</span>
|
||||
<span class='co'># so we can see that combination therapy does a lot more than mono therapy:</span>
|
||||
@ -358,8 +365,8 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>cipro_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>cipro_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||
<span class='kw'>cipro_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>cipr</span>),
|
||||
<span class='kw'>genta_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>gent</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
|
||||
<span class='kw'>genta_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>gent</span>),
|
||||
@ -368,22 +375,22 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
|
||||
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||
|
||||
<span class='co'># It also supports grouping variables</span>
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
|
||||
|
||||
|
||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||
<span class='co'># calculate current empiric combination therapy of Helicobacter gastritis:</span>
|
||||
<span class='no'>my_table</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Helicobacter"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>amox</span>, <span class='no'>metr</span>), <span class='co'># amoxicillin with metronidazole</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>amox</span>, <span class='no'>metr</span>), <span class='co'># amoxicillin with metronidazole</span>
|
||||
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>amox</span>, <span class='no'>metr</span>))
|
||||
<span class='co'># }</span></pre>
|
||||
</div>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -311,7 +318,7 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='co'># or use dplyr so you can actually read it:</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='no'>tbl</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
|
||||
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Haemophilus"</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'>resistance_predict</span>(<span class='no'>amcl</span>, <span class='no'>date</span>)
|
||||
<span class='co'># }</span><span class='co'># NOT RUN {</span>
|
||||
@ -322,9 +329,9 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='co'># get bacteria properties like genus and species</span>
|
||||
<span class='fu'><a href='join.html'>left_join_microorganisms</a></span>(<span class='st'>"mo"</span>) <span class='kw'>%>%</span>
|
||||
<span class='co'># calculate first isolates</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%>%</span>
|
||||
<span class='co'># filter on first E. coli isolates</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Escherichia"</span>,
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Escherichia"</span>,
|
||||
<span class='no'>species</span> <span class='kw'>==</span> <span class='st'>"coli"</span>,
|
||||
<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%>%</span>
|
||||
<span class='co'># predict resistance of cefotaxime for next years</span>
|
||||
@ -338,7 +345,7 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
||||
<span class='kw'>if</span> (!<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>require</a></span>(<span class='no'>ggplot2</span>)) {
|
||||
|
||||
<span class='no'>data</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'>resistance_predict</span>(<span class='kw'>col_ab</span> <span class='kw'>=</span> <span class='st'>"amox"</span>,
|
||||
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
||||
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -152,6 +152,13 @@ When negative: the left tail is longer; the mass of the distribution is concentr
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -151,6 +151,13 @@
|
||||
Use the G-test
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../articles/benchmarks.html">
|
||||
<span class="fa fa-shipping-fast"></span>
|
||||
|
||||
Other: benchmarks
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -64,7 +64,7 @@
|
||||
<loc>https://msberends.gitlab.io/AMR/reference/ggplot_rsi.html</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://msberends.gitlab.io/AMR/reference/guess_ab.html</loc>
|
||||
<loc>https://msberends.gitlab.io/AMR/reference/guess_ab_col.html</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://msberends.gitlab.io/AMR/reference/join.html</loc>
|
||||
@ -141,6 +141,9 @@
|
||||
<url>
|
||||
<loc>https://msberends.gitlab.io/AMR/articles/ab_property.html</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://msberends.gitlab.io/AMR/articles/benchmarks.html</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://msberends.gitlab.io/AMR/articles/freq.html</loc>
|
||||
</url>
|
||||
|
4
index.md
@ -64,7 +64,9 @@ To find out how to conduct AMR analysis, please [continue reading here to get st
|
||||
|
||||
This package contains the **complete microbial taxonomic data** (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, https://www.itis.gov).
|
||||
|
||||
All (sub)species from **the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package**, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria. ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists.
|
||||
All (sub)species from **the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package**, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
|
||||
|
||||
Read more about ITIS [in our manual](./reference/ITIS.html).
|
||||
|
||||
The `AMR` package basically does four important things:
|
||||
|
||||
|
@ -25,27 +25,38 @@
|
||||
\usage{
|
||||
eucast_rules(tbl, col_mo = NULL, info = TRUE,
|
||||
rules = c("breakpoints", "expert", "other", "all"), verbose = FALSE,
|
||||
amcl = guess_ab(), amik = guess_ab(), amox = guess_ab(),
|
||||
ampi = guess_ab(), azit = guess_ab(), azlo = guess_ab(),
|
||||
aztr = guess_ab(), cefa = guess_ab(), cfep = guess_ab(),
|
||||
cfot = guess_ab(), cfox = guess_ab(), cfra = guess_ab(),
|
||||
cfta = guess_ab(), cftr = guess_ab(), cfur = guess_ab(),
|
||||
chlo = guess_ab(), cipr = guess_ab(), clar = guess_ab(),
|
||||
clin = guess_ab(), clox = guess_ab(), coli = guess_ab(),
|
||||
czol = guess_ab(), dapt = guess_ab(), doxy = guess_ab(),
|
||||
erta = guess_ab(), eryt = guess_ab(), fosf = guess_ab(),
|
||||
fusi = guess_ab(), gent = guess_ab(), imip = guess_ab(),
|
||||
kana = guess_ab(), levo = guess_ab(), linc = guess_ab(),
|
||||
line = guess_ab(), mero = guess_ab(), mezl = guess_ab(),
|
||||
mino = guess_ab(), moxi = guess_ab(), nali = guess_ab(),
|
||||
neom = guess_ab(), neti = guess_ab(), nitr = guess_ab(),
|
||||
norf = guess_ab(), novo = guess_ab(), oflo = guess_ab(),
|
||||
oxac = guess_ab(), peni = guess_ab(), pipe = guess_ab(),
|
||||
pita = guess_ab(), poly = guess_ab(), pris = guess_ab(),
|
||||
qida = guess_ab(), rifa = guess_ab(), roxi = guess_ab(),
|
||||
siso = guess_ab(), teic = guess_ab(), tetr = guess_ab(),
|
||||
tica = guess_ab(), tige = guess_ab(), tobr = guess_ab(),
|
||||
trim = guess_ab(), trsu = guess_ab(), vanc = guess_ab())
|
||||
amcl = guess_ab_col(), amik = guess_ab_col(),
|
||||
amox = guess_ab_col(), ampi = guess_ab_col(),
|
||||
azit = guess_ab_col(), azlo = guess_ab_col(),
|
||||
aztr = guess_ab_col(), cefa = guess_ab_col(),
|
||||
cfep = guess_ab_col(), cfot = guess_ab_col(),
|
||||
cfox = guess_ab_col(), cfra = guess_ab_col(),
|
||||
cfta = guess_ab_col(), cftr = guess_ab_col(),
|
||||
cfur = guess_ab_col(), chlo = guess_ab_col(),
|
||||
cipr = guess_ab_col(), clar = guess_ab_col(),
|
||||
clin = guess_ab_col(), clox = guess_ab_col(),
|
||||
coli = guess_ab_col(), czol = guess_ab_col(),
|
||||
dapt = guess_ab_col(), doxy = guess_ab_col(),
|
||||
erta = guess_ab_col(), eryt = guess_ab_col(),
|
||||
fosf = guess_ab_col(), fusi = guess_ab_col(),
|
||||
gent = guess_ab_col(), imip = guess_ab_col(),
|
||||
kana = guess_ab_col(), levo = guess_ab_col(),
|
||||
linc = guess_ab_col(), line = guess_ab_col(),
|
||||
mero = guess_ab_col(), mezl = guess_ab_col(),
|
||||
mino = guess_ab_col(), moxi = guess_ab_col(),
|
||||
nali = guess_ab_col(), neom = guess_ab_col(),
|
||||
neti = guess_ab_col(), nitr = guess_ab_col(),
|
||||
norf = guess_ab_col(), novo = guess_ab_col(),
|
||||
oflo = guess_ab_col(), oxac = guess_ab_col(),
|
||||
peni = guess_ab_col(), pipe = guess_ab_col(),
|
||||
pita = guess_ab_col(), poly = guess_ab_col(),
|
||||
pris = guess_ab_col(), qida = guess_ab_col(),
|
||||
rifa = guess_ab_col(), roxi = guess_ab_col(),
|
||||
siso = guess_ab_col(), teic = guess_ab_col(),
|
||||
tetr = guess_ab_col(), tica = guess_ab_col(),
|
||||
tige = guess_ab_col(), tobr = guess_ab_col(),
|
||||
trim = guess_ab_col(), trsu = guess_ab_col(),
|
||||
vanc = guess_ab_col())
|
||||
|
||||
EUCAST_rules(...)
|
||||
|
||||
@ -74,7 +85,7 @@ Apply susceptibility rules as defined by the European Committee on Antimicrobial
|
||||
}
|
||||
\section{Antibiotics}{
|
||||
|
||||
To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab}} or input a text (case-insensitive) or use \code{NULL} to skip a column (e.g. \code{tica = NULL}). Non-existing columns will anyway be skipped with a warning.
|
||||
To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive) or use \code{NULL} to skip a column (e.g. \code{tica = NULL}). Non-existing columns will anyway be skipped with a warning.
|
||||
|
||||
Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code})
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/guess_ab.R
|
||||
\name{guess_ab}
|
||||
\alias{guess_ab}
|
||||
% Please edit documentation in R/guess_ab_col.R
|
||||
\name{guess_ab_col}
|
||||
\alias{guess_ab_col}
|
||||
\title{Guess antibiotic column}
|
||||
\usage{
|
||||
guess_ab(tbl = NULL, col = NULL, verbose = FALSE)
|
||||
guess_ab_col(tbl = NULL, col = NULL, verbose = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{a \code{data.frame}}
|
||||
@ -14,7 +14,7 @@ guess_ab(tbl = NULL, col = NULL, verbose = FALSE)
|
||||
\item{verbose}{a logical to indicate whether additional info should be printed}
|
||||
}
|
||||
\description{
|
||||
This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set.
|
||||
This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. You can look for an antibiotic (trade) of abbreviation and it will search the data for any column containing a name or ATC code of that antibiotic.
|
||||
}
|
||||
\section{Read more on our website!}{
|
||||
|
||||
@ -22,3 +22,16 @@ This tries to find a column name in a data set based on information from the \co
|
||||
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a omprehensive tutorial} about how to conduct AMR analysis and find \href{https://msberends.gitlab.io/AMR/reference}{the complete documentation of all functions}, which reads a lot easier than in R.
|
||||
}
|
||||
|
||||
\examples{
|
||||
df <- data.frame(amox = "S",
|
||||
tetr = "R")
|
||||
|
||||
guess_ab_col(df, "amoxicillin")
|
||||
# [1] "amox"
|
||||
guess_ab_col(df, "J01AA07") # ATC code of Tetracycline
|
||||
# [1] "tetr"
|
||||
|
||||
guess_ab_col(df, "J01AA07", verbose = TRUE)
|
||||
# using column `tetr` for col "J01AA07"
|
||||
# [1] "tetr"
|
||||
}
|
@ -5,17 +5,20 @@
|
||||
\alias{key_antibiotics_equal}
|
||||
\title{Key antibiotics for first \emph{weighted} isolates}
|
||||
\usage{
|
||||
key_antibiotics(tbl, col_mo = NULL, universal_1 = guess_ab(tbl,
|
||||
"amox"), universal_2 = guess_ab(tbl, "amcl"),
|
||||
universal_3 = guess_ab(tbl, "cfur"), universal_4 = guess_ab(tbl,
|
||||
"pita"), universal_5 = guess_ab(tbl, "cipr"),
|
||||
universal_6 = guess_ab(tbl, "trsu"), GramPos_1 = guess_ab(tbl,
|
||||
"vanc"), GramPos_2 = guess_ab(tbl, "teic"), GramPos_3 = guess_ab(tbl,
|
||||
"tetr"), GramPos_4 = guess_ab(tbl, "eryt"), GramPos_5 = guess_ab(tbl,
|
||||
"oxac"), GramPos_6 = guess_ab(tbl, "rifa"), GramNeg_1 = guess_ab(tbl,
|
||||
"gent"), GramNeg_2 = guess_ab(tbl, "tobr"), GramNeg_3 = guess_ab(tbl,
|
||||
"coli"), GramNeg_4 = guess_ab(tbl, "cfot"), GramNeg_5 = guess_ab(tbl,
|
||||
"cfta"), GramNeg_6 = guess_ab(tbl, "mero"), warnings = TRUE, ...)
|
||||
key_antibiotics(tbl, col_mo = NULL, universal_1 = guess_ab_col(tbl,
|
||||
"amox"), universal_2 = guess_ab_col(tbl, "amcl"),
|
||||
universal_3 = guess_ab_col(tbl, "cfur"),
|
||||
universal_4 = guess_ab_col(tbl, "pita"),
|
||||
universal_5 = guess_ab_col(tbl, "cipr"),
|
||||
universal_6 = guess_ab_col(tbl, "trsu"),
|
||||
GramPos_1 = guess_ab_col(tbl, "vanc"), GramPos_2 = guess_ab_col(tbl,
|
||||
"teic"), GramPos_3 = guess_ab_col(tbl, "tetr"),
|
||||
GramPos_4 = guess_ab_col(tbl, "eryt"), GramPos_5 = guess_ab_col(tbl,
|
||||
"oxac"), GramPos_6 = guess_ab_col(tbl, "rifa"),
|
||||
GramNeg_1 = guess_ab_col(tbl, "gent"), GramNeg_2 = guess_ab_col(tbl,
|
||||
"tobr"), GramNeg_3 = guess_ab_col(tbl, "coli"),
|
||||
GramNeg_4 = guess_ab_col(tbl, "cfot"), GramNeg_5 = guess_ab_col(tbl,
|
||||
"cfta"), GramNeg_6 = guess_ab_col(tbl, "mero"), warnings = TRUE, ...)
|
||||
|
||||
key_antibiotics_equal(x, y, type = c("keyantibiotics", "points"),
|
||||
ignore_I = TRUE, points_threshold = 2, info = FALSE)
|
||||
@ -25,11 +28,11 @@ key_antibiotics_equal(x, y, type = c("keyantibiotics", "points"),
|
||||
|
||||
\item{col_mo}{column name of the unique IDs of the microorganisms (see \code{\link{mo}}), defaults to the first column of class \code{mo}. Values will be coerced using \code{\link{as.mo}}.}
|
||||
|
||||
\item{universal_1, universal_2, universal_3, universal_4, universal_5, universal_6}{column names of \strong{broad-spectrum} antibiotics, case-insensitive}
|
||||
\item{universal_1, universal_2, universal_3, universal_4, universal_5, universal_6}{column names of \strong{broad-spectrum} antibiotics, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}.}
|
||||
|
||||
\item{GramPos_1, GramPos_2, GramPos_3, GramPos_4, GramPos_5, GramPos_6}{column names of antibiotics for \strong{Gram positives}, case-insensitive}
|
||||
\item{GramPos_1, GramPos_2, GramPos_3, GramPos_4, GramPos_5, GramPos_6}{column names of antibiotics for \strong{Gram positives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}.}
|
||||
|
||||
\item{GramNeg_1, GramNeg_2, GramNeg_3, GramNeg_4, GramNeg_5, GramNeg_6}{column names of antibiotics for \strong{Gram negatives}, case-insensitive}
|
||||
\item{GramNeg_1, GramNeg_2, GramNeg_3, GramNeg_4, GramNeg_5, GramNeg_6}{column names of antibiotics for \strong{Gram negatives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}.}
|
||||
|
||||
\item{warnings}{give warning about missing antibiotic columns, they will anyway be ignored}
|
||||
|
||||
@ -49,7 +52,7 @@ key_antibiotics_equal(x, y, type = c("keyantibiotics", "points"),
|
||||
These function can be used to determine first isolates (see \code{\link{first_isolate}}). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates will then be called first \emph{weighted} isolates.
|
||||
}
|
||||
\details{
|
||||
The function \code{key_antibiotics} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{key_antibiotics_equal}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}). The \code{\link{first_isolate}} function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible \emph{S. aureus} (MSSA) found within the same episode (see \code{episode} parameter of \code{\link{first_isolate}}). Without key antibiotic comparison it wouldn't.
|
||||
The function \code{key_antibiotics} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{key_antibiotics_equal}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}). The \code{\link{first_isolate}} function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible \emph{S. aureus} (MSSA) found within the same episode (see \code{episode} parameter of \code{\link{first_isolate}}). Without key antibiotic comparison it would not.
|
||||
|
||||
At default, the antibiotics that are used for \strong{Gram positive bacteria} are (colum names): \cr
|
||||
\code{"amox"}, \code{"amcl"}, \code{"cfur"}, \code{"pita"}, \code{"cipr"}, \code{"trsu"} (until here is universal), \code{"vanc"}, \code{"teic"}, \code{"tetr"}, \code{"eryt"}, \code{"oxac"}, \code{"rifa"}.
|
||||
|
52
man/mdro.Rd
@ -8,26 +8,36 @@
|
||||
\title{Determine multidrug-resistant organisms (MDRO)}
|
||||
\usage{
|
||||
mdro(tbl, country = NULL, col_mo = NULL, info = TRUE,
|
||||
amcl = guess_ab(), amik = guess_ab(), amox = guess_ab(),
|
||||
ampi = guess_ab(), azit = guess_ab(), aztr = guess_ab(),
|
||||
cefa = guess_ab(), cfra = guess_ab(), cfep = guess_ab(),
|
||||
cfot = guess_ab(), cfox = guess_ab(), cfta = guess_ab(),
|
||||
cftr = guess_ab(), cfur = guess_ab(), chlo = guess_ab(),
|
||||
cipr = guess_ab(), clar = guess_ab(), clin = guess_ab(),
|
||||
clox = guess_ab(), coli = guess_ab(), czol = guess_ab(),
|
||||
dapt = guess_ab(), doxy = guess_ab(), erta = guess_ab(),
|
||||
eryt = guess_ab(), fosf = guess_ab(), fusi = guess_ab(),
|
||||
gent = guess_ab(), imip = guess_ab(), kana = guess_ab(),
|
||||
levo = guess_ab(), linc = guess_ab(), line = guess_ab(),
|
||||
mero = guess_ab(), metr = guess_ab(), mino = guess_ab(),
|
||||
moxi = guess_ab(), nali = guess_ab(), neom = guess_ab(),
|
||||
neti = guess_ab(), nitr = guess_ab(), novo = guess_ab(),
|
||||
norf = guess_ab(), oflo = guess_ab(), peni = guess_ab(),
|
||||
pipe = guess_ab(), pita = guess_ab(), poly = guess_ab(),
|
||||
qida = guess_ab(), rifa = guess_ab(), roxi = guess_ab(),
|
||||
siso = guess_ab(), teic = guess_ab(), tetr = guess_ab(),
|
||||
tica = guess_ab(), tige = guess_ab(), tobr = guess_ab(),
|
||||
trim = guess_ab(), trsu = guess_ab(), vanc = guess_ab())
|
||||
amcl = guess_ab_col(), amik = guess_ab_col(),
|
||||
amox = guess_ab_col(), ampi = guess_ab_col(),
|
||||
azit = guess_ab_col(), aztr = guess_ab_col(),
|
||||
cefa = guess_ab_col(), cfra = guess_ab_col(),
|
||||
cfep = guess_ab_col(), cfot = guess_ab_col(),
|
||||
cfox = guess_ab_col(), cfta = guess_ab_col(),
|
||||
cftr = guess_ab_col(), cfur = guess_ab_col(),
|
||||
chlo = guess_ab_col(), cipr = guess_ab_col(),
|
||||
clar = guess_ab_col(), clin = guess_ab_col(),
|
||||
clox = guess_ab_col(), coli = guess_ab_col(),
|
||||
czol = guess_ab_col(), dapt = guess_ab_col(),
|
||||
doxy = guess_ab_col(), erta = guess_ab_col(),
|
||||
eryt = guess_ab_col(), fosf = guess_ab_col(),
|
||||
fusi = guess_ab_col(), gent = guess_ab_col(),
|
||||
imip = guess_ab_col(), kana = guess_ab_col(),
|
||||
levo = guess_ab_col(), linc = guess_ab_col(),
|
||||
line = guess_ab_col(), mero = guess_ab_col(),
|
||||
metr = guess_ab_col(), mino = guess_ab_col(),
|
||||
moxi = guess_ab_col(), nali = guess_ab_col(),
|
||||
neom = guess_ab_col(), neti = guess_ab_col(),
|
||||
nitr = guess_ab_col(), novo = guess_ab_col(),
|
||||
norf = guess_ab_col(), oflo = guess_ab_col(),
|
||||
peni = guess_ab_col(), pipe = guess_ab_col(),
|
||||
pita = guess_ab_col(), poly = guess_ab_col(),
|
||||
qida = guess_ab_col(), rifa = guess_ab_col(),
|
||||
roxi = guess_ab_col(), siso = guess_ab_col(),
|
||||
teic = guess_ab_col(), tetr = guess_ab_col(),
|
||||
tica = guess_ab_col(), tige = guess_ab_col(),
|
||||
tobr = guess_ab_col(), trim = guess_ab_col(),
|
||||
trsu = guess_ab_col(), vanc = guess_ab_col())
|
||||
|
||||
brmo(..., country = "nl")
|
||||
|
||||
@ -177,7 +187,7 @@ When \code{country} will be left blank, guidelines will be taken from EUCAST Exp
|
||||
}
|
||||
\section{Antibiotics}{
|
||||
|
||||
To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab}} or input a text (case-insensitive) or use \code{NULL} to skip a column (e.g. \code{tica = NULL}). Non-existing columns will anyway be skipped with a warning.
|
||||
To define antibiotics column names, leave as it is to determine it automatically with \code{\link{guess_ab_col}} or input a text (case-insensitive) or use \code{NULL} to skip a column (e.g. \code{tica = NULL}). Non-existing columns will anyway be skipped with a warning.
|
||||
|
||||
Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code})
|
||||
|
||||
|
@ -50,6 +50,7 @@ a, a:hover, a:focus {
|
||||
}
|
||||
a[href], a[href]:hover, a[href]:focus,
|
||||
code a[href], code a[href]:hover, code a[href]:focus,
|
||||
a[href] code, a[href] code:hover, a[href] code:focus,
|
||||
pre a[href], pre a[href]:hover, pre a[href]:focus,
|
||||
a code[href], a code[href]:hover, a code[href]:focus,
|
||||
a pre[href], a pre[href]:hover, a pre[href]:focus {
|
||||
@ -139,3 +140,9 @@ thead {
|
||||
tbody {
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
table a:not(.btn), .table a:not(.btn) {
|
||||
text-decoration: inherit;
|
||||
}
|
||||
table a:not(.btn):hover, .table a:not(.btn):hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
36
tests/testthat/test-guess_ab_col.R
Normal file
@ -0,0 +1,36 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://gitlab.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||
# the Free Software Foundation. #
|
||||
# #
|
||||
# This R package was created for academic research and was publicly #
|
||||
# released in the hope that it will be useful, but it comes WITHOUT #
|
||||
# ANY WARRANTY OR LIABILITY. #
|
||||
# Visit our website for more info: https://msberends.gitab.io/AMR. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("guess_ab_col.R")
|
||||
|
||||
test_that("guess_ab_col works", {
|
||||
|
||||
expect_equal(guess_ab_col(septic_patients, "amox"),
|
||||
"amox")
|
||||
expect_equal(guess_ab_col(septic_patients, "amoxicillin"),
|
||||
"amox")
|
||||
expect_equal(guess_ab_col(septic_patients, "J01AA07"),
|
||||
"tetr")
|
||||
expect_equal(guess_ab_col(septic_patients, "tetracycline"),
|
||||
"tetr")
|
||||
expect_equal(guess_ab_col(septic_patients, "TETR"),
|
||||
"tetr")
|
||||
})
|
@ -21,8 +21,6 @@ knitr::opts_chunk$set(
|
||||
fig.width = 7.5,
|
||||
fig.height = 4.5
|
||||
)
|
||||
# set to original language (English)
|
||||
Sys.setlocale(locale = "C")
|
||||
```
|
||||
|
||||
**Note:** values on this page will change with every website update since they are based on randomly created values and the page was written in [RMarkdown](https://rmarkdown.rstudio.com/). However, the methodology remains unchanged. This page was generated on `r format(Sys.Date(), "%d %B %Y")`.
|
||||
|
@ -21,8 +21,6 @@ knitr::opts_chunk$set(
|
||||
fig.width = 7.5,
|
||||
fig.height = 4.5
|
||||
)
|
||||
# set to original language (English)
|
||||
Sys.setlocale(locale = "C")
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
@ -18,8 +18,6 @@ knitr::opts_chunk$set(
|
||||
collapse = TRUE,
|
||||
comment = "#"
|
||||
)
|
||||
# set to original language (English)
|
||||
Sys.setlocale(locale = "C")
|
||||
```
|
||||
|
||||
*(will be available soon - in the meanwhile, please read about [this *G*-test in the manual](./../reference/g.test.html))*
|
||||
|
@ -18,8 +18,6 @@ knitr::opts_chunk$set(
|
||||
collapse = TRUE,
|
||||
comment = "#"
|
||||
)
|
||||
# set to original language (English)
|
||||
Sys.setlocale(locale = "C")
|
||||
```
|
||||
|
||||
*(will be available soon)*
|
||||
|
205
vignettes/benchmarks.Rmd
Executable file
@ -0,0 +1,205 @@
|
||||
---
|
||||
title: "Benchmarks"
|
||||
author: "Matthijs S. Berends"
|
||||
date: '`r format(Sys.Date(), "%d %B %Y")`'
|
||||
output:
|
||||
rmarkdown::html_vignette:
|
||||
toc: true
|
||||
toc_depth: 3
|
||||
vignette: >
|
||||
%\VignetteIndexEntry{Benchmarks}
|
||||
%\VignetteEncoding{UTF-8}
|
||||
%\VignetteEngine{knitr::rmarkdown}
|
||||
editor_options:
|
||||
chunk_output_type: console
|
||||
---
|
||||
|
||||
```{r setup, include = FALSE, results = 'markup'}
|
||||
knitr::opts_chunk$set(
|
||||
collapse = TRUE,
|
||||
comment = "#",
|
||||
fig.width = 7.5,
|
||||
fig.height = 4.5
|
||||
)
|
||||
```
|
||||
|
||||
One of the most important features of this package is the complete microbial taxonomic database, supplied by ITIS (https://www.itis.gov). We created a function `as.mo()` that transforms any user input value to a valid microbial ID by using AI (Artificial Intelligence) and based on the taxonomic tree of ITIS.
|
||||
|
||||
Using the `microbenchmark` package, we can review the calculation performance of this function.
|
||||
|
||||
```r
|
||||
library(microbenchmark)
|
||||
```
|
||||
|
||||
In the next test, we try to 'coerce' different input values for *Staphylococcus aureus*. The actual result is the same every time: it returns its MO code `B_STPHY_AUR` (*B* stands for *Bacteria*, the taxonomic kingdom).
|
||||
|
||||
But the calculation time differs a lot. Here, the AI effect can be reviewed best:
|
||||
|
||||
```r
|
||||
microbenchmark(A = as.mo("stau"),
|
||||
B = as.mo("staaur"),
|
||||
C = as.mo("S. aureus"),
|
||||
D = as.mo("S. aureus"),
|
||||
E = as.mo("STAAUR"),
|
||||
F = as.mo("Staphylococcus aureus"),
|
||||
G = as.mo("B_STPHY_AUR"),
|
||||
times = 10,
|
||||
unit = "ms")
|
||||
# Unit: milliseconds
|
||||
# expr min lq mean median uq max neval
|
||||
# A 34.745551 34.798630 35.2596102 34.8994810 35.258325 38.067062 10
|
||||
# B 7.095386 7.125348 7.2219948 7.1613865 7.240377 7.495857 10
|
||||
# C 11.677114 11.733826 11.8304789 11.7715050 11.843756 12.317559 10
|
||||
# D 11.694435 11.730054 11.9859313 11.8775585 12.206371 12.750016 10
|
||||
# E 7.044402 7.117387 7.2271630 7.1923610 7.246104 7.742396 10
|
||||
# F 6.642326 6.778446 6.8988042 6.8753165 6.923577 7.513945 10
|
||||
# G 0.106788 0.131023 0.1351229 0.1357725 0.144014 0.146458 10
|
||||
```
|
||||
|
||||
In the table above, all measurements are shown in milliseconds (thousands of seconds), tested on a quite regular Linux server from 2007 (Core 2 Duo 2.7 GHz, 2 GB DDR2 RAM). A value of 6.9 milliseconds means it will roughly determine 144 input values per second. It case of 39.2 milliseconds, this is only 26 input values per second. The more an input value resembles a full name (like C, D and F), the faster the result will be found. In case of G, the input is already a valid MO code, so it only almost takes no time at all (0.0001 seconds on our server).
|
||||
|
||||
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 far less faster. See this example for the ID of *Burkholderia nodosa* (`B_BRKHL_NOD`):
|
||||
|
||||
```r
|
||||
microbenchmark(A = as.mo("buno"),
|
||||
B = as.mo("burnod"),
|
||||
C = as.mo("B. nodosa"),
|
||||
D = as.mo("B. nodosa"),
|
||||
E = as.mo("BURNOD"),
|
||||
F = as.mo("Burkholderia nodosa"),
|
||||
G = as.mo("B_BRKHL_NOD"),
|
||||
times = 10,
|
||||
unit = "ms")
|
||||
# Unit: milliseconds
|
||||
# expr min lq mean median uq max neval
|
||||
# A 124.175427 124.474837 125.8610536 125.3750560 126.160945 131.485994 10
|
||||
# B 154.249713 155.364729 160.9077032 156.8738940 157.136183 197.315105 10
|
||||
# C 66.066571 66.162393 66.5538611 66.4488130 66.698077 67.623404 10
|
||||
# D 86.747693 86.918665 90.7831016 87.8149725 89.440982 116.767991 10
|
||||
# E 154.863827 155.208563 162.6535954 158.4062465 168.593785 187.378088 10
|
||||
# F 32.427028 32.638648 32.9929454 32.7860475 32.992813 34.674241 10
|
||||
# G 0.213155 0.216578 0.2369226 0.2338985 0.253734 0.285581 10
|
||||
```
|
||||
|
||||
That takes up to 11 times as much time! A value of 158.4 milliseconds means it can only determine ~6 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.
|
||||
|
||||
To relieve this pitfall and further improve performance, two important calculations take almost no time at all: **repetitive results** and **already precalculated results**.
|
||||
|
||||
### Repetitive results
|
||||
|
||||
Repetitive results mean that unique values are present more than once. Unique values will only be calculated once by `as.mo()`. We will use `mo_fullname()` for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) and uses `as.mo()` internally.
|
||||
|
||||
```r
|
||||
library(dplyr)
|
||||
# take 500,000 random MO codes from the septic_patients data set
|
||||
x = septic_patients %>%
|
||||
sample_n(500000, replace = TRUE) %>%
|
||||
pull(mo)
|
||||
|
||||
# got the right length?
|
||||
length(x)
|
||||
# [1] 500000
|
||||
|
||||
# and how many unique values do we have?
|
||||
n_distinct(x)
|
||||
# [1] 96
|
||||
|
||||
# only 96, but distributed in 500,000 results. now let's see:
|
||||
microbenchmark(X = mo_fullname(x),
|
||||
times = 10,
|
||||
unit = "ms")
|
||||
# Unit: milliseconds
|
||||
# expr min lq mean median uq max neval
|
||||
# X 114.9342 117.1076 129.6448 120.2047 131.5005 168.6371 10
|
||||
```
|
||||
|
||||
So transforming 500,000 values (!) of 96 unique values only takes 0.12 seconds (120 ms). You only lose time on your unique input values.
|
||||
|
||||
Results of a tenfold - 5,000,000 values:
|
||||
|
||||
```r
|
||||
# Unit: milliseconds
|
||||
# expr min lq mean median uq max neval
|
||||
# X 882.9045 901.3011 1001.677 940.3421 1168.088 1226.846 10
|
||||
```
|
||||
|
||||
Even the full names of 5 *Million* values are calculated within a second.
|
||||
|
||||
### Precalculated results
|
||||
|
||||
What about precalculated results? If the input is an already precalculated result of a helper function like `mo_fullname()`, it almost doesn't take any time at all (see 'C' below):
|
||||
|
||||
```r
|
||||
microbenchmark(A = mo_fullname("B_STPHY_AUR"),
|
||||
B = mo_fullname("S. aureus"),
|
||||
C = mo_fullname("Staphylococcus aureus"),
|
||||
times = 10,
|
||||
unit = "ms")
|
||||
# Unit: milliseconds
|
||||
# expr min lq mean median uq max neval
|
||||
# A 11.364086 11.460537 11.5104799 11.4795330 11.524860 11.818263 10
|
||||
# B 11.976454 12.012352 12.1704592 12.0853020 12.210004 12.881737 10
|
||||
# C 0.095823 0.102528 0.1167754 0.1153785 0.132629 0.140661 10
|
||||
```
|
||||
|
||||
So going from `mo_fullname("Staphylococcus aureus")` to `"Staphylococcus aureus"` takes 0.0001 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:
|
||||
|
||||
```r
|
||||
microbenchmark(A = mo_species("aureus"),
|
||||
B = mo_genus("Staphylococcus"),
|
||||
C = mo_fullname("Staphylococcus aureus"),
|
||||
D = mo_family("Staphylococcaceae"),
|
||||
E = mo_order("Bacillales"),
|
||||
F = mo_class("Bacilli"),
|
||||
G = mo_phylum("Firmicutes"),
|
||||
H = mo_subkingdom("Posibacteria"),
|
||||
I = mo_kingdom("Bacteria"),
|
||||
times = 10,
|
||||
unit = "ms")
|
||||
# Unit: milliseconds
|
||||
# expr min lq mean median uq max neval
|
||||
# A 0.105181 0.121314 0.1478538 0.1465265 0.166711 0.211409 10
|
||||
# B 0.132558 0.146388 0.1584278 0.1499835 0.164895 0.208477 10
|
||||
# C 0.135492 0.160355 0.2341847 0.1884665 0.348857 0.395931 10
|
||||
# D 0.109650 0.115727 0.1270481 0.1264130 0.128648 0.168317 10
|
||||
# E 0.081574 0.096940 0.0992582 0.0980915 0.101479 0.120477 10
|
||||
# F 0.081575 0.088489 0.0988463 0.0989650 0.103365 0.126482 10
|
||||
# G 0.091981 0.095333 0.1043568 0.1001530 0.111327 0.129625 10
|
||||
# H 0.092610 0.093169 0.1009135 0.0985455 0.101828 0.120406 10
|
||||
# I 0.087371 0.091213 0.1069758 0.0941815 0.109302 0.192831 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 microorganisms (according to ITIS), it can just return the initial value immediately.
|
||||
|
||||
### Results in other languages
|
||||
|
||||
When the system language is non-English and supported by this `AMR` package, some functions take a little while longer:
|
||||
|
||||
```r
|
||||
mo_fullname("CoNS", language = "en") # or just mo_fullname("CoNS") on an English system
|
||||
# "Coagulase Negative Staphylococcus (CoNS)"
|
||||
|
||||
mo_fullname("CoNS", language = "fr") # or just mo_fullname("CoNS") on a French system
|
||||
# "Staphylococcus à coagulase négative (CoNS)"
|
||||
|
||||
microbenchmark(en = mo_fullname("CoNS", language = "en"),
|
||||
de = mo_fullname("CoNS", language = "de"),
|
||||
nl = mo_fullname("CoNS", language = "nl"),
|
||||
es = mo_fullname("CoNS", language = "es"),
|
||||
it = mo_fullname("CoNS", language = "it"),
|
||||
fr = mo_fullname("CoNS", language = "fr"),
|
||||
pt = mo_fullname("CoNS", language = "pt"),
|
||||
times = 10,
|
||||
unit = "ms")
|
||||
# Unit: milliseconds
|
||||
# expr min lq mean median uq max neval
|
||||
# en 6.093583 6.51724 6.555105 6.562986 6.630663 6.99698 100
|
||||
# de 13.934874 14.35137 16.891587 14.462210 14.764658 43.63956 100
|
||||
# nl 13.900092 14.34729 15.943268 14.424565 14.581535 43.76283 100
|
||||
# es 13.833813 14.34596 14.574783 14.439757 14.653994 17.49168 100
|
||||
# it 13.811883 14.36621 15.179060 14.453515 14.812359 43.64284 100
|
||||
# fr 13.798683 14.37019 16.344731 14.468775 14.697610 48.62923 100
|
||||
# pt 13.789674 14.36244 15.706321 14.443772 14.679905 44.76701 100
|
||||
```
|
||||
|
||||
Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.
|
@ -22,8 +22,6 @@ knitr::opts_chunk$set(
|
||||
fig.width = 7.5,
|
||||
fig.height = 4.5
|
||||
)
|
||||
# set to original language (English)
|
||||
Sys.setlocale(locale = "C")
|
||||
library(dplyr)
|
||||
library(AMR)
|
||||
```
|
||||
|
@ -18,8 +18,6 @@ knitr::opts_chunk$set(
|
||||
collapse = TRUE,
|
||||
comment = "#"
|
||||
)
|
||||
# set to original language (English)
|
||||
Sys.setlocale(locale = "C")
|
||||
```
|
||||
|
||||
*(will be available soon)*
|
||||
|