Browse Source

replaced bactid by mo

new-mo-algorithm
parent
commit
5965d3c794
  1. 4
      DESCRIPTION
  2. 10
      NAMESPACE
  3. 9
      NEWS.md
  4. 24
      R/data.R
  5. 65
      R/deprecated.R
  6. 46
      R/eucast.R
  7. 30
      R/first_isolate.R
  8. 4
      R/freq.R
  9. 8
      R/ggplot_rsi.R
  10. 26
      R/join_microorganisms.R
  11. 19
      R/key_antibiotics.R
  12. 22
      R/mdro.R
  13. 134
      R/mo.R
  14. 14
      R/mo_property.R
  15. 6
      R/resistance_predict.R
  16. 34
      README.md
  17. BIN
      data/microorganisms.rda
  18. BIN
      data/microorganisms.umcg.rda
  19. BIN
      data/septic_patients.rda
  20. 22
      man/AMR-deprecated.Rd
  21. 33
      man/EUCAST.Rd
  22. 196
      man/MDRO.Rd
  23. 72
      man/as.mo.Rd
  24. 16
      man/first_isolate.Rd
  25. 4
      man/freq.Rd
  26. 8
      man/ggplot_rsi.Rd
  27. 14
      man/join.Rd
  28. 13
      man/key_antibiotics.Rd
  29. 4
      man/microorganisms.Rd
  30. 8
      man/microorganisms.umcg.Rd
  31. 6
      man/mo_property.Rd
  32. 6
      man/resistance_predict.Rd
  33. 8
      man/septic_patients.Rd
  34. 118
      tests/testthat/test-bactid.R
  35. 24
      tests/testthat/test-deprecated.R
  36. 16
      tests/testthat/test-eucast.R
  37. 26
      tests/testthat/test-first_isolate.R
  38. 8
      tests/testthat/test-freq.R
  39. 6
      tests/testthat/test-join_microorganisms.R
  40. 118
      tests/testthat/test-mo.R
  41. 16
      tests/testthat/test-portion.R

4
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 0.3.0.9005
Date: 2018-08-29
Version: 0.3.0.9006
Date: 2018-08-31
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

10
NAMESPACE

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
S3method(as.data.frame,atc)
S3method(as.data.frame,bactid)
S3method(as.data.frame,frequency_tbl)
S3method(as.data.frame,mo)
S3method(as.double,mic)
S3method(as.integer,mic)
S3method(as.numeric,mic)
@ -22,9 +23,11 @@ S3method(print,atc) @@ -22,9 +23,11 @@ S3method(print,atc)
S3method(print,bactid)
S3method(print,frequency_tbl)
S3method(print,mic)
S3method(print,mo)
S3method(print,rsi)
S3method(pull,atc)
S3method(pull,bactid)
S3method(pull,mo)
S3method(skewness,data.frame)
S3method(skewness,default)
S3method(skewness,matrix)
@ -49,6 +52,7 @@ export(anti_join_microorganisms) @@ -49,6 +52,7 @@ export(anti_join_microorganisms)
export(as.atc)
export(as.bactid)
export(as.mic)
export(as.mo)
export(as.rsi)
export(atc_ddd)
export(atc_groups)
@ -71,11 +75,13 @@ export(geom_rsi) @@ -71,11 +75,13 @@ export(geom_rsi)
export(ggplot_rsi)
export(guess_atc)
export(guess_bactid)
export(guess_mo)
export(inner_join_microorganisms)
export(interpretive_reading)
export(is.atc)
export(is.bactid)
export(is.mic)
export(is.mo)
export(is.rsi)
export(is.rsi.eligible)
export(key_antibiotics)
@ -102,6 +108,7 @@ export(portion_R) @@ -102,6 +108,7 @@ export(portion_R)
export(portion_S)
export(portion_SI)
export(portion_df)
export(ratio)
export(resistance_predict)
export(right_join_microorganisms)
export(rsi)
@ -115,6 +122,7 @@ export(top_freq) @@ -115,6 +122,7 @@ export(top_freq)
exportMethods(as.data.frame.atc)
exportMethods(as.data.frame.bactid)
exportMethods(as.data.frame.frequency_tbl)
exportMethods(as.data.frame.mo)
exportMethods(as.double.mic)
exportMethods(as.integer.mic)
exportMethods(as.numeric.mic)
@ -135,9 +143,11 @@ exportMethods(print.atc) @@ -135,9 +143,11 @@ exportMethods(print.atc)
exportMethods(print.bactid)
exportMethods(print.frequency_tbl)
exportMethods(print.mic)
exportMethods(print.mo)
exportMethods(print.rsi)
exportMethods(pull.atc)
exportMethods(pull.bactid)
exportMethods(pull.mo)
exportMethods(skewness)
exportMethods(skewness.data.frame)
exportMethods(skewness.default)

9
NEWS.md

@ -4,6 +4,11 @@ @@ -4,6 +4,11 @@
* Functions `count_R`, `count_IR`, `count_I`, `count_SI` and `count_S` to selectively count resistant or susceptible isolates
* Extra function `count_df` (which works like `portion_df`) to get all counts of S, I and R of a data set with antibiotic columns, with support for grouped variables
* Function `is.rsi.eligible` to check for columns that have valid antimicrobial results, but do not have the `rsi` class yet. Transform the columns of your raw data with: `data %>% mutate_if(is.rsi.eligible, as.rsi)`
* Functions `as.mo` and `is.mo` as replacements for `as.bactid` and `is.bactid`. These last two functions are deprecated and will be removed in a future release.
* Renamed all previous references to `bactid` to `mo`, like:
* Column names inputs of `EUCAST_rules`, `first_isolate` and `key_antibiotics`
* Column names of datasets `microorganisms` and `septic_patients`
* All old syntaxes will still work with this version, but will throw warnings
* Functions `as.atc` and `is.atc` to transform/look up antibiotic ATC codes as defined by the WHO. The existing function `guess_atc` is now an alias of `as.atc`.
* Aliases for existing function `mo_property`: `mo_aerobic`, `mo_family`, `mo_fullname`, `mo_genus`, `mo_gramstain`, `mo_gramstain_nl`, `mo_property`, `mo_species`, `mo_subspecies`, `mo_type`, `mo_type_nl`
* Function `ab_property` and its aliases: `ab_certe`, `ab_official`, `ab_official_nl`, `ab_property`, `ab_trivial_nl`, `ab_umcg`, `ab_tradenames`
@ -21,9 +26,9 @@ @@ -21,9 +26,9 @@
ab_atc(c("Bactroban", "Amoxil", "Zithromax", "Floxapen"))
# [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"
```
* Removed function `ratio` as it is not really the scope of this package
* Function `ratio` is now deprecated and will be removed in a future release, as it is not really the scope of this package
* Fix for `as.mic` for values ending in zeroes after a real number
* Huge speed improvement for `as.bactid`
* Huge speed improvement for `as.bactid` (now `as.mo`)
* Added parameters `minimum` and `as_percent` to `portion_df`
* Support for quasiquotation in the functions series `count_*` and `portions_*`, and `n_rsi`. This allows to check for more than 2 vectors or columns.
```r

24
R/data.R

@ -125,7 +125,7 @@ @@ -125,7 +125,7 @@
#' A dataset containing 2,646 microorganisms. MO codes of the UMCG can be looked up using \code{\link{microorganisms.umcg}}.
#' @format A data.frame with 2,646 observations and 12 variables:
#' \describe{
#' \item{\code{bactid}}{ID of microorganism}
#' \item{\code{mo}}{ID of microorganism}
#' \item{\code{bactsys}}{Bactsyscode of microorganism}
#' \item{\code{family}}{Family name of microorganism}
#' \item{\code{genus}}{Genus name of microorganism, like \code{"Echerichia"}}
@ -140,27 +140,27 @@ @@ -140,27 +140,27 @@
#' }
# source MOLIS (LIS of Certe) - \url{https://www.certe.nl}
# new <- microorganisms %>% filter(genus == "Bacteroides") %>% .[1,]
# new[1, 'bactid'] <- "DIAPNU"
# new[1, 'mo'] <- "DIAPNU"
# new[1, 'bactsys'] <- "DIAPNU"
# new[1, 'family'] <- "Veillonellaceae"
# new[1, 'genus'] <- "Dialister"
# new[1, 'species'] <- "pneumosintes"
# new[1, 'subspecies'] <- NA
# new[1, 'fullname'] <- paste(new[1, 'genus'], new[1, 'species'])
# microorganisms <- microorganisms %>% bind_rows(new) %>% arrange(bactid)
#' @seealso \code{\link{guess_bactid}} \code{\link{antibiotics}} \code{\link{microorganisms.umcg}}
# microorganisms <- microorganisms %>% bind_rows(new) %>% arrange(mo)
#' @seealso \code{\link{guess_mo}} \code{\link{antibiotics}} \code{\link{microorganisms.umcg}}
"microorganisms"
#' Translation table for UMCG with ~1100 microorganisms
#'
#' A dataset containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$bactid} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{bactid}'s with \code{\link{guess_bactid}}.
#' A dataset containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$mo} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{mo}'s with \code{\link{guess_mo}}.
#' @format A data.frame with 1090 observations and 2 variables:
#' \describe{
#' \item{\code{mocode}}{Code of microorganism according to UMCG MMB}
#' \item{\code{bactid}}{Code of microorganism in \code{\link{microorganisms}}}
#' \item{\code{umcg}}{Code of microorganism according to UMCG MMB}
#' \item{\code{mo}}{Code of microorganism in \code{\link{microorganisms}}}
#' }
# source MOLIS (LIS of Certe) - \url{https://www.certe.nl} \cr \cr GLIMS (LIS of UMCG) - \url{https://www.umcg.nl}
#' @seealso \code{\link{guess_bactid}} \code{\link{microorganisms}}
#' @seealso \code{\link{guess_mo}} \code{\link{microorganisms}}
"microorganisms.umcg"
#' Dataset with 2000 blood culture isolates of septic patients
@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
#' \item{\code{age}}{age of the patient}
#' \item{\code{sex}}{sex of the patient}
#' \item{\code{patient_id}}{ID of the patient, first 10 characters of an SHA hash containing irretrievable information}
#' \item{\code{bactid}}{ID of microorganism, see \code{\link{microorganisms}}}
#' \item{\code{mo}}{ID of microorganism, see \code{\link{microorganisms}}}
#' \item{\code{peni:rifa}}{40 different antibiotics with class \code{rsi} (see \code{\link{as.rsi}}); these column names occur in \code{\link{antibiotics}} data set and can be translated with \code{\link{abname}}}
#' }
# source MOLIS (LIS of Certe) - \url{https://www.certe.nl}
@ -193,7 +193,7 @@ @@ -193,7 +193,7 @@
#'
#' # Add first isolates to our dataset:
#' my_data <- my_data %>%
#' mutate(first_isolates = first_isolate(my_data, "date", "patient_id", "bactid"))
#' mutate(first_isolates = first_isolate(my_data, "date", "patient_id", "mo"))
#'
#' # -------- #
#' # ANALYSIS #
@ -203,7 +203,7 @@ @@ -203,7 +203,7 @@
#' # and numbers (n) of E. coli, divided by hospital:
#'
#' my_data %>%
#' filter(bactid == guess_bactid("E. coli"),
#' filter(mo == guess_mo("E. coli"),
#' first_isolates == TRUE) %>%
#' group_by(hospital_id) %>%
#' summarise(n = n_rsi(amox),
@ -214,7 +214,7 @@ @@ -214,7 +214,7 @@
#' # percentages of E. coli, trend over the years:
#'
#' my_data %>%
#' filter(bactid == guess_bactid("E. coli"),
#' filter(mo == guess_mo("E. coli"),
#' first_isolates == TRUE) %>%
#' group_by(year = format(date, "%Y")) %>%
#' summarise(n = n_rsi(amcl),

65
R/deprecated.R

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# LICENCE #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# ==================================================================== #
#' Deprecated functions
#'
#' These functions are \link{Deprecated}. They will be removed in a future release. Using the functions will give a warning with the name of the function it has been replaced by.
#' @export
#' @keywords internal
#' @name AMR-deprecated
#' @rdname AMR-deprecated
as.bactid <- function(...) {
.Deprecated("as.mo", package = "AMR")
as.mo(...)
}
#' @rdname AMR-deprecated
#' @export
is.bactid <- function(...) {
.Deprecated(new = "is.mo", package = "AMR")
is.mo(...)
}
#' @rdname AMR-deprecated
#' @export
guess_bactid <- function(...) {
.Deprecated(new = "guess_mo", package = "AMR")
guess_mo(...)
}
#' @rdname AMR-deprecated
#' @export
ratio <- function(x, ratio) {
.Deprecated(package = "AMR")
if (!all(is.numeric(x))) {
stop('`x` must be a vector of numeric values.')
}
if (length(ratio) == 1) {
if (ratio %like% '^([0-9]+([.][0-9]+)?[-,:])+[0-9]+([.][0-9]+)?$') {
# support for "1:2:1", "1-2-1", "1,2,1" and even "1.75:2:1.5"
ratio <- ratio %>% base::strsplit("[-,:]") %>% base::unlist() %>% base::as.double()
} else {
stop('Invalid `ratio`: ', ratio, '.')
}
}
if (length(x) != length(ratio)) {
stop('`x` and `ratio` must be of same size.')
}
base::sum(x, na.rm = TRUE) * (ratio / base::sum(ratio, na.rm = TRUE))
}

46
R/eucast.R

@ -20,11 +20,12 @@ @@ -20,11 +20,12 @@
#'
#' Apply expert rules (like intrinsic resistance), as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}.
#' @param tbl table with antibiotic columns, like e.g. \code{amox} and \code{amcl}
#' @param col_bactid column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$bactid}, see \code{\link{microorganisms}}
#' @param col_mo column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$mo}, see \code{\link{microorganisms}}
#' @param info print progress
#' @param amcl,amik,amox,ampi,azit,azlo,aztr,cefa,cfep,cfot,cfox,cfra,cfta,cftr,cfur,chlo,cipr,clar,clin,clox,coli,czol,dapt,doxy,erta,eryt,fosf,fusi,gent,imip,kana,levo,linc,line,mero,mezl,mino,moxi,nali,neom,neti,nitr,norf,novo,oflo,peni,pita,poly,pris,qida,rifa,roxi,siso,teic,tetr,tica,tige,tobr,trim,trsu,vanc column names of antibiotics. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.
#' @param amcl,amik,amox,ampi,azit,azlo,aztr,cefa,cfep,cfot,cfox,cfra,cfta,cftr,cfur,chlo,cipr,clar,clin,clox,coli,czol,dapt,doxy,erta,eryt,fosf,fusi,gent,imip,kana,levo,linc,line,mero,mezl,mino,moxi,nali,neom,neti,nitr,norf,novo,oflo,peni,pita,poly,pris,qida,rifa,roxi,siso,teic,tetr,tica,tige,tobr,trim,trsu,vanc column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.
#' @param col_bactid Deprecated. Use \code{col_mo} instead.
#' @param ... parameters that are passed on to \code{EUCAST_rules}
#' @section Abbrevations of antibiotics:
#' @section Antibiotics:
#' Abbrevations of the column containing antibiotics:
#'
#' \strong{amcl}: amoxicillin and beta-lactamase inhibitor (\emph{J01CR02}),
@ -102,23 +103,23 @@ @@ -102,23 +103,23 @@
#' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}
#' @examples
#' a <- EUCAST_rules(septic_patients)
#' a <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
#' "ENCFAE", # Enterococcus faecalis
#' "ESCCOL", # Escherichia coli
#' "KLEPNE", # Klebsiella pneumoniae
#' "PSEAER"), # Pseudomonas aeruginosa
#' vanc = "-", # Vancomycin
#' amox = "-", # Amoxicillin
#' coli = "-", # Colistin
#' cfta = "-", # Ceftazidime
#' cfur = "-", # Cefuroxime
#' a <- data.frame(mo = c("STAAUR", # Staphylococcus aureus
#' "ENCFAE", # Enterococcus faecalis
#' "ESCCOL", # Escherichia coli
#' "KLEPNE", # Klebsiella pneumoniae
#' "PSEAER"), # Pseudomonas aeruginosa
#' vanc = "-", # Vancomycin
#' amox = "-", # Amoxicillin
#' coli = "-", # Colistin
#' cfta = "-", # Ceftazidime
#' cfur = "-", # Cefuroxime
#' stringsAsFactors = FALSE)
#' a
#'
#' b <- EUCAST_rules(a)
#' b
EUCAST_rules <- function(tbl,
col_bactid = 'bactid',
col_mo = 'mo',
info = TRUE,
amcl = 'amcl',
amik = 'amik',
@ -180,12 +181,17 @@ EUCAST_rules <- function(tbl, @@ -180,12 +181,17 @@ EUCAST_rules <- function(tbl,
tobr = 'tobr',
trim = 'trim',
trsu = 'trsu',
vanc = 'vanc') {
vanc = 'vanc',
col_bactid = 'bactid') {
EUCAST_VERSION <- "3.1"
if (!col_bactid %in% colnames(tbl)) {
stop('Column ', col_bactid, ' not found.', call. = FALSE)
if (col_bactid %in% colnames(tbl)) {
col_mo <- col_bactid
warning("Use of `col_bactid` is deprecated. Use `col_mo` instead.")
}
if (!col_mo %in% colnames(tbl)) {
stop('Column ', col_mo, ' not found.', call. = FALSE)
}
# check columns
@ -274,10 +280,10 @@ EUCAST_rules <- function(tbl, @@ -274,10 +280,10 @@ EUCAST_rules <- function(tbl,
}
# join to microorganisms data set
if (!tbl %>% pull(col_bactid) %>% is.bactid()) {
warning("Improve integrity of the `", col_bactid, "` column by transforming it with 'as.bactid'.")
if (!tbl %>% pull(col_mo) %>% is.mo()) {
warning("Improve integrity of the `", col_mo, "` column by transforming it with 'as.mo'.")
}
tbl <- tbl %>% left_join_microorganisms(by = col_bactid, suffix = c("_tempmicroorganisms", ""))
tbl <- tbl %>% left_join_microorganisms(by = col_mo, suffix = c("_tempmicroorganisms", ""))
# antibiotic classes
aminoglycosides <- c(tobr, gent, kana, neom, neti, siso)

30
R/first_isolate.R

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
#' @param tbl a \code{data.frame} containing isolates.
#' @param col_date column name of the result date (or date that is was received on the lab)
#' @param col_patient_id column name of the unique IDs of the patients
#' @param col_bactid column name of the unique IDs of the microorganisms: \code{bactid}'s. If this column has another class than \code{"bactid"}, values will be coerced using \code{\link{as.bactid}}.
#' @param col_mo column name of the unique IDs of the microorganisms, see \code{\link{mo}}. If this column has another class than \code{"mo"}, values will be coerced using \code{\link{as.mo}}.
#' @param col_testcode column name of the test codes. Use \code{col_testcode = NA} to \strong{not} exclude certain test codes (like test codes for screening). In that case \code{testcodes_exclude} will be ignored. Supports tidyverse-like quotation.
#' @param col_specimen column name of the specimen type or group
#' @param col_icu column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU)
@ -36,8 +36,9 @@ @@ -36,8 +36,9 @@
#' @param ignore_I logical to determine whether antibiotic interpretations with \code{"I"} will be ignored when \code{type = "keyantibiotics"}, see Details
#' @param points_threshold points until the comparison of key antibiotics will lead to inclusion of an isolate when \code{type = "points"}, see Details
#' @param info print progress
#' @param col_genus (deprecated, use \code{col_bactid} instead) column name of the genus of the microorganisms
#' @param col_species (deprecated, use \code{col_bactid} instead) column name of the species of the microorganisms
#' @param col_bactid (deprecated, use \code{col_mo} instead)
#' @param col_genus (deprecated, use \code{col_mo} instead) column name of the genus of the microorganisms
#' @param col_species (deprecated, use \code{col_mo} instead) column name of the species of the microorganisms
#' @details \strong{WHY THIS IS SO IMPORTANT} \cr
#' To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode \href{https://www.ncbi.nlm.nih.gov/pubmed/17304462}{[1]}. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all \emph{S. aureus} isolates would be overestimated, because you included this MRSA more than once. It would be \href{https://en.wikipedia.org/wiki/Selection_bias}{selection bias}.
#' @section Key antibiotics:
@ -63,7 +64,7 @@ @@ -63,7 +64,7 @@
#' mutate(first_isolate = first_isolate(.,
#' col_date = "date",
#' col_patient_id = "patient_id",
#' col_bactid = "bactid"))
#' col_mo = "mo"))
#'
#' # Now let's see if first isolates matter:
#' A <- my_patients %>%
@ -126,7 +127,7 @@ @@ -126,7 +127,7 @@
first_isolate <- function(tbl,
col_date,
col_patient_id,
col_bactid = NA,
col_mo = NA,
col_testcode = NA,
col_specimen = NA,
col_icu = NA,
@ -140,12 +141,17 @@ first_isolate <- function(tbl, @@ -140,12 +141,17 @@ first_isolate <- function(tbl,
ignore_I = TRUE,
points_threshold = 2,
info = TRUE,
col_bactid = NA,
col_genus = NA,
col_species = NA) {
if (!is.na(col_bactid)) {
col_mo <- col_bactid
warning("Use of `col_bactid` is deprecated. Use `col_mo` instead.")
}
# bactid OR genus+species must be available
if (is.na(col_bactid) & (is.na(col_genus) | is.na(col_species))) {
stop('`col_bactid` or both `col_genus` and `col_species` must be available.')
if (is.na(col_mo) & (is.na(col_genus) | is.na(col_species))) {
stop('`col_mo` or both `col_genus` and `col_species` must be available.')
}
# check if columns exist
@ -163,19 +169,19 @@ first_isolate <- function(tbl, @@ -163,19 +169,19 @@ first_isolate <- function(tbl,
check_columns_existance(col_date)
check_columns_existance(col_patient_id)
check_columns_existance(col_bactid)
check_columns_existance(col_mo)
check_columns_existance(col_genus)
check_columns_existance(col_species)
check_columns_existance(col_testcode)
check_columns_existance(col_icu)
check_columns_existance(col_keyantibiotics)
if (!is.na(col_bactid)) {
if (!tbl %>% pull(col_bactid) %>% is.bactid()) {
warning("Improve integrity of the `", col_bactid, "` column by transforming it with 'as.bactid'.")
if (!is.na(col_mo)) {
if (!tbl %>% pull(col_mo) %>% is.mo()) {
warning("Improve integrity of the `", col_mo, "` column by transforming it with 'as.mo'.")
}
# join to microorganisms data set
tbl <- tbl %>% left_join_microorganisms(by = col_bactid)
tbl <- tbl %>% left_join_microorganisms(by = col_mo)
col_genus <- "genus"
col_species <- "species"
}

4
R/freq.R

@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
#' # you could also use `select` or `pull` to get your variables
#' septic_patients %>%
#' filter(hospital_id == "A") %>%
#' select(bactid) %>%
#' select(mo) %>%
#' freq()
#'
#' # multiple selected variables will be pasted together
@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
#' # get top 10 bugs of hospital A as a vector
#' septic_patients %>%
#' filter(hospital_id == "A") %>%
#' freq(bactid) %>%
#' freq(mo) %>%
#' top_freq(10)
#'
#' # save frequency table to an object

8
R/ggplot_rsi.R

@ -100,14 +100,14 @@ @@ -100,14 +100,14 @@
#' # genuine analysis: check 2 most prevalent microorganisms
#' septic_patients %>%
#' # create new bacterial ID's, with all CoNS under the same group (Becker et al.)
#' mutate(bactid = as.bactid(bactid, Becker = TRUE)) %>%
#' mutate(mo = as.mo(mo, Becker = TRUE)) %>%
#' # filter on top 2 bacterial ID's
#' filter(bactid %in% top_freq(freq(.$bactid), 2)) %>%
#' filter(mo %in% top_freq(freq(.$mo), 2)) %>%
#' # determine first isolates
#' mutate(first_isolate = first_isolate(.,
#' col_date = "date",
#' col_patient_id = "patient_id",
#' col_bactid = "bactid")) %>%
#' col_mo = "mo")) %>%
#' # filter on first isolates
#' filter(first_isolate == TRUE) %>%
#' # join the `microorganisms` data set
@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
#' ggplot_rsi(x = "Antibiotic",
#' facet = "mo") +
#' labs(title = "AMR of Top Two Microorganisms In Blood Culture Isolates",
#' subtitle = "Only First Isolates, CoNS grouped according to Becker et al.",
#' subtitle = "Only First Isolates, CoNS grouped according to Becker et al. (2014)",
#' x = "Microorganisms")
#' }
ggplot_rsi <- function(data,

26
R/join_microorganisms.R

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
#' @name join
#' @aliases join inner_join
#' @param x existing table to join, also supports character vectors
#' @param by a variable to join by - could be a column name of \code{x} with values that exist in \code{microorganisms$bactid} (like \code{by = "bacteria_id"}), or another column in \code{\link{microorganisms}} (but then it should be named, like \code{by = c("my_genus_species" = "fullname")})
#' @param by a variable to join by - could be a column name of \code{x} with values that exist in \code{microorganisms$mo} (like \code{by = "bacteria_id"}), or another column in \code{\link{microorganisms}} (but then it should be named, like \code{by = c("my_genus_species" = "fullname")})
#' @param suffix if there are non-joined duplicate variables in \code{x} and \code{y}, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.
#' @param ... other parameters to pass on to \code{dplyr::\link[dplyr]{join}}.
#' @details As opposed to the \code{\link[dplyr]{join}} functions of \code{dplyr}, characters vectors are supported and at default existing columns will get a suffix \code{"2"} and the newly joined columns will not get a suffix. See \code{\link[dplyr]{join}} for more information.
@ -25,9 +25,9 @@ @@ -25,9 +25,9 @@
#' colnames(df)
#' df2 <- left_join_microorganisms(df, "bacteria_id")
#' colnames(df2)
inner_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
inner_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
if (!any(class(x) %in% c("data.frame", "matrix"))) {
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
}
# no name set to `by` parameter
if (is.null(names(by))) {
@ -47,9 +47,9 @@ inner_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ... @@ -47,9 +47,9 @@ inner_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...
#' @rdname join
#' @export
left_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
left_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
if (!any(class(x) %in% c("data.frame", "matrix"))) {
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
}
# no name set to `by` parameter
if (is.null(names(by))) {
@ -69,9 +69,9 @@ left_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) @@ -69,9 +69,9 @@ left_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...)
#' @rdname join
#' @export
right_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
right_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
if (!any(class(x) %in% c("data.frame", "matrix"))) {
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
}
# no name set to `by` parameter
if (is.null(names(by))) {
@ -91,9 +91,9 @@ right_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ... @@ -91,9 +91,9 @@ right_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...
#' @rdname join
#' @export
full_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) {
full_join_microorganisms <- function(x, by = 'mo', suffix = c("2", ""), ...) {
if (!any(class(x) %in% c("data.frame", "matrix"))) {
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
}
# no name set to `by` parameter
if (is.null(names(by))) {
@ -113,9 +113,9 @@ full_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...) @@ -113,9 +113,9 @@ full_join_microorganisms <- function(x, by = 'bactid', suffix = c("2", ""), ...)
#' @rdname join
#' @export
semi_join_microorganisms <- function(x, by = 'bactid', ...) {
semi_join_microorganisms <- function(x, by = 'mo', ...) {
if (!any(class(x) %in% c("data.frame", "matrix"))) {
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
}
# no name set to `by` parameter
if (is.null(names(by))) {
@ -131,9 +131,9 @@ semi_join_microorganisms <- function(x, by = 'bactid', ...) { @@ -131,9 +131,9 @@ semi_join_microorganisms <- function(x, by = 'bactid', ...) {
#' @rdname join
#' @export
anti_join_microorganisms <- function(x, by = 'bactid', ...) {
anti_join_microorganisms <- function(x, by = 'mo', ...) {
if (!any(class(x) %in% c("data.frame", "matrix"))) {
x <- data.frame(bactid = as.character(x), stringsAsFactors = FALSE)
x <- data.frame(mo = as.character(x), stringsAsFactors = FALSE)
}
# no name set to `by` parameter
if (is.null(names(by))) {

19
R/key_antibiotics.R

@ -52,9 +52,9 @@ @@ -52,9 +52,9 @@
#' mutate(keyab = key_antibiotics(.)) %>%
#' mutate(
#' # now calculate first isolates
#' first_regular = first_isolate(., "date", "patient_id", "bactid"),
#' first_regular = first_isolate(., "date", "patient_id", "mo"),
#' # and first WEIGHTED isolates
#' first_weighted = first_isolate(., "date", "patient_id", "bactid",
#' first_weighted = first_isolate(., "date", "patient_id", "mo",
#' col_keyantibiotics = "keyab")
#' )
#'
@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
#' key_antibiotics_equal(strainA, strainB, ignore_I = FALSE)
#' # FALSE, because I is not ignored and so the 4th value differs
key_antibiotics <- function(tbl,
col_bactid = "bactid",
col_mo = "mo",
universal_1 = "amox",
universal_2 = "amcl",
universal_3 = "cfur",
@ -92,10 +92,15 @@ key_antibiotics <- function(tbl, @@ -92,10 +92,15 @@ key_antibiotics <- function(tbl,
GramNeg_4 = "cfot",
GramNeg_5 = "cfta",
GramNeg_6 = "mero",
warnings = TRUE) {
warnings = TRUE,
col_bactid = "bactid") {
if (!col_bactid %in% colnames(tbl)) {
stop('Column ', col_bactid, ' not found.', call. = FALSE)
if (col_bactid %in% colnames(tbl)) {
col_mo <- col_bactid
warning("Use of `col_bactid` is deprecated. Use `col_mo` instead.")
}
if (!col_mo %in% colnames(tbl)) {
stop('Column ', col_mo, ' not found.', call. = FALSE)
}
# check columns
@ -136,7 +141,7 @@ key_antibiotics <- function(tbl, @@ -136,7 +141,7 @@ key_antibiotics <- function(tbl,
gram_negative <- gram_negative[!is.na(gram_negative)]
# join microorganisms
tbl <- tbl %>% left_join_microorganisms(col_bactid)
tbl <- tbl %>% left_join_microorganisms(col_mo)
tbl$key_ab <- NA_character_

22
R/mdro.R

@ -21,10 +21,11 @@ @@ -21,10 +21,11 @@
#' Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines.
#' @param tbl table with antibiotic columns, like e.g. \code{amox} and \code{amcl}
#' @param country country code to determine guidelines. EUCAST rules will be used when left empty, see Details. Should be or a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive. Currently supported are \code{de} (Germany) and \code{nl} (the Netherlands).
#' @param col_bactid column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$bactid}, see \code{\link{microorganisms}}
#' @param info print progress
#' @param 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,levo,linc,line,mero,metr,mino,moxi,nali,neom,neti,nitr,novo,norf,oflo,peni,pita,poly,qida,rifa,roxi,siso,teic,tetr,tica,tige,tobr,trim,trsu,vanc column names of antibiotics. column names of antibiotics
#' @inheritParams EUCAST_rules
#' @param metr column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.
#' @param ... parameters that are passed on to methods
#' @inheritSection EUCAST_rules Antibiotics
#' @details When \code{country} will be left blank, guidelines will be taken from EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}).
#' @return Ordered factor with levels \code{Unknown < Negative < Unconfirmed < Positive}.
#' @rdname MDRO
@ -34,10 +35,10 @@ @@ -34,10 +35,10 @@
#'
#' septic_patients %>%
#' mutate(EUCAST = MDRO(.),
#' BRMO = MDRO(., "nl"))
#' BRMO = BRMO(.))
MDRO <- function(tbl,
country = NULL,
col_bactid = 'bactid',
col_mo = 'mo',
info = TRUE,
amcl = 'amcl',
amik = 'amik',
@ -97,10 +98,15 @@ MDRO <- function(tbl, @@ -97,10 +98,15 @@ MDRO <- function(tbl,
tobr = 'tobr',
trim = 'trim',
trsu = 'trsu',
vanc = 'vanc') {
vanc = 'vanc',
col_bactid = 'bactid') {
if (!col_bactid %in% colnames(tbl)) {
stop('Column ', col_bactid, ' not found.', call. = FALSE)
if (col_bactid %in% colnames(tbl)) {
col_mo <- col_bactid
warning("Use of `col_bactid` is deprecated. Use `col_mo` instead.")
}
if (!col_mo %in% colnames(tbl)) {
stop('Column ', col_mo, ' not found.', call. = FALSE)
}
# strip whitespaces
@ -249,7 +255,7 @@ MDRO <- function(tbl, @@ -249,7 +255,7 @@ MDRO <- function(tbl,
}
# join microorganisms
tbl <- tbl %>% left_join_microorganisms(col_bactid)
tbl <- tbl %>% left_join_microorganisms(col_mo)
tbl$MDRO <- NA_integer_

134
R/bactid.R → R/mo.R

@ -16,18 +16,18 @@ @@ -16,18 +16,18 @@
# GNU General Public License for more details. #
# ==================================================================== #
#' Transform to bacteria ID
#' Transform to microorganism ID
#'
#' Use this function to determine a valid ID based on a genus (and species). This input can be a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (like \code{"S. aureus"}), or just a genus. You could also \code{\link{select}} a genus and species column, zie Examples.
#' @param x a character vector or a dataframe with one or two columns
#' @param Becker a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1]. This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".
#' @param Lancefield a logical to indicate whether beta-haemolytic \emph{Streptococci} should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [2]. These \emph{Streptococci} will be categorised in their first group, i.e. \emph{Streptococcus dysgalactiae} will be group C, although officially it was also categorised into groups G and L. Groups D and E will be ignored, since they are \emph{Enterococci}.
#' @rdname as.bactid
#' @aliases bactid
#' @keywords bactid Becker becker Lancefield lancefield guess
#' @details \code{guess_bactid} is an alias of \code{as.bactid}.
#' @rdname as.mo
#' @aliases mo
#' @keywords mo Becker becker Lancefield lancefield guess
#' @details \code{guess_mo} is an alias of \code{as.mo}.
#'
#' Use the \code{\link{mo_property}} functions to get properties based on the returned bactid, see Examples.
#' Use the \code{\link{mo_property}} functions to get properties based on the returned mo, see Examples.
#'
#' Some exceptions have been built in to get more logical results, based on prevalence of human pathogens. These are:
#' \itemize{
@ -45,51 +45,51 @@ @@ -45,51 +45,51 @@
#' \url{https://dx.doi.org/10.1084/jem.57.4.571}
#' @export
#' @importFrom dplyr %>% pull left_join
#' @return Character (vector) with class \code{"bactid"}. Unknown values will return \code{NA}.
#' @return Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
#' @seealso \code{\link{microorganisms}} for the dataframe that is being used to determine ID's.
#' @examples
#' # These examples all return "STAAUR", the ID of S. aureus:
#' as.bactid("stau")
#' as.bactid("STAU")
#' as.bactid("staaur")
#' as.bactid("S. aureus")
#' as.bactid("S aureus")
#' as.bactid("Staphylococcus aureus")
#' as.bactid("MRSA") # Methicillin Resistant S. aureus
#' as.bactid("VISA") # Vancomycin Intermediate S. aureus
#' as.bactid("VRSA") # Vancomycin Resistant S. aureus
#' as.mo("stau")
#' as.mo("STAU")
#' as.mo("staaur")
#' as.mo("S. aureus")
#' as.mo("S aureus")
#' as.mo("Staphylococcus aureus")
#' as.mo("MRSA") # Methicillin Resistant S. aureus
#' as.mo("VISA") # Vancomycin Intermediate S. aureus
#' as.mo("VRSA") # Vancomycin Resistant S. aureus
#'
#' # guess_bactid is an alias of as.bactid and works the same
#' guess_bactid("S. epidermidis") # will remain species: STAEPI
#' guess_bactid("S. epidermidis", Becker = TRUE) # will not remain species: STACNS
#' # guess_mo is an alias of as.mo and works the same
#' guess_mo("S. epidermidis") # will remain species: STAEPI
#' guess_mo("S. epidermidis", Becker = TRUE) # will not remain species: STACNS
#'
#' guess_bactid("S. pyogenes") # will remain species: STCAGA
#' guess_bactid("S. pyogenes", Lancefield = TRUE) # will not remain species: STCGRA
#' guess_mo("S. pyogenes") # will remain species: STCAGA
#' guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: STCGRA
#'
#' # Use mo_* functions to get a specific property based on a bactid
#' Ecoli <- as.bactid("E. coli") # returns `ESCCOL`
#' # Use mo_* functions to get a specific property based on `mo`
#' Ecoli <- as.mo("E. coli") # returns `ESCCOL`
#' mo_genus(Ecoli) # returns "Escherichia"
#' mo_gramstain(Ecoli) # returns "Negative rods"
#'
#' \dontrun{
#' df$bactid <- as.bactid(df$microorganism_name)
#' df$mo <- as.mo(df$microorganism_name)
#'
#' # the select function of tidyverse is also supported:
#' library(dplyr)
#' df$bactid <- df %>%
#' df$mo <- df %>%
#' select(microorganism_name) %>%
#' guess_bactid()
#' guess_mo()
#'
#' # and can even contain 2 columns, which is convenient for genus/species combinations:
#' df$bactid <- df %>%
#' df$mo <- df %>%
#' select(genus, species) %>%
#' guess_bactid()
#' guess_mo()
#'
#' # same result:
#' df <- df %>%
#' mutate(bactid = guess_bactid(paste(genus, species)))
#' mutate(mo = guess_mo(paste(genus, species)))
#' }
as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
if (NCOL(x) == 2) {
@ -111,7 +111,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -111,7 +111,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
}
}
MOs <- AMR::microorganisms %>% filter(!bactid %like% '^_FAM') # dont search in those
MOs <- AMR::microorganisms %>% filter(!mo %like% '^_FAM') # dont search in those
failures <- character(0)
x_input <- x
@ -136,7 +136,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -136,7 +136,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
for (i in 1:length(x)) {
if (Becker == TRUE | Becker == "all") {
mo <- suppressWarnings(guess_bactid(x_backup[i]))
mo <- suppressWarnings(guess_mo(x_backup[i]))
if (mo %like% '^STA') {
# See Source. It's this figure:
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4187637/figure/F3/
@ -167,7 +167,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -167,7 +167,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
}
if (Lancefield == TRUE) {
mo <- suppressWarnings(guess_bactid(x_backup[i]))
mo <- suppressWarnings(guess_mo(x_backup[i]))
if (mo %like% '^STC') {
# See Source
species <- left_join_microorganisms(mo)$species
@ -205,13 +205,13 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -205,13 +205,13 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
failures <- c(failures, x_backup[i])
next
}
if (x_backup[i] %in% AMR::microorganisms$bactid) {
# is already a valid bactid
if (x_backup[i] %in% AMR::microorganisms$mo) {
# is already a valid mo
x[i] <- x_backup[i]
next
}
if (x_trimmed[i] %in% AMR::microorganisms$bactid) {
# is already a valid bactid
if (x_trimmed[i] %in% AMR::microorganisms$mo) {
# is already a valid mo
x[i] <- x_trimmed[i]
next
}
@ -275,14 +275,14 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -275,14 +275,14 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
}
# try any match keeping spaces
found <- MOs[which(MOs$fullname %like% x_withspaces[i]),]$bactid
found <- MOs[which(MOs$fullname %like% x_withspaces[i]),]$mo
if (length(found) > 0) {
x[i] <- found[1L]
next
}
# try any match diregarding spaces
found <- MOs[which(MOs$fullname %like% x[i]),]$bactid
found <- MOs[which(MOs$fullname %like% x[i]),]$mo
if (length(found) > 0) {
x[i] <- found[1L]
next
@ -290,21 +290,21 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -290,21 +290,21 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
# try exact match of only genus, with 'species' attached
# (this prevents Streptococcus from becoming Peptostreptococcus, since "p" < "s")
found <- MOs[which(MOs$fullname == x_species[i]),]$bactid
found <- MOs[which(MOs$fullname == x_species[i]),]$mo
if (length(found) > 0) {
x[i] <- found[1L]
next
}
# try any match of only genus, with 'species' attached
found <- MOs[which(MOs$fullname %like% x_species[i]),]$bactid
found <- MOs[which(MOs$fullname %like% x_species[i]),]$mo
if (length(found) > 0) {
x[i] <- found[1L]
next
}
# search for GLIMS code
found <- AMR::microorganisms.umcg[which(toupper(AMR::microorganisms.umcg$mocode) == toupper(x_trimmed[i])),]$bactid
found <- AMR::microorganisms.umcg[which(toupper(AMR::microorganisms.umcg$umcg) == toupper(x_trimmed[i])),]$mo
if (length(found) > 0) {
x[i] <- found[1L]
next
@ -317,7 +317,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -317,7 +317,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
x_split[i] <- paste0(x_trimmed[i] %>% substr(1, x_length / 2) %>% trimws(),
'.* ',
x_trimmed[i] %>% substr((x_length / 2) + 1, x_length) %>% trimws())
found <- MOs[which(MOs$fullname %like% paste0('^', x_split[i])),]$bactid
found <- MOs[which(MOs$fullname %like% paste0('^', x_split[i])),]$mo
if (length(found) > 0) {
x[i] <- found[1L]
next
@ -331,7 +331,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -331,7 +331,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
x_trimmed[i] <- trimws(x_trimmed[i], which = "both")
}
if (!is.na(x_trimmed[i])) {
found <- MOs[which(MOs$fullname %like% x_trimmed[i]),]$bactid
found <- MOs[which(MOs$fullname %like% x_trimmed[i]),]$mo
if (length(found) > 0) {
x[i] <- found[1L]
next
@ -346,7 +346,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -346,7 +346,7 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
failures <- failures[!failures %in% c(NA, NULL, NaN)]
if (length(failures) > 0) {
warning("These values could not be coerced to a valid bactid: ",
warning("These values could not be coerced to a valid mo: ",
paste('"', unique(failures), '"', sep = "", collapse = ', '),
".",
call. = FALSE)
@ -364,19 +364,51 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) { @@ -364,19 +364,51 @@ as.bactid <- function(x, Becker = FALSE, Lancefield = FALSE) {
by = "input") %>%
pull(found)
class(x) <- "bactid"
class(x) <- "mo"
attr(x, 'package') <- 'AMR'
x
}
#' @rdname as.bactid
#' @rdname as.mo
#' @export
guess_bactid <- as.bactid
is.mo <- function(x) {
# bactid for older releases
# remove when is.bactid will be removed
identical(class(x), "mo") | identical(class(x), "bactid")
}
#' @rdname as.mo
#' @export
guess_mo <- as.mo
#' @exportMethod print.mo
#' @export
#' @noRd
print.mo <- function(x, ...) {
cat("Class 'mo'\n")
print.default(as.character(x), quote = FALSE)
}
#' @rdname as.bactid
#' @exportMethod as.data.frame.mo
#' @export
is.bactid <- function(x) {
identical(class(x), "bactid")
#' @noRd
as.data.frame.mo <- function (x, ...) {
# same as as.data.frame.character but with removed stringsAsFactors
nm <- paste(deparse(substitute(x), width.cutoff = 500L),
collapse = " ")
if (!"nm" %in% names(list(...))) {
as.data.frame.vector(x, ..., nm = nm)
} else {
as.data.frame.vector(x, ...)
}
}
#' @exportMethod pull.mo
#' @export
#' @importFrom dplyr pull
#' @noRd
pull.mo <- function(.data, ...) {
pull(as.data.frame(.data), ...)
}
#' @exportMethod print.bactid

14
R/mo_property.R

@ -18,9 +18,9 @@ @@ -18,9 +18,9 @@
#' Property of a microorganism
#'
#' Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set, based on their \code{bactid}. Get such an ID with \code{\link{as.bactid}}.
#' @param x a (vector of a) valid \code{\link{bactid}} or any text that can be coerced to a valid bactid with \code{\link{as.bactid}}
#' @param property one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"bactid"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}
#' Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set, based on their \code{mo}. Get such an ID with \code{\link{as.mo}}.
#' @param x a (vector of a) valid \code{\link{mo}} or any text that can be coerced to a valid microorganism code with \code{\link{as.mo}}
#' @param property one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"mo"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}
#' @rdname mo_property
#' @export
#' @importFrom dplyr %>% left_join pull
@ -68,12 +68,12 @@ mo_property <- function(x, property = 'fullname') { @@ -68,12 +68,12 @@ mo_property <- function(x, property = 'fullname') {
if (!property %in% colnames(microorganisms)) {
stop("invalid property: ", property, " - use a column name of `microorganisms`")
}
if (!is.bactid(x)) {
x <- as.bactid(x) # this will give a warning if x cannot be coerced
if (!is.mo(x)) {
x <- as.mo(x) # this will give a warning if x cannot be coerced
}
suppressWarnings(
data.frame(bactid = x, stringsAsFactors = FALSE) %>%
left_join(AMR::microorganisms, by = "bactid") %>%
data.frame(mo = x, stringsAsFactors = FALSE) %>%
left_join(AMR::microorganisms, by = "mo") %>%
pull(property)
)
}

6
R/resistance_predict.R

@ -65,13 +65,13 @@ @@ -65,13 +65,13 @@
#' library(dplyr)
#' septic_patients %>%
#' # get bacteria properties like genus and species
#' left_join_microorganisms("bactid") %>%
#' left_join_microorganisms("mo") %>%
#' # calculate first isolates
#' mutate(first_isolate =
#' first_isolate(.,
#' "date",
#' "patient_id",
#' "bactid",
#' "mo",
#' col_specimen = NA,
#' col_icu = NA)) %>%
#' # filter on first E. coli isolates
@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
#' if (!require(ggplot2)) {
#'
#' data <- septic_patients %>%
#' filter(bactid == "ESCCOL") %>%
#' filter(mo == "ESCCOL") %>%
#' resistance_predict(col_ab = "amox",
#' col_date = "date",
#' info = FALSE,

34
README.md

@ -44,7 +44,7 @@ This `AMR` package basically does four important things: @@ -44,7 +44,7 @@ This `AMR` package basically does four important things:
1. It **cleanses existing data**, by transforming it to reproducible and profound *classes*, making the most efficient use of R. These functions all use artificial intelligence to guess results that you would expect:
* Use `as.bactid` to get an ID of a microorganism. The IDs are quite obvious - the ID of *E. coli* is "ESCCOL" and the ID of *S. aureus* is "STAAUR". The function takes almost any text as input that looks like the name or code of a microorganism like "E. coli", "esco" and "esccol". Even `as.bactid("MRSA")` will return the ID of *S. aureus*. Moreover, it can group all coagulase negative and positive *Staphylococci*, and can transform *Streptococci* into Lancefield groups. To find bacteria based on your input, this package contains a freely available database of ~2,650 different (potential) human pathogenic microorganisms.
* Use `as.mo` to get an ID of a microorganism. The IDs are quite obvious - the ID of *E. coli* is "ESCCOL" and the ID of *S. aureus* is "STAAUR". The function takes almost any text as input that looks like the name or code of a microorganism like "E. coli", "esco" and "esccol". Even `as.mo("MRSA")` will return the ID of *S. aureus*. Moreover, it can group all coagulase negative and positive *Staphylococci*, and can transform *Streptococci* into Lancefield groups. To find bacteria based on your input, this package contains a freely available database of ~2,650 different (potential) human pathogenic microorganisms.
* Use `as.rsi` to transform values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like "<=0.002; S" (combined MIC/RSI) will result in "S".
* Use `as.mic` to cleanse your MIC values. It produces a so-called factor (called *ordinal* in SPSS) with valid MIC values as levels. A value like "<=0.002; S" (combined MIC/RSI) will result in "<=0.002".
* Use `as.atc` to get the ATC code of an antibiotic as defined by the WHO. This package contains a database with most LIS codes, official names, DDDs and even trade names of antibiotics. For example, the values "Furabid", "Furadantin", "nitro" all return the ATC code of Nitrofurantoine.
@ -55,8 +55,8 @@ This `AMR` package basically does four important things: @@ -55,8 +55,8 @@ This `AMR` package basically does four important things:
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 2,650 microorganisms (2,207 bacteria, 285 fungi/yeasts, 153 parasites, 1 other). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. Since it uses `as.bactid` internally, AI is supported. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. These functions can be used to add new variables to your data.
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_official` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.bactid` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_official("Fluclox")`, `ab_official("Floxapen")` and `ab_official("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 2,650 microorganisms (2,207 bacteria, 285 fungi/yeasts, 153 parasites, 1 other). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. Since it uses `as.mo` internally, AI is supported. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. These functions can be used to add new variables to your data.
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_official` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.mo` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_official("Fluclox")`, `ab_official("Floxapen")` and `ab_official("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
3. It **analyses the data** with convenient functions that use well-known methods.
@ -204,7 +204,7 @@ plot(mic_data) @@ -204,7 +204,7 @@ plot(mic_data)
### Overwrite/force resistance based on EUCAST rules
This is also called *interpretive reading*.
```r
before <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
before <- data.frame(bact = c("STAAUR", # Staphylococcus aureus
"ENCFAE", # Enterococcus faecalis
"ESCCOL", # Escherichia coli
"KLEPNE", # Klebsiella pneumoniae
@ -216,7 +216,7 @@ before <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus @@ -216,7 +216,7 @@ before <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
cfur = "-", # Cefuroxime
stringsAsFactors = FALSE)
before
# bactid vanc amox coli cfta cfur
# bact vanc amox coli cfta cfur
# 1 STAAUR - - - - -
# 2 ENCFAE - - - - -
# 3 ESCCOL - - - - -
@ -224,9 +224,9 @@ before @@ -224,9 +224,9 @@ before
# 5 PSEAER - - - - -
# Now apply those rules; just need a column with bacteria IDs and antibiotic results:
after <- EUCAST_rules(before)
after <- EUCAST_rules(before, col_mo = "bact")
after
# bactid vanc amox coli cfta cfur
# bact vanc amox coli cfta cfur
# 1 STAAUR - - R R -
# 2 ENCFAE - - R R R
# 3 ESCCOL R - - - -
@ -234,17 +234,17 @@ after @@ -234,17 +234,17 @@ after
# 5 PSEAER R R - - R
```
Bacteria IDs can be retrieved with the `guess_bactid` function. It uses any type of info about a microorganism as input. For example, all these will return value `STAAUR`, the ID of *S. aureus*:
Bacteria IDs can be retrieved with the `guess_mo` function. It uses any type of info about a microorganism as input. For example, all these will return value `STAAUR`, the ID of *S. aureus*:
```r
guess_bactid("stau")
guess_bactid("STAU")
guess_bactid("staaur")
guess_bactid("S. aureus")
guess_bactid("S aureus")
guess_bactid("Staphylococcus aureus")
guess_bactid("MRSA") # Methicillin Resistant S. aureus
guess_bactid("VISA") # Vancomycin Intermediate S. aureus
guess_bactid("VRSA") # Vancomycin Resistant S. aureus
guess_mo("stau")
guess_mo("STAU")
guess_mo("staaur")
guess_mo("S. aureus")
guess_mo("S aureus")
guess_mo("Staphylococcus aureus")
guess_mo("MRSA") # Methicillin Resistant S. aureus
guess_mo("VISA") # Vancomycin Intermediate S. aureus
guess_mo("VRSA") # Vancomycin Resistant S. aureus
```
### Other (microbial) epidemiological functions

BIN
data/microorganisms.rda

Binary file not shown.

BIN
data/microorganisms.umcg.rda

Binary file not shown.

BIN
data/septic_patients.rda

Binary file not shown.

22
man/AMR-deprecated.Rd

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/deprecated.R
\name{AMR-deprecated}
\alias{AMR-deprecated}
\alias{as.bactid}
\alias{is.bactid}
\alias{guess_bactid}
\alias{ratio}
\title{Deprecated functions}
\usage{
as.bactid(...)
is.bactid(...)
guess_bactid(...)
ratio(x, ratio)
}
\description{
These functions are \link{Deprecated}. They will be removed in a future release. Using the functions will give a warning with the name of the function it has been replaced by.
}
\keyword{internal}

33
man/EUCAST.Rd

@ -13,7 +13,7 @@ EUCAST Expert Rules Version 2.0: \cr @@ -13,7 +13,7 @@ EUCAST Expert Rules Version 2.0: \cr
\url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}
}
\usage{
EUCAST_rules(tbl, col_bactid = "bactid", info = TRUE, amcl = "amcl",
EUCAST_rules(tbl, col_mo = "mo", info = TRUE, amcl = "amcl",
amik = "amik", amox = "amox", ampi = "ampi", azit = "azit",
azlo = "azlo", aztr = "aztr", cefa = "cefa", cfep = "cfep",
cfot = "cfot", cfox = "cfox", cfra = "cfra", cfta = "cfta",
@ -28,18 +28,21 @@ EUCAST_rules(tbl, col_bactid = "bactid", info = TRUE, amcl = "amcl", @@ -28,18 +28,21 @@ EUCAST_rules(tbl, col_bactid = "bactid", info = TRUE, amcl = "amcl",
peni = "peni", pita = "pita", poly = "poly", pris = "pris",
qida = "qida", rifa = "rifa", roxi = "roxi", siso = "siso",
teic = "teic", tetr = "tetr", tica = "tica", tige = "tige",
tobr = "tobr", trim = "trim", trsu = "trsu", vanc = "vanc")
tobr = "tobr", trim = "trim", trsu = "trsu", vanc = "vanc",
col_bactid = "bactid")
interpretive_reading(...)
}
\arguments{
\item{tbl}{table with antibiotic columns, like e.g. \code{amox} and \code{amcl}}
\item{col_bactid}{column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$bactid}, see \code{\link{microorganisms}}}
\item{col_mo}{column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$mo}, see \code{\link{microorganisms}}}
\item{info}{print progress}
\item{amcl, amik, amox, ampi, azit, azlo, aztr, cefa, cfep, cfot, cfox, cfra, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, levo, linc, line, mero, mezl, mino, moxi, nali, neom, neti, nitr, norf, novo, oflo, peni, pita, poly, pris, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column names of antibiotics. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{amcl, amik, amox, ampi, azit, azlo, aztr, cefa, cfep, cfot, cfox, cfra, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, levo, linc, line, mero, mezl, mino, moxi, nali, neom, neti, nitr, norf, novo, oflo, peni, pita, poly, pris, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{col_bactid}{Deprecated. Use \code{col_mo} instead.}
\item{...}{parameters that are passed on to \code{EUCAST_rules}}
}
@ -49,7 +52,7 @@ table with edited variables of antibiotics. @@ -49,7 +52,7 @@ table with edited variables of antibiotics.
\description{
Apply expert rules (like intrinsic resistance), as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}.
}
\section{Abbrevations of antibiotics}{
\section{Antibiotics}{
Abbrevations of the column containing antibiotics:
@ -118,16 +121,16 @@ Abbrevations of the column containing antibiotics: @@ -118,16 +121,16 @@ Abbrevations of the column containing antibiotics:
\examples{
a <- EUCAST_rules(septic_patients)
a <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
"ENCFAE", # Enterococcus faecalis
"ESCCOL", # Escherichia coli
"KLEPNE", # Klebsiella pneumoniae
"PSEAER"), # Pseudomonas aeruginosa
vanc = "-", # Vancomycin
amox = "-", # Amoxicillin
coli = "-", # Colistin
cfta = "-", # Ceftazidime
cfur = "-", # Cefuroxime
a <- data.frame(mo = c("STAAUR", # Staphylococcus aureus
"ENCFAE", # Enterococcus faecalis
"ESCCOL", # Escherichia coli
"KLEPNE", # Klebsiella pneumoniae
"PSEAER"), # Pseudomonas aeruginosa
vanc = "-", # Vancomycin
amox = "-", # Amoxicillin
coli = "-", # Colistin
cfta = "-", # Ceftazidime
cfur = "-", # Cefuroxime
stringsAsFactors = FALSE)
a

196
man/MDRO.Rd

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
\alias{EUCAST_exceptional_phenotypes}
\title{Determine multidrug-resistant organisms (MDRO)}
\usage{
MDRO(tbl, country = NULL, col_bactid = "bactid", info = TRUE,
MDRO(tbl, country = NULL, col_mo = "mo", info = TRUE,
amcl = "amcl", amik = "amik", amox = "amox", ampi = "ampi",
azit = "azit", aztr = "aztr", cefa = "cefa", cfra = "cfra",
cfep = "cfep", cfot = "cfot", cfox = "cfox", cfta = "cfta",
@ -22,7 +22,8 @@ MDRO(tbl, country = NULL, col_bactid = "bactid", info = TRUE, @@ -22,7 +22,8 @@ MDRO(tbl, country = NULL, col_bactid = "bactid", info = TRUE,
peni = "peni", pita = "pita", poly = "poly", qida = "qida",
rifa = "rifa", roxi = "roxi", siso = "siso", teic = "teic",
tetr = "tetr", tica = "tica", tige = "tige", tobr = "tobr",
trim = "trim", trsu = "trsu", vanc = "vanc")
trim = "trim", trsu = "trsu", vanc = "vanc",
col_bactid = "bactid")
BRMO(tbl, country = "nl", ...)
@ -35,11 +36,129 @@ EUCAST_exceptional_phenotypes(tbl, country = "EUCAST", ...) @@ -35,11 +36,129 @@ EUCAST_exceptional_phenotypes(tbl, country = "EUCAST", ...)
\item{country}{country code to determine guidelines. EUCAST rules will be used when left empty, see Details. Should be or a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive. Currently supported are \code{de} (Germany) and \code{nl} (the Netherlands).}
\item{col_bactid}{column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$bactid}, see \code{\link{microorganisms}}}
\item{col_mo}{column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$mo}, see \code{\link{microorganisms}}}
\item{info}{print progress}
\item{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, levo, linc, line, mero, metr, mino, moxi, nali, neom, neti, nitr, novo, norf, oflo, peni, pita, poly, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column names of antibiotics. column names of antibiotics}
\item{amcl}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{amik}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{amox}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{ampi}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{azit}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{aztr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cefa}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cfra}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cfep}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cfot}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cfox}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cfta}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cftr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cfur}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{chlo}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{cipr}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{clar}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{clin}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{clox}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{coli}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{czol}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Antibiotics section for an explanation of the abbreviations.}
\item{dapt}{column name of an antibiotic. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing columns will anyway be skipped. See the Anti