diff --git a/.gitignore b/.gitignore index a3e30bee..778fdaa4 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Meta doc +.Renviron .Rproj.user .Rhistory .RData diff --git a/DESCRIPTION b/DESCRIPTION index 83bdcb56..5f5043e0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR Version: 0.5.0.9009 -Date: 2019-01-06 +Date: 2019-01-08 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/NEWS.md b/NEWS.md index 7b26b020..254bcc06 100755 --- a/NEWS.md +++ b/NEWS.md @@ -28,9 +28,13 @@ * New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the *G*-test and more. These are also available (and even easier readable) on our website: https://msberends.gitlab.io/AMR. #### Changed -* Function `guess_mo()` is now deprecated in favour of `as.mo()` and will be remover in future versions -* Fixed a critical bug in `eucast_rules()` where some rules that depend on previous applied rules would not be applied adequately +* Function `eucast_rules()`: + * Updated EUCAST Clinical breakpoints to [version 9.0 of 1 January 2019](http://www.eucast.org/clinical_breakpoints/) + * Fixed a critical bug where some rules that depend on previous applied rules would not be applied adequately + * Emphasised in manual that penicillin is meant as benzylpenicillin (ATC [J01CE01](https://www.whocc.no/atc_ddd_index/?code=J01CE01)) +* Function `guess_mo()` is now deprecated in favour of `as.mo()` and will be removed in future versions * Improvements for `as.mo()`: + * Fix for vector containing only empty values * Finds better results when input is in other languages * Better handling for subspecies * Better handling for *Salmonellae* diff --git a/R/data.R b/R/data.R index a9ee2f1c..b1ad6748 100755 --- a/R/data.R +++ b/R/data.R @@ -127,7 +127,7 @@ #' Data set with taxonomic data from ITIS #' #' A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa. MO codes can be looked up using \code{\link{as.mo}}. -#' @inheritSection itis ITIS +#' @inheritSection ITIS ITIS #' @format A \code{\link{data.frame}} with 18,833 observations and 15 variables: #' \describe{ #' \item{\code{mo}}{ID of microorganism} diff --git a/R/eucast_rules.R b/R/eucast_rules.R index 616b8da9..9cc57146 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -34,68 +34,68 @@ #' #' Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code}) #' -#' \strong{amcl}: amoxicillin+clavulanic acid (\emph{J01CR02}), -#' \strong{amik}: amikacin (\emph{J01GB06}), -#' \strong{amox}: amoxicillin (\emph{J01CA04}), -#' \strong{ampi}: ampicillin (\emph{J01CA01}), -#' \strong{azit}: azithromycin (\emph{J01FA10}), -#' \strong{azlo}: azlocillin (\emph{J01CA09}), -#' \strong{aztr}: aztreonam (\emph{J01DF01}), -#' \strong{cefa}: cefaloridine (\emph{J01DB02}), -#' \strong{cfep}: cefepime (\emph{J01DE01}), -#' \strong{cfot}: cefotaxime (\emph{J01DD01}), -#' \strong{cfox}: cefoxitin (\emph{J01DC01}), -#' \strong{cfra}: cefradine (\emph{J01DB09}), -#' \strong{cfta}: ceftazidime (\emph{J01DD02}), -#' \strong{cftr}: ceftriaxone (\emph{J01DD04}), -#' \strong{cfur}: cefuroxime (\emph{J01DC02}), -#' \strong{chlo}: chloramphenicol (\emph{J01BA01}), -#' \strong{cipr}: ciprofloxacin (\emph{J01MA02}), -#' \strong{clar}: clarithromycin (\emph{J01FA09}), -#' \strong{clin}: clindamycin (\emph{J01FF01}), -#' \strong{clox}: flucloxacillin (\emph{J01CF05}), -#' \strong{coli}: colistin (\emph{J01XB01}), -#' \strong{czol}: cefazolin (\emph{J01DB04}), -#' \strong{dapt}: daptomycin (\emph{J01XX09}), -#' \strong{doxy}: doxycycline (\emph{J01AA02}), -#' \strong{erta}: ertapenem (\emph{J01DH03}), -#' \strong{eryt}: erythromycin (\emph{J01FA01}), -#' \strong{fosf}: fosfomycin (\emph{J01XX01}), -#' \strong{fusi}: fusidic acid (\emph{J01XC01}), -#' \strong{gent}: gentamicin (\emph{J01GB03}), -#' \strong{imip}: imipenem (\emph{J01DH51}), -#' \strong{kana}: kanamycin (\emph{J01GB04}), -#' \strong{levo}: levofloxacin (\emph{J01MA12}), -#' \strong{linc}: lincomycin (\emph{J01FF02}), -#' \strong{line}: linezolid (\emph{J01XX08}), -#' \strong{mero}: meropenem (\emph{J01DH02}), -#' \strong{mezl}: mezlocillin (\emph{J01CA10}), -#' \strong{mino}: minocycline (\emph{J01AA08}), -#' \strong{moxi}: moxifloxacin (\emph{J01MA14}), -#' \strong{nali}: nalidixic acid (\emph{J01MB02}), -#' \strong{neom}: neomycin (\emph{J01GB05}), -#' \strong{neti}: netilmicin (\emph{J01GB07}), -#' \strong{nitr}: nitrofurantoin (\emph{J01XE01}), -#' \strong{norf}: norfloxacin (\emph{J01MA06}), -#' \strong{novo}: novobiocin (an ATCvet code: \emph{QJ01XX95}), -#' \strong{oflo}: ofloxacin (\emph{J01MA01}), -#' \strong{peni}: penicillin (\emph{J01RA01}), -#' \strong{pipe}: piperacillin (\emph{J01CA12}), -#' \strong{pita}: piperacillin+tazobactam (\emph{J01CR05}), -#' \strong{poly}: polymyxin B (\emph{J01XB02}), -#' \strong{pris}: pristinamycin (\emph{J01FG01}), -#' \strong{qida}: quinupristin/dalfopristin (\emph{J01FG02}), -#' \strong{rifa}: rifampicin (\emph{J04AB02}), -#' \strong{roxi}: roxithromycin (\emph{J01FA06}), -#' \strong{siso}: sisomicin (\emph{J01GB08}), -#' \strong{teic}: teicoplanin (\emph{J01XA02}), -#' \strong{tetr}: tetracycline (\emph{J01AA07}), -#' \strong{tica}: ticarcillin (\emph{J01CA13}), -#' \strong{tige}: tigecycline (\emph{J01AA12}), -#' \strong{tobr}: tobramycin (\emph{J01GB01}), -#' \strong{trim}: trimethoprim (\emph{J01EA01}), -#' \strong{trsu}: sulfamethoxazole and trimethoprim (\emph{J01EE01}), -#' \strong{vanc}: vancomycin (\emph{J01XA01}). +#' \strong{amcl}: amoxicillin+clavulanic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR02}{J01CR02}), +#' \strong{amik}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}), +#' \strong{amox}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}), +#' \strong{ampi}: ampicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA01}{J01CA01}), +#' \strong{azit}: azithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA10}{J01FA10}), +#' \strong{azlo}: azlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA09}{J01CA09}), +#' \strong{aztr}: aztreonam (\href{https://www.whocc.no/atc_ddd_index/?code=J01DF01}{J01DF01}), +#' \strong{cefa}: cefaloridine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB02}{J01DB02}), +#' \strong{cfep}: cefepime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DE01}{J01DE01}), +#' \strong{cfot}: cefotaxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD01}{J01DD01}), +#' \strong{cfox}: cefoxitin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC01}{J01DC01}), +#' \strong{cfra}: cefradine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB09}{J01DB09}), +#' \strong{cfta}: ceftazidime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD02}{J01DD02}), +#' \strong{cftr}: ceftriaxone (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD04}{J01DD04}), +#' \strong{cfur}: cefuroxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC02}{J01DC02}), +#' \strong{chlo}: chloramphenicol (\href{https://www.whocc.no/atc_ddd_index/?code=J01BA01}{J01BA01}), +#' \strong{cipr}: ciprofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA02}{J01MA02}), +#' \strong{clar}: clarithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA09}{J01FA09}), +#' \strong{clin}: clindamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF01}{J01FF01}), +#' \strong{clox}: flucloxacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CF05}{J01CF05}), +#' \strong{coli}: colistin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB01}{J01XB01}), +#' \strong{czol}: cefazolin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB04}{J01DB04}), +#' \strong{dapt}: daptomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX09}{J01XX09}), +#' \strong{doxy}: doxycycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA02}{J01AA02}), +#' \strong{erta}: ertapenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH03}{J01DH03}), +#' \strong{eryt}: erythromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA01}{J01FA01}), +#' \strong{fosf}: fosfomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX01}{J01XX01}), +#' \strong{fusi}: fusidic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XC01}{J01XC01}), +#' \strong{gent}: gentamicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB03}{J01GB03}), +#' \strong{imip}: imipenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH51}{J01DH51}), +#' \strong{kana}: kanamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB04}{J01GB04}), +#' \strong{levo}: levofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA12}{J01MA12}), +#' \strong{linc}: lincomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF02}{J01FF02}), +#' \strong{line}: linezolid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX08}{J01XX08}), +#' \strong{mero}: meropenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH02}{J01DH02}), +#' \strong{mezl}: mezlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA10}{J01CA10}), +#' \strong{mino}: minocycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA08}{J01AA08}), +#' \strong{moxi}: moxifloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA14}{J01MA14}), +#' \strong{nali}: nalidixic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01MB02}{J01MB02}), +#' \strong{neom}: neomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB05}{J01GB05}), +#' \strong{neti}: netilmicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB07}{J01GB07}), +#' \strong{nitr}: nitrofurantoin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XE01}{J01XE01}), +#' \strong{norf}: norfloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA06}{J01MA06}), +#' \strong{novo}: novobiocin (an ATCvet code: \href{https://www.whocc.no/atc_ddd_index/?code=QJ01XX95}{QJ01XX95}), +#' \strong{oflo}: ofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA01}{J01MA01}), +#' \strong{peni}: (benzyl)penicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CE01}{J01CE01}), +#' \strong{pipe}: piperacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA12}{J01CA12}), +#' \strong{pita}: piperacillin+tazobactam (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR05}{J01CR05}), +#' \strong{poly}: polymyxin B (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB02}{J01XB02}), +#' \strong{pris}: pristinamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG01}{J01FG01}), +#' \strong{qida}: quinupristin/dalfopristin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG02}{J01FG02}), +#' \strong{rifa}: rifampicin (\href{https://www.whocc.no/atc_ddd_index/?code=J04AB02}{J04AB02}), +#' \strong{roxi}: roxithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA06}{J01FA06}), +#' \strong{siso}: sisomicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB08}{J01GB08}), +#' \strong{teic}: teicoplanin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA02}{J01XA02}), +#' \strong{tetr}: tetracycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA07}{J01AA07}), +#' \strong{tica}: ticarcillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA13}{J01CA13}), +#' \strong{tige}: tigecycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA12}{J01AA12}), +#' \strong{tobr}: tobramycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB01}{J01GB01}), +#' \strong{trim}: trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EA01}{J01EA01}), +#' \strong{trsu}: sulfamethoxazole and trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EE01}{J01EE01}), +#' \strong{vanc}: vancomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA01}{J01XA01}). #' @keywords interpretive eucast reading resistance #' @rdname eucast_rules #' @export @@ -114,8 +114,8 @@ #' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf} #' } #' \item{ -#' EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 8.1, 2018. \cr -#' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_8.1_Breakpoint_Tables.xlsx} +#' EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 9.0, 2019. \cr +#' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_9.0_Breakpoint_Tables.xlsx} #' } #' } #' @inheritSection AMR Read more on our website! diff --git a/R/itis.R b/R/itis.R index 6b3e78fa..e4bc2477 100644 --- a/R/itis.R +++ b/R/itis.R @@ -30,12 +30,12 @@ #' #' ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3]. #' @inheritSection AMR Read more on our website! -#' @name itis -#' @rdname itis +#' @name ITIS +#' @rdname ITIS #' @examples #' # Get a note when a species was renamed #' mo_shortname("Chlamydia psittaci") -#' # Note: 'Chlamydia psittaci' (Page, 1968) was renamed +#' # Note: 'Chlamydia psittaci' (Page, 1968) was renamed #' # 'Chlamydophila psittaci' (Everett et al., 1999) #' # [1] "C. psittaci" #' diff --git a/R/mo.R b/R/mo.R index 666f64c7..fe7702f3 100644 --- a/R/mo.R +++ b/R/mo.R @@ -76,7 +76,7 @@ #' \item{\code{"D. spartina"}. This is the abbreviation of an old taxonomic name: \emph{Didymosphaeria spartinae} (the last "e" was missing from the input). This fungus was renamed to \emph{Leptosphaeria obiones}, so a warning will be thrown that this result (\code{F_LPTSP_OBI}) needs review.} #' } #' -#' @inheritSection itis ITIS +#' @inheritSection ITIS ITIS # (source as a section, so it can be inherited by other man pages) #' @section Source: #' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13} @@ -211,8 +211,16 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, reference_df[] <- lapply(reference_df, as.character) ) } - - if (all(x %in% microorganismsDT[["mo"]])) { + if (all(identical(trimws(x_input), "") | is.na(x_input))) { + # all empty + if (property == "mo") { + return(structure(rep(NA_character_, length(x_input)), class = "mo")) + } else if (property == "tsn") { + return(rep(NA_integer_, length(x_input))) + } else { + return(rep(NA_character_, length(x_input))) + } + } else if (all(x %in% microorganismsDT[["mo"]])) { # existing mo codes when not looking for property "mo", like mo_genus("B_ESCHR_COL") x <- microorganismsDT[data.table(mo = x), on = "mo", ..property][[1]] } else if (!is.null(reference_df) @@ -665,6 +673,16 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, } } + # (4) not yet implemented taxonomic changes in ITIS + found <- suppressMessages(suppressWarnings(exec_as.mo(temp_changes(b.x_trimmed), clear_options = FALSE, allow_uncertain = FALSE))) + if (!is.na(found)) { + found <- microorganismsDT[mo == found, ..property][[1]] + warning(red(paste0('UNCERTAIN - "', + a.x_backup, '" -> ', italic(microorganismsDT[mo == found[1L], fullname][[1]]), " (", found[1L], ")")), + call. = FALSE, immediate. = FALSE) + return(found[1L]) + } + # didn't found in uncertain results too return(NA_character_) } @@ -780,6 +798,10 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, x } +temp_changes <- function(x) { + x[x %like% 'Cutibacterium'] <- gsub('Cutibacterium', 'Propionibacterium', x[x %like% 'Cutibacterium']) +} + #' @importFrom crayon blue italic renamed_note <- function(name_old, name_new, ref_old = "", ref_new = "", mo = "") { if (!is.na(ref_old)) { diff --git a/R/mo_property.R b/R/mo_property.R index 3d0493c0..ae8bb176 100644 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -33,7 +33,7 @@ #' \item{\code{mo_ref("Chlamydophila psittaci")} will return \code{"Everett et al., 1999"} (without a warning)} #' } #' @inheritSection get_locale Supported languages -#' @inheritSection itis ITIS +#' @inheritSection ITIS ITIS #' @inheritSection as.mo Source #' @rdname mo_property #' @name mo_property @@ -480,6 +480,12 @@ mo_validate <- function(x, property, ...) { | Lancefield %in% c(TRUE, "all")) { exec_as.mo(x, property = property, ...) } else { - x + if (property == "mo") { + return(structure(x, class = "mo")) + } else if (property == "tsn") { + return(as.integer(x)) + } else { + return(x) + } } } diff --git a/_pkgdown.yml b/_pkgdown.yml index 76aa269a..b2197338 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -71,13 +71,13 @@ navbar: href: 'LICENSE-text.html' reference: -- title: Backround information +- title: 'Background information' desc: > Some pages about our package and its external sources. contents: - '`AMR`' - - '`itis`' -- title: Cleaning your data + - '`ITIS`' +- title: 'Cleaning your data' desc: > Functions for cleaning and optimising your data, to be able to add variables later on (like taxonomic properties) or to @@ -87,7 +87,7 @@ reference: - '`eucast_rules`' - '`guess_ab`' - '`read.4D`' -- title: Adding variables to your data +- title: 'Adding variables to your data' desc: > Functions to add new data to existing data, like the determination of first isolates, @@ -103,7 +103,7 @@ reference: - '`age_groups`' - '`p.symbol`' - '`join`' -- title: Analysing your data +- title: 'Analysing your data' desc: > Functions for conducting AMR analysis contents: @@ -116,7 +116,7 @@ reference: - '`resistance_predict`' - '`rsi`' - '`skewness`' -- title: Included data sets +- title: 'Included data sets' desc: > References for microorganisms and antibiotics, and even a genuine data set with isolates from septic patients. diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 8b3a9a1a..9e9b3092 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -171,6 +171,7 @@

How to conduct AMR analysis

Matthijs S. Berends

+

08 January 2019

@@ -179,7 +180,7 @@ -

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. However, the methodology remains unchanged. This page was generated on 04 January 2019.

+

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. However, the methodology remains unchanged. This page was generated on 08 January 2019.

Introduction

@@ -195,21 +196,21 @@ -2019-01-04 +2019-01-08 abcd Escherichia coli S S -2019-01-04 +2019-01-08 abcd Escherichia coli S R -2019-01-04 +2019-01-08 efgh Escherichia coli R @@ -223,9 +224,9 @@ Needed R packages

As with many uses in R, we need some additional packages for AMR analysis. The most important one is dplyr, which tremendously improves the way we work with data - it allows for a very natural way of writing syntaxes in R. Another important dependency is ggplot2. This package can be used to create beautiful plots in R.

Our AMR package depends on these packages and even extends their use and functions.

-
library(dplyr)   # the data science package
-library(AMR)     # this package, to simplify and automate AMR analysis
-library(ggplot2) # for appealing plots
+
library(dplyr)   # the data science package
+library(AMR)     # this package, to simplify and automate AMR analysis
+library(ggplot2) # for appealing plots

@@ -236,51 +237,51 @@

Patients

To start with patients, we need a unique list of patients.

-
patients <- unlist(lapply(LETTERS, paste0, 1:10))
+
patients <- unlist(lapply(LETTERS, paste0, 1:10))

The LETTERS object is available in R - it’s a vector with 26 characters: A to Z. The patients object we just created is now a vector of length 260, with values (patient IDs) varying from A1 to Z10. Now we we also set the gender of our patients, by putting the ID and the gender in a table:

-
patients_table <- data.frame(patient_id = patients,
-                             gender = c(rep("M", 135),
-                                        rep("F", 125)))
+
patients_table <- data.frame(patient_id = patients,
+                             gender = c(rep("M", 135),
+                                        rep("F", 125)))

The first 135 patient IDs are now male, the other 125 are female.

Dates

Let’s pretend that our data consists of blood cultures isolates from 1 January 2010 until 1 January 2018.

-
dates <- seq(as.Date("2010-01-01"), as.Date("2018-01-01"), by = "day")
+
dates <- seq(as.Date("2010-01-01"), as.Date("2018-01-01"), by = "day")

This dates object now contains all days in our date range.

Microorganisms

For this tutorial, we will uses four different microorganisms: Escherichia coli, Staphylococcus aureus, Streptococcus pneumoniae, and Klebsiella pneumoniae:

-
bacteria <- c("Escherichia coli", "Staphylococcus aureus",
-              "Streptococcus pneumoniae", "Klebsiella pneumoniae")
+
bacteria <- c("Escherichia coli", "Staphylococcus aureus",
+              "Streptococcus pneumoniae", "Klebsiella pneumoniae")

Other variables

For completeness, we can also add the hospital where the patients was admitted and we need to define valid antibmicrobial results for our randomisation:

-
hospitals <- c("Hospital A", "Hospital B", "Hospital C", "Hospital D")
-ab_interpretations <- c("S", "I", "R")
+
hospitals <- c("Hospital A", "Hospital B", "Hospital C", "Hospital D")
+ab_interpretations <- c("S", "I", "R")

Put everything together

-

Using the sample() 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 prob parameter.

-
data <- data.frame(date = sample(dates, 5000, replace = TRUE),
-                   patient_id = sample(patients, 5000, replace = TRUE),
-                   hospital = sample(hospitals, 5000, replace = TRUE, prob = c(0.30, 0.35, 0.15, 0.20)),
-                   bacteria = sample(bacteria, 5000, replace = TRUE, prob = c(0.50, 0.25, 0.15, 0.10)),
-                   amox = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.60, 0.05, 0.35)),
-                   amcl = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.75, 0.10, 0.15)),
-                   cipr = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.80, 0.00, 0.20)),
-                   gent = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.92, 0.00, 0.08))
-                   )
-

Using the left_join() function from the dplyr package, we can ‘map’ the gender to the patient ID using the patients_table object we created earlier:

-
data <- data %>% left_join(patients_table)
+

Using the sample() 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 prob parameter.

+
data <- data.frame(date = sample(dates, 5000, replace = TRUE),
+                   patient_id = sample(patients, 5000, replace = TRUE),
+                   hospital = sample(hospitals, 5000, replace = TRUE, prob = c(0.30, 0.35, 0.15, 0.20)),
+                   bacteria = sample(bacteria, 5000, replace = TRUE, prob = c(0.50, 0.25, 0.15, 0.10)),
+                   amox = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.60, 0.05, 0.35)),
+                   amcl = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.75, 0.10, 0.15)),
+                   cipr = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.80, 0.00, 0.20)),
+                   gent = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.92, 0.00, 0.08))
+                   )
+

Using the left_join() function from the dplyr package, we can ‘map’ the gender to the patient ID using the patients_table object we created earlier:

+
data <- data %>% left_join(patients_table)

The resulting data set contains 5,000 blood culture isolates. With the head() function we can preview the first 6 values of this data set:

-
head(data)
+
head(data)
@@ -295,71 +296,71 @@ ab_interpretations <- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
date2014-02-20D5Hospital AEscherichia coliRSSSM
2010-06-17N4Hospital AEscherichia coliSSRSM
2017-08-02A6Hospital BStaphylococcus aureusRIRSM
2012-11-25K7Hospital AEscherichia coliISSSM
2012-06-24G9Hospital BEscherichia coliRSSRM
2011-05-20T72011-02-27M6 Hospital C Escherichia coli S SRSM
2012-07-12C2Hospital BStreptococcus pneumoniaeSRSSM
2016-09-13O7Hospital AEscherichia coliRR S S F
2016-12-05E4Hospital AEscherichia coliISSSM
2017-10-05M1Hospital AEscherichia coliRIRSM
2012-02-22H9Hospital CStreptococcus pneumoniaeSSRSM

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

@@ -369,7 +370,7 @@ ab_interpretations <-
Cleaning the data

Use the frequency table function freq() to look specifically for unique values in any variable. For example, for the gender variable:

-
data %>% freq(gender) # this would be the same: freq(data$gender)
+
data %>% freq(gender) # this would be the same: freq(data$gender)
# Frequency table of `gender` 
 # Class:   factor (numeric)  
 # Levels:  F, M  
@@ -378,67 +379,67 @@ ab_interpretations <- mutate() function of the dplyr package makes this really easy:

-
data <- data %>%
-  mutate(bacteria = as.mo(bacteria))
-

We also want to transform the antibiotics, because in real life data we don’t know if they are really clean. The as.rsi() function ensures reliability and reproducibility in these kind of variables. The mutate_at() will run the as.rsi() function on defined variables:

-
data <- data %>%
-  mutate_at(vars(amox:gent), as.rsi)
+

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

+
data <- data %>%
+  mutate(bacteria = as.mo(bacteria))
+

We also want to transform the antibiotics, because in real life data we don’t know if they are really clean. The as.rsi() function ensures reliability and reproducibility in these kind of variables. The mutate_at() will run the as.rsi() function on defined variables:

+
data <- data %>%
+  mutate_at(vars(amox:gent), as.rsi)

Finally, we will apply EUCAST rules 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 eucast_rules() function can also apply additional rules, like forcing ampicillin = R when amoxicillin/clavulanic acid = R.

Because the amoxicillin (column amox) and amoxicillin/clavulanic acid (column amcl) in our data were generated randomly, some rows will undoubtedly contain amox = S and amcl = R, which is technically impossible. The eucast_rules() fixes this:

-
data <- eucast_rules(data, col_mo = "bacteria")
-# 
-# Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)
-# 
-# EUCAST Clinical Breakpoints (v8.1, 2018)
-# Enterobacteriales (Order) (no changes)
-# Staphylococcus (no changes)
-# Enterococcus (no changes)
-# Streptococcus groups A, B, C, G (no changes)
-# Streptococcus pneumoniae (no changes)
-# Viridans group streptococci (no changes)
-# Haemophilus influenzae (no changes)
-# Moraxella catarrhalis (no changes)
-# Anaerobic Gram positives (no changes)
-# Anaerobic Gram negatives (no changes)
-# Pasteurella multocida (no changes)
-# Campylobacter jejuni and C. coli (no changes)
-# Aerococcus sanguinicola and A. urinae (no changes)
-# Kingella kingae (no changes)
-# 
-# EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 1:  Intrinsic resistance in Enterobacteriaceae (332 changes)
-# Table 2:  Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)
-# Table 3:  Intrinsic resistance in other Gram-negative bacteria (no changes)
-# Table 4:  Intrinsic resistance in Gram-positive bacteria (658 changes)
-# Table 8:  Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)
-# Table 9:  Interpretive rules for B-lactam agents and Gram-negative rods (no changes)
-# Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria (no changes)
-# Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)
-# Table 12: Interpretive rules for aminoglycosides (no changes)
-# Table 13: Interpretive rules for quinolones (no changes)
-# 
-# Other rules
-# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (no changes)
-# Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no changes)
-# Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no changes)
-# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (no changes)
-# Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)
-# Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)
-# 
-# => EUCAST rules affected 1,828 out of 5,000 rows -> changed 990 test results.
+
data <- eucast_rules(data, col_mo = "bacteria")
+# 
+# Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)
+# 
+# EUCAST Clinical Breakpoints (v8.1, 2018)
+# Enterobacteriales (Order) (no changes)
+# Staphylococcus (no changes)
+# Enterococcus (no changes)
+# Streptococcus groups A, B, C, G (no changes)
+# Streptococcus pneumoniae (no changes)
+# Viridans group streptococci (no changes)
+# Haemophilus influenzae (no changes)
+# Moraxella catarrhalis (no changes)
+# Anaerobic Gram positives (no changes)
+# Anaerobic Gram negatives (no changes)
+# Pasteurella multocida (no changes)
+# Campylobacter jejuni and C. coli (no changes)
+# Aerococcus sanguinicola and A. urinae (no changes)
+# Kingella kingae (no changes)
+# 
+# EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
+# Table 1:  Intrinsic resistance in Enterobacteriaceae (349 changes)
+# Table 2:  Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)
+# Table 3:  Intrinsic resistance in other Gram-negative bacteria (no changes)
+# Table 4:  Intrinsic resistance in Gram-positive bacteria (694 changes)
+# Table 8:  Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)
+# Table 9:  Interpretive rules for B-lactam agents and Gram-negative rods (no changes)
+# Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria (no changes)
+# Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)
+# Table 12: Interpretive rules for aminoglycosides (no changes)
+# Table 13: Interpretive rules for quinolones (no changes)
+# 
+# Other rules
+# Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (no changes)
+# Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no changes)
+# Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no changes)
+# Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (no changes)
+# Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)
+# Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)
+# 
+# => EUCAST rules affected 1,854 out of 5,000 rows -> changed 1,043 test results.

Adding new variables

Now that we have the microbial ID, we can add some taxonomic properties:

-
data <- data %>% 
-  mutate(gramstain = mo_gramstain(bacteria),
-         genus = mo_genus(bacteria),
-         species = mo_species(bacteria))
+
data <- data %>% 
+  mutate(gramstain = mo_gramstain(bacteria),
+         genus = mo_genus(bacteria),
+         species = mo_species(bacteria))

First isolates

@@ -449,18 +450,18 @@ ab_interpretations <- M39-A4 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition. CLSI, 2014. Chapter 6.4

This AMR package includes this methodology with the first_isolate() 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:

-
data <- data %>% 
-  mutate(first = first_isolate(.))
-# NOTE: Using column `bacteria` as input for `col_mo`.
-# NOTE: Using column `date` as input for `col_date`.
-# NOTE: Using column `patient_id` as input for `col_patient_id`.
-# => Found 2,950 first isolates (59.0% of total)
-

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

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

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

+

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

-
data_1st <- data %>% 
-  filter_first_isolate()
+

@@ -481,21 +482,21 @@ ab_interpretations <- 1 -2010-05-26 -D5 +2010-01-31 +L4 B_ESCHR_COL R -R -R +S +S S TRUE 2 -2010-06-05 -D5 +2010-08-01 +L4 B_ESCHR_COL -S +R S S S @@ -503,74 +504,74 @@ ab_interpretations <- 3 -2010-09-13 -D5 +2010-12-29 +L4 B_ESCHR_COL +I S -S -S +R S FALSE 4 -2010-12-19 -D5 +2011-01-21 +L4 B_ESCHR_COL -S R +I S S FALSE 5 -2012-03-01 -D5 +2011-02-06 +L4 B_ESCHR_COL +I S R S -S TRUE 6 -2012-04-14 -D5 +2011-05-30 +L4 B_ESCHR_COL S -S -S -S -FALSE - - -7 -2013-01-04 -D5 -B_ESCHR_COL -S -S -S -S -FALSE - - -8 -2013-01-22 -D5 -B_ESCHR_COL -I I R S FALSE +7 +2011-08-16 +L4 +B_ESCHR_COL +S +S +R +R +FALSE + + +8 +2012-01-15 +L4 +B_ESCHR_COL +S +S +S +S +FALSE + + 9 -2013-03-20 -D5 +2014-07-16 +L4 B_ESCHR_COL S S @@ -580,34 +581,34 @@ ab_interpretations <- 10 -2013-09-13 -D5 +2014-09-19 +L4 B_ESCHR_COL S -S -S R +S +S FALSE

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 key_antibiotics() 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.

If a column exists with a name like ‘key(…)ab’ the first_isolate() function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:

-
data <- data %>% 
-  mutate(keyab = key_antibiotics(.)) %>% 
-  mutate(first_weighted = first_isolate(.))
-# NOTE: Using column `bacteria` as input for `col_mo`.
-#   amox   amcl   cipr   gent 
-# "amox" "amcl" "cipr" "gent" 
-# [1] "amox" "amcl" "cipr"
-#   amox   amcl   cipr   gent 
-# "amox" "amcl" "cipr" "gent"
-# NOTE: Using column `bacteria` as input for `col_mo`.
-# NOTE: Using column `date` as input for `col_date`.
-# NOTE: Using column `patient_id` as input for `col_patient_id`.
-# NOTE: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.
-# [Criterion] Inclusion based on key antibiotics, ignoring I.
-# => Found 4,430 first weighted isolates (88.6% of total)
+ @@ -624,47 +625,47 @@ ab_interpretations <- - - + + - - + + - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + - + @@ -672,56 +673,56 @@ ab_interpretations <- - - + + + - - - + + - - + + - + - - + + - - - + + + - - + + - - - + + + - - + + @@ -732,30 +733,31 @@ ab_interpretations <- - - + + - - + +
isolate12010-05-26D52010-01-31L4 B_ESCHR_COL RRRSS S TRUE TRUE
22010-06-05D52010-08-01L4 B_ESCHR_COLR S S SFALSEFALSE
32010-12-29L4B_ESCHR_COLISR S FALSE TRUE
32010-09-13D5B_ESCHR_COLSSSSFALSEFALSE
42010-12-19D52011-01-21L4 B_ESCHR_COLS RI S S FALSE52012-03-01D52011-02-06L4 B_ESCHR_COLI S R SS TRUE TRUE
62012-04-14D52011-05-30L4 B_ESCHR_COL SSSIR S FALSETRUEFALSE
72013-01-04D52011-08-16L4 B_ESCHR_COL S SSSFALSERR FALSETRUE
82013-01-22D52012-01-15L4 B_ESCHR_COLIIRSSS S FALSE TRUE
92013-03-20D52014-07-16L4 B_ESCHR_COL S S102013-09-13D52014-09-19L4 B_ESCHR_COL SSS RSS FALSE TRUE
-

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

+

Instead of 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.

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

-
data_1st <- data %>% 
-  filter_first_weighted_isolate()
-

So we end up with 4,430 isolates for analysis.

+ +

So we end up with 4,435 isolates for analysis.

We can remove unneeded columns:

-
data_1st <- data_1st %>% 
-  select(-c(first, keyab))
+

Now our data looks like:

-
head(data_1st)
+
head(data_1st)
+ @@ -772,87 +774,45 @@ ab_interpretations <- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -861,6 +821,54 @@ ab_interpretations <- coli + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
date patient_id hospital2014-02-20D5Hospital AB_ESCHR_COLRSSSMGram negativeEscherichiacoliTRUE
2010-06-17N4Hospital AB_ESCHR_COLSSRSMGram negativeEscherichiacoliTRUE
2017-08-02A6Hospital BB_STPHY_AURRIRSMGram positiveStaphylococcusaureusTRUE
2012-11-25K7Hospital AB_ESCHR_COLISSSMGram negativeEscherichiacoliTRUE
2012-06-24G9Hospital BB_ESCHR_COLRSSRMGram negativeEscherichiacoliTRUE
2011-05-20T712011-02-27M6 Hospital C B_ESCHR_COL S SRSMGram negativeEscherichiacoliTRUE
22012-07-12C2Hospital BB_STRPTC_PNESRSRMGram positiveStreptococcuspneumoniaeTRUE
32016-09-13O7Hospital AB_ESCHR_COLRR S S FTRUE
52017-10-05M1Hospital AB_ESCHR_COLRIRSMGram negativeEscherichiacoliTRUE
62012-02-22H9Hospital CB_STRPTC_PNESSRRMGram positiveStreptococcuspneumoniaeTRUE
72011-01-13S6Hospital DB_STPHY_AURISSSFGram positiveStaphylococcusaureusTRUE

Time for the analysis!

@@ -871,12 +879,12 @@ ab_interpretations <-
Analysing the data

You might want to start by getting an idea of how the data is distributed. It’s an important start, because it also decides how you will continue your analysis. ## Dispersion of species To just get an idea how the species are distributed, create a frequency table with our freq() function. We created the genus and species column earlier based on the microbial ID. With paste(), we can concatenate them together.

The freq() function can be used like the base R language was intended:

-
freq(paste(data_1st$genus, data_1st$species))
+
freq(paste(data_1st$genus, data_1st$species))

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

-
data_1st %>% freq(genus, species)
+
data_1st %>% freq(genus, species)

Frequency table of genus and species
Columns: 2
-Length: 4,430 (of which NA: 0 = 0.00%)
+Length: 4,435 (of which NA: 0 = 0.00%)
Unique: 4

Shortest: 16
Longest: 24

@@ -893,33 +901,33 @@ Longest: 24

1 Escherichia coli -2,206 -49.8% -2,206 -49.8% +2,203 +49.7% +2,203 +49.7% 2 Staphylococcus aureus -1,093 -24.7% -3,299 -74.5% +1,072 +24.2% +3,275 +73.8% 3 Streptococcus pneumoniae -667 -15.1% -3,966 -89.5% +689 +15.5% +3,964 +89.4% 4 Klebsiella pneumoniae -464 -10.5% -4,430 +471 +10.6% +4,435 100.0% @@ -928,12 +936,12 @@ Longest: 24

Resistance percentages

The functions portion_R, portion_RI, portion_I, portion_IS and portion_S can be used to determine the portion of a specific antimicrobial outcome. They can be used on their own:

-
data_1st %>% portion_IR(amox)
-# [1] 0.46614
-

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

-
data_1st %>% 
-  group_by(hospital) %>% 
-  summarise(amoxicillin = portion_IR(amox))
+ +

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

+
data_1st %>% 
+  group_by(hospital) %>% 
+  summarise(amoxicillin = portion_IR(amox))
@@ -942,27 +950,27 @@ Longest: 24

- + - + - + - +
hospital
Hospital A0.46058730.4504164
Hospital B0.46242770.4782034
Hospital C0.48538010.4670571
Hospital D0.46592180.4471101
-

Of course it would be very convenient to know the number of isolates responsible for the percentages. For that purpose the n_rsi() can be used, which works exactly like n_distinct() from the dplyr package. It counts all isolates available for every group (i.e. values S, I or R):

-
data_1st %>% 
-  group_by(hospital) %>% 
-  summarise(amoxicillin = portion_IR(amox),
-            available = n_rsi(amox))
+

Of course it would be very convenient to know the number of isolates responsible for the percentages. For that purpose the n_rsi() can be used, which works exactly like n_distinct() from the dplyr package. It counts all isolates available for every group (i.e. values S, I or R):

+
data_1st %>% 
+  group_by(hospital) %>% 
+  summarise(amoxicillin = portion_IR(amox),
+            available = n_rsi(amox))
@@ -972,32 +980,32 @@ Longest: 24

- - + + - - + + - - + + - - + +
hospital
Hospital A0.460587312940.45041641321
Hospital B0.462427715570.47820341514
Hospital C0.48538016840.4670571683
Hospital D0.46592188950.4471101917

These functions can also be used to get the portion of multiple antibiotics, to calculate co-resistance very easily:

-
data_1st %>% 
-  group_by(genus) %>% 
-  summarise(amoxicillin = portion_S(amcl),
-            gentamicin = portion_S(gent),
-            "amox + gent" = portion_S(amcl, gent))
+
data_1st %>% 
+  group_by(genus) %>% 
+  summarise(amoxicillin = portion_S(amcl),
+            gentamicin = portion_S(gent),
+            "amox + gent" = portion_S(amcl, gent))
@@ -1008,94 +1016,94 @@ Longest: 24

- - - + + + - - - + + + - - - + + + - + - +
genus
Escherichia0.73073440.91205800.97824120.71629600.90512940.9786655
Klebsiella0.75215520.91810340.98060340.74946920.91295120.9766454
Staphylococcus0.74199450.92680700.97987190.73414180.92444030.9776119
Streptococcus0.72563720.7576197 0.00000000.72563720.7576197

To make a transition to the next part, let’s see how this difference could be plotted:

-
data_1st %>% 
-  group_by(genus) %>% 
-  summarise("1. Amoxicillin" = portion_S(amcl),
-            "2. Gentamicin" = portion_S(gent),
-            "3. Amox + gent" = portion_S(amcl, gent)) %>% 
-  tidyr::gather("Antibiotic", "S", -genus) %>%
-  ggplot(aes(x = genus,
-             y = S,
-             fill = Antibiotic)) +
-  geom_col(position = "dodge2")
+
data_1st %>% 
+  group_by(genus) %>% 
+  summarise("1. Amoxicillin" = portion_S(amcl),
+            "2. Gentamicin" = portion_S(gent),
+            "3. Amox + gent" = portion_S(amcl, gent)) %>% 
+  tidyr::gather("Antibiotic", "S", -genus) %>%
+  ggplot(aes(x = genus,
+             y = S,
+             fill = Antibiotic)) +
+  geom_col(position = "dodge2")

Plots

To show results in plots, most R users would nowadays use the ggplot2 package. This package lets you create plots in layers. You can read more about it on their website. A quick example would look like these syntaxes:

-
ggplot(data = a_data_set,
-       mapping = aes(x = year,
-                     y = value)) +
-  geom_col() +
-  labs(title = "A title",
-       subtitle = "A subtitle",
-       x = "My X axis",
-       y = "My Y axis")
-
-ggplot(a_data_set,
-       aes(year, value) +
-  geom_bar()
+
ggplot(data = a_data_set,
+       mapping = aes(x = year,
+                     y = value)) +
+  geom_col() +
+  labs(title = "A title",
+       subtitle = "A subtitle",
+       x = "My X axis",
+       y = "My Y axis")
+
+ggplot(a_data_set,
+       aes(year, value) +
+  geom_bar()

The AMR package contains functions to extend this ggplot2 package, for example geom_rsi(). It automatically transforms data with count_df() or portion_df() and show results in stacked bars. Its simplest and shortest example:

-
ggplot(data_1st) +
-  geom_rsi(translate_ab = FALSE)
+
ggplot(data_1st) +
+  geom_rsi(translate_ab = FALSE)

Omit the translate_ab = FALSE to have the antibiotic codes (amox, amcl, cipr, gent) translated to official WHO names (amoxicillin, amoxicillin and betalactamase inhibitor, ciprofloxacin, gentamicin).

If we group on e.g. the genus column and add some additional functions from our package, we can create this:

-
# group the data on `genus`
-ggplot(data_1st %>% group_by(genus)) + 
-  # create bars with genus on x axis
-  # it looks for variables with class `rsi`,
-  # of which we have 4 (earlier created with `as.rsi`)
-  geom_rsi(x = "genus") + 
-  # split plots on antibiotic
-  facet_rsi(facet = "Antibiotic") +
-  # make R red, I yellow and S green
-  scale_rsi_colours() +
-  # show percentages on y axis
-  scale_y_percent(breaks = 0:4 * 25) +
-  # turn 90 degrees, make it bars instead of columns
-  coord_flip() +
-  # add labels
-  labs(title = "Resistance per genus and antibiotic", 
-       subtitle = "(this is fake data)") +
-  # and print genus in italic to follow our convention
-  # (is now y axis because we turned the plot)
-  theme(axis.text.y = element_text(face = "italic"))
+

To simplify this, we also created the ggplot_rsi() function, which combines almost all above functions:

-
data_1st %>% 
-  group_by(genus) %>%
-  ggplot_rsi(x = "genus",
-             facet = "Antibiotic",
-             breaks = 0:4 * 25,
-             datalabels = FALSE) +
-  coord_flip()
+

@@ -1123,26 +1131,26 @@ Longest: 24

We can transform the data and apply the test in only a couple of lines:

-
septic_patients %>%
-  filter(hospital_id %in% c("A", "D")) %>% # filter on only hospitals A and D
-  select(hospital_id, fosf) %>%            # select the hospitals and fosfomycin
-  group_by(hospital_id) %>%                # group on the hospitals
-  count_df(combine_IR = TRUE) %>%          # count all isolates per group (hospital_id)
-  tidyr::spread(hospital_id, Value) %>%    # transform output so A and D are columns
-  select(A, D) %>%                         # and select these only
-  as.matrix() %>%                          # transform to good old matrix for fisher.test()
-  fisher.test()                            # do Fisher's Exact Test
-# 
-#   Fisher's Exact Test for Count Data
-# 
-# data:  .
-# p-value = 0.03104
-# alternative hypothesis: true odds ratio is not equal to 1
-# 95 percent confidence interval:
-#  1.054283 4.735995
-# sample estimates:
-# odds ratio 
-#   2.228006
+
septic_patients %>%
+  filter(hospital_id %in% c("A", "D")) %>% # filter on only hospitals A and D
+  select(hospital_id, fosf) %>%            # select the hospitals and fosfomycin
+  group_by(hospital_id) %>%                # group on the hospitals
+  count_df(combine_IR = TRUE) %>%          # count all isolates per group (hospital_id)
+  tidyr::spread(hospital_id, Value) %>%    # transform output so A and D are columns
+  select(A, D) %>%                         # and select these only
+  as.matrix() %>%                          # transform to good old matrix for fisher.test()
+  fisher.test()                            # do Fisher's Exact Test
+# 
+#   Fisher's Exact Test for Count Data
+# 
+# data:  .
+# p-value = 0.03104
+# alternative hypothesis: true odds ratio is not equal to 1
+# 95 percent confidence interval:
+#  1.054283 4.735995
+# sample estimates:
+# odds ratio 
+#   2.228006

As can be seen, the p value is 0.03, which means that the fosfomycin resistances found in hospital A and D are really different.

diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png index 6d329cc5..f9b2d55e 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png index 6a313374..265ee49b 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png index 5ba457e2..eecd78d2 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png index 0b8e3508..882d3802 100644 Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ diff --git a/docs/articles/EUCAST.html b/docs/articles/EUCAST.html index 7eb4e985..4f91ef91 100644 --- a/docs/articles/EUCAST.html +++ b/docs/articles/EUCAST.html @@ -171,6 +171,7 @@

How to apply EUCAST rules

Matthijs S. Berends

+

08 January 2019

@@ -186,7 +187,7 @@

EUCAST expert rules are a tabulated collection of expert knowledge on intrinsic resistances, exceptional resistance phenotypes and interpretive rules that may be applied to antimicrobial susceptibility testing in order to reduce errors and make appropriate recommendations for reporting particular resistances.

-

In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the eucast_rules() function we use for this purpose can also apply additional rules, like forcing ampicillin = R in isolates when amoxicillin/clavulanic acid = R.

+

In Europe, a lot of medical microbiological laboratories already apply these rules (Brown et al., 2015). Our package features their latest insights on intrinsic resistance and exceptional phenotypes (version 9.0, 2019). Moreover, the eucast_rules() function we use for this purpose can also apply additional rules, like forcing ampicillin = R in isolates when amoxicillin/clavulanic acid = R.

(more will be available soon)

diff --git a/docs/articles/G_test.html b/docs/articles/G_test.html index 012e7f17..184ca5e6 100644 --- a/docs/articles/G_test.html +++ b/docs/articles/G_test.html @@ -171,6 +171,7 @@

How to use the G-test

Matthijs S. Berends

+

08 January 2019

@@ -179,7 +180,7 @@ -

(will be available soon - in the meanwhile, please read about this G-test in the manual)

+

(will be available soon - in the meanwhile, please read about this G-test in the manual)

@@ -688,8 +689,8 @@ Median: 31 July 2009 (47.39%)

Parameter na.rm

With the na.rm parameter (defaults to TRUE, but they will always be shown into the header), you can include NA values in the frequency table:

-
septic_patients %>%
-  freq(amox, na.rm = FALSE)
+
septic_patients %>%
+  freq(amox, na.rm = FALSE)

Frequency table of amox

@@ -741,8 +742,8 @@ Median: 31 July 2009 (47.39%)

Parameter row.names

The default frequency tables shows row indices. To remove them, use row.names = FALSE:

-
septic_patients %>%
-  freq(hospital_id, row.names = FALSE)
+
septic_patients %>%
+  freq(hospital_id, row.names = FALSE)

Frequency table of hospital_id

@@ -789,8 +790,8 @@ Median: 31 July 2009 (47.39%)

Parameter markdown

The markdown parameter is TRUE at default in non-interactive sessions, like in reports created with R Markdown. This will always print all rows, unless nmax is set.

-
septic_patients %>%
-  freq(hospital_id, markdown = TRUE)
+
septic_patients %>%
+  freq(hospital_id, markdown = TRUE)

Frequency table of hospital_id

diff --git a/docs/articles/mo_property.html b/docs/articles/mo_property.html index 46b7a24d..4d794a18 100644 --- a/docs/articles/mo_property.html +++ b/docs/articles/mo_property.html @@ -171,6 +171,7 @@

How to get properties of a microorganism

Matthijs S. Berends

+

08 January 2019

diff --git a/docs/extra.css b/docs/extra.css index 7cc9e8c6..df38f6b5 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -59,7 +59,7 @@ a pre[href], a pre[href]:hover, a pre[href]:focus { /* syntax font */ pre, code { - font-family: 'Courier New'; + font-family: 'Courier New', monospace; font-size: 100% !important; font-weight: bold; background-color: transparent; @@ -102,6 +102,15 @@ help { display: none; } +/* Date of vignettes */ +.template-article .date:before { + content: 'Last updated: '; +} +.template-article .date { + font-size: 14px; + padding-top: 40px; +} + /* more space between icon and text in top menu */ #navbar .fa, #navbar .fab, diff --git a/docs/extra.js b/docs/extra.js index 2268acc2..ca621c42 100644 --- a/docs/extra.js +++ b/docs/extra.js @@ -38,3 +38,5 @@ $( document ).ready(function() { // Edit title of manual $('.template-reference-index h1').text('Manual'); }); + +$('head').append(""); diff --git a/docs/index.html b/docs/index.html index 77395554..b5501c45 100644 --- a/docs/index.html +++ b/docs/index.html @@ -215,7 +215,7 @@

Get this package

This package is available on the official R network (CRAN). Install this package in R with:

-
install.packages("AMR")
+
install.packages("AMR")

It will be downloaded and installed automatically.

@@ -231,17 +231,17 @@

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.

The 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:
  2. -
+
  • +

    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.mo() to get an ID of a microorganism. The IDs are human readable for the trained eye - the ID of Klebsiella pneumoniae is “B_KLBSL_PNE” (B stands for Bacteria) and the ID of S. aureus is “B_STPHY_AUR”. 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, it uses Artificial Intelligence to look up values in the included ITIS data, consisting of more than 18,000 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.
    -
      -
    1. It enhances existing data and adds new data from data sets included in this package.
    2. -
    +
  • +
  • +

    It enhances existing data and adds new data from data sets included in this package.

    • Use eucast_rules() to apply EUCAST expert rules to isolates.
    • Use first_isolate() to identify the first isolates of every patient using guidelines from the CLSI (Clinical and Laboratory Standards Institute). @@ -253,9 +253,9 @@
    • The data set microorganisms contains the complete taxonomic tree of more than 18,000 microorganisms (bacteria, fungi/yeasts and protozoa). Furthermore, the colloquial name and Gram stain are available, which 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(), mo_gramstain() or even mo_phylum(). As they use as.mo() internally, they also use artificial intelligence. For example, mo_genus("MRSA") and mo_genus("S. aureus") will both return "Staphylococcus". They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. 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_name() and ab_tradenames() to look up values. The ab_* functions use as.atc() internally so they support AI to guess your expected result. For example, ab_name("Fluclox"), ab_name("Floxapen") and ab_name("J01CF05") will all return "Flucloxacillin". These functions can again be used to add new variables to your data.
    -
      -
    1. It analyses the data with convenient functions that use well-known methods.
    2. -
    +
  • +
  • +

    It analyses the data with convenient functions that use well-known methods.

    -
      -
    1. It teaches the user how to use all the above actions.
    2. -
    +
  • +
  • +

    It teaches the user how to use all the above actions.

    • The package contains extensive help pages with many examples.
    • It also contains an example data set called septic_patients. This data set contains: @@ -276,6 +276,8 @@
  • + +

    diff --git a/docs/news/index.html b/docs/news/index.html index 84f0a3e9..87fcccc4 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -222,27 +222,48 @@

    Changed

    @@ -482,15 +590,21 @@ New

    + +
  • Determining bacterial ID: +
    • New functions as.bactid and is.bactid to transform/ look up microbial ID’s.
    • The existing function guess_bactid is now an alias of as.bactid
    • New Becker classification for Staphylococcus to categorise them into Coagulase Negative Staphylococci (CoNS) and Coagulase Positve Staphylococci (CoPS)
    • New Lancefield classification for Streptococcus to categorise them into Lancefield groups
    • +
    +
  • For convience, new descriptive statistical functions kurtosis and skewness that are lacking in base R - they are generic functions and have support for vectors, data.frames and matrices
  • Function g.test to perform the Χ2 distributed G-test, which use is the same as chisq.test
  • -
  • Function ratio to transform a vector of values to a preset ratio
  • +
  • +Function ratio to transform a vector of values to a preset ratio + +
  • Support for Addins menu in RStudio to quickly insert %in% or %like% (and give them keyboard shortcuts), or to view the datasets that come with this package
  • Function p.symbol to transform p values to their related symbols: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  • Functions clipboard_import and clipboard_export as helper functions to quickly copy and paste from/to software like Excel and SPSS. These functions use the clipr package, but are a little altered to also support headless Linux servers (so you can use it in RStudio Server)
  • -
  • New for frequency tables (function freq):
  • +
  • New for frequency tables (function freq): +
    • A vignette to explain its usage
    • Support for rsi (antimicrobial resistance) to use as input
    • Support for table to use as input: freq(table(x, y)) @@ -531,6 +655,8 @@
    • Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)
    • Possibility to globally set the default for the amount of items to print, with options(max.print.freq = n) where n is your preset value
    +
  • +

    @@ -552,21 +678,27 @@
  • Small improvements to the microorganisms dataset (especially for Salmonella) and the column bactid now has the new class "bactid"
  • -
  • Combined MIC/RSI values will now be coerced by the rsi and mic functions:
  • +
  • Combined MIC/RSI values will now be coerced by the rsi and mic functions: + +
  • Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002") now works
  • Classes rsi and mic do not add the attribute package.version anymore
  • Added "groups" option for atc_property(..., property). It will return a vector of the ATC hierarchy as defined by the WHO. The new function atc_groups is a convenient wrapper around this.
  • Build-in host check for atc_property as it requires the host set by url to be responsive
  • Improved first_isolate algorithm to exclude isolates where bacteria ID or genus is unavailable
  • Fix for warning hybrid evaluation forced for row_number (924b62) from the dplyr package v0.7.5 and above
  • -
  • Support for empty values and for 1 or 2 columns as input for guess_bactid (now called as.bactid)
  • +
  • Support for empty values and for 1 or 2 columns as input for guess_bactid (now called as.bactid) +
    • So yourdata %>% select(genus, species) %>% as.bactid() now also works
    • +
    +
  • Other small fixes
  • @@ -574,11 +706,14 @@

    Other

    @@ -597,10 +732,13 @@
  • Function guess_bactid to determine the ID of a microorganism based on genus/species or known abbreviations like MRSA
  • Function guess_atc to determine the ATC of an antibiotic based on name, trade name, or known abbreviations
  • Function freq to create frequency tables, with additional info in a header
  • -
  • Function MDRO to determine Multi Drug Resistant Organisms (MDRO) with support for country-specific guidelines.
  • +
  • Function MDRO to determine Multi Drug Resistant Organisms (MDRO) with support for country-specific guidelines. + +
  • New algorithm to determine weighted isolates, can now be "points" or "keyantibiotics", see ?first_isolate
  • New print format for tibbles and data.tables
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index e1a0a6f2..1f121089 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,4 +1,4 @@ -pandoc: 1.17.2 +pandoc: 2.3.1 pkgdown: 1.3.0 pkgdown_sha: ~ articles: diff --git a/docs/reference/ITIS.html b/docs/reference/ITIS.html new file mode 100644 index 00000000..67f4bc3b --- /dev/null +++ b/docs/reference/ITIS.html @@ -0,0 +1,316 @@ + + + + + + + + +ITIS: Integrated Taxonomic Information System — ITIS • AMR (for R) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    All taxonomic names of all microorganisms are included in this package, using the authoritative Integrated Taxonomic Information System (ITIS).

    + +
    + + +

    ITIS

    + + +


    +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 [3].

    + +

    Read more on our website!

    + + +


    +On our website https://msberends.gitlab.io/AMR you can find a omprehensive tutorial about how to conduct AMR analysis and find the complete documentation of all functions, which reads a lot easier than in R.

    + + +

    Examples

    +
    # NOT RUN {
    +# Get a note when a species was renamed
    +mo_shortname("Chlamydia psittaci")
    +# Note: 'Chlamydia psittaci' (Page, 1968) was renamed
    +#       'Chlamydophila psittaci' (Everett et al., 1999)
    +# [1] "C. psittaci"
    +
    +# Get any property from the entire taxonomic tree for all included species
    +mo_class("E. coli")
    +# [1] "Gammaproteobacteria"
    +
    +mo_family("E. coli")
    +# [1] "Enterobacteriaceae"
    +
    +mo_subkingdom("E. coli")
    +# [1] "Negibacteria"
    +
    +mo_gramstain("E. coli") # based on subkingdom
    +# [1] "Gram negative"
    +
    +mo_ref("E. coli")
    +# [1] "Castellani and Chalmers, 1919"
    +
    +# Do not get mistaken - the package only includes microorganisms
    +mo_phylum("C. elegans")
    +# [1] "Cyanobacteria"                   # Bacteria?!
    +mo_fullname("C. elegans")
    +# [1] "Chroococcus limneticus elegans"  # Because a microorganism was found
    +# }
    +
    + +
    + + +
    + + + + + + + + + diff --git a/docs/reference/age_groups.html b/docs/reference/age_groups.html index 922d77e8..2e31aa90 100644 --- a/docs/reference/age_groups.html +++ b/docs/reference/age_groups.html @@ -289,11 +289,11 @@ On our website https://msberends.gitla # resistance of ciprofloxacine per age group library(dplyr) septic_patients%>% - mutate(first_isolate=first_isolate(.)) %>% - filter(first_isolate==TRUE, + mutate(first_isolate=first_isolate(.)) %>% + filter(first_isolate==TRUE, mo==as.mo("E. coli")) %>% - group_by(age_group=age_groups(age)) %>% - select(age_group, + group_by(age_group=age_groups(age)) %>% + select(age_group, cipr) %>%ggplot_rsi(x="age_group") # } diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 762487df..8ae4d697 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -270,11 +270,11 @@ On our website https://msberends.gitla # using dplyr's mutate library(dplyr) septic_patients%>% - mutate_at(vars(peni:rifa), as.rsi) + mutate_at(vars(peni:rifa), as.rsi) # fastest way to transform all columns with already valid AB results to class `rsi`:septic_patients%>% - mutate_if(is.rsi.eligible, + mutate_if(is.rsi.eligible, as.rsi) # } diff --git a/docs/reference/count.html b/docs/reference/count.html index 6f1c7218..be6540b8 100644 --- a/docs/reference/count.html +++ b/docs/reference/count.html @@ -217,7 +217,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
    -

    These functions can be used to count resistant/susceptible microbial isolates. All functions support quasiquotation with pipes, can be used in dplyrs summarise and support grouped variables, see Examples.

    +

    These functions can be used to count resistant/susceptible microbial isolates. All functions support quasiquotation with pipes, can be used in dplyrs summarise and support grouped variables, see Examples.

    count_R and count_IR can be used to count resistant isolates, count_S and count_SI can be used to count susceptible isolates.

    @@ -275,7 +275,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_

    Details

    These functions are meant to count isolates. Use the portion_* functions to calculate microbial resistance.

    -

    n_rsi is an alias of count_all. 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 n_distinct. Their function is equal to count_S(...) + count_IR(...).

    +

    n_rsi is an alias of count_all. 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 n_distinct. Their function is equal to count_S(...) + count_IR(...).

    count_df takes any variable from data that has an "rsi" class (created with as.rsi) and counts the amounts of R, I and S. The resulting tidy data (see Source) data.frame will have three rows (S/I/R) and a column for each variable with class "rsi".

    Read more on our website!

    @@ -314,13 +314,13 @@ On our website https://msberends.gitla library(dplyr) septic_patients%>% - group_by(hospital_id) %>% - summarise(R=count_R(cipr), + group_by(hospital_id) %>% + summarise(R=count_R(cipr), I=count_I(cipr), S=count_S(cipr), n1=count_all(cipr), # the actual total; sum of all threen2=n_rsi(cipr), # same - analogous to n_distinct - total=n()) # NOT the amount of tested isolates! + total=n()) # NOT the amount of tested isolates!# Count co-resistance between amoxicillin/clav acid and gentamicin,# so we can see that combination therapy does a lot more than mono therapy. @@ -338,13 +338,13 @@ On our website https://msberends.gitla # Get portions S/I/R immediately of all rsi columns septic_patients %>% - select(amox, cipr) %>% + select(amox, cipr) %>%count_df(translate=FALSE) # It also supports grouping variablesseptic_patients%>% - select(hospital_id, amox, cipr) %>% - group_by(hospital_id) %>% + select(hospital_id, amox, cipr) %>% + group_by(hospital_id) %>%count_df(translate=FALSE) # } diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index bd93a4fd..1d287876 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -289,8 +289,8 @@ https://doi.org/10.1111/j.1469-0691.2011.03703.x

  • EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes Tables. Version 3.1, 2016.
    http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf

  • -
  • EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 8.1, 2018.
    - http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_8.1_Breakpoint_Tables.xlsx

  • +
  • EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 9.0, 2019.
    + http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_9.0_Breakpoint_Tables.xlsx

  • Value

    @@ -302,68 +302,68 @@

    To define antibiotics column names, leave as it is to determine it automatically with guess_ab or input a text (case-insensitive) or use NULL to skip a column (e.g. tica = NULL). Non-existing columns will anyway be skipped with a warning.

    Abbrevations of the column containing antibiotics in the form: abbreviation: generic name (ATC code)

    -

    amcl: amoxicillin+clavulanic acid (J01CR02), - amik: amikacin (J01GB06), - amox: amoxicillin (J01CA04), - ampi: ampicillin (J01CA01), - azit: azithromycin (J01FA10), - azlo: azlocillin (J01CA09), - aztr: aztreonam (J01DF01), - cefa: cefaloridine (J01DB02), - cfep: cefepime (J01DE01), - cfot: cefotaxime (J01DD01), - cfox: cefoxitin (J01DC01), - cfra: cefradine (J01DB09), - cfta: ceftazidime (J01DD02), - cftr: ceftriaxone (J01DD04), - cfur: cefuroxime (J01DC02), - chlo: chloramphenicol (J01BA01), - cipr: ciprofloxacin (J01MA02), - clar: clarithromycin (J01FA09), - clin: clindamycin (J01FF01), - clox: flucloxacillin (J01CF05), - coli: colistin (J01XB01), - czol: cefazolin (J01DB04), - dapt: daptomycin (J01XX09), - doxy: doxycycline (J01AA02), - erta: ertapenem (J01DH03), - eryt: erythromycin (J01FA01), - fosf: fosfomycin (J01XX01), - fusi: fusidic acid (J01XC01), - gent: gentamicin (J01GB03), - imip: imipenem (J01DH51), - kana: kanamycin (J01GB04), - levo: levofloxacin (J01MA12), - linc: lincomycin (J01FF02), - line: linezolid (J01XX08), - mero: meropenem (J01DH02), - mezl: mezlocillin (J01CA10), - mino: minocycline (J01AA08), - moxi: moxifloxacin (J01MA14), - nali: nalidixic acid (J01MB02), - neom: neomycin (J01GB05), - neti: netilmicin (J01GB07), - nitr: nitrofurantoin (J01XE01), - norf: norfloxacin (J01MA06), - novo: novobiocin (an ATCvet code: QJ01XX95), - oflo: ofloxacin (J01MA01), - peni: penicillin (J01RA01), - pipe: piperacillin (J01CA12), - pita: piperacillin+tazobactam (J01CR05), - poly: polymyxin B (J01XB02), - pris: pristinamycin (J01FG01), - qida: quinupristin/dalfopristin (J01FG02), - rifa: rifampicin (J04AB02), - roxi: roxithromycin (J01FA06), - siso: sisomicin (J01GB08), - teic: teicoplanin (J01XA02), - tetr: tetracycline (J01AA07), - tica: ticarcillin (J01CA13), - tige: tigecycline (J01AA12), - tobr: tobramycin (J01GB01), - trim: trimethoprim (J01EA01), - trsu: sulfamethoxazole and trimethoprim (J01EE01), - vanc: vancomycin (J01XA01).

    +

    amcl: amoxicillin+clavulanic acid (J01CR02), + amik: amikacin (J01GB06), + amox: amoxicillin (J01CA04), + ampi: ampicillin (J01CA01), + azit: azithromycin (J01FA10), + azlo: azlocillin (J01CA09), + aztr: aztreonam (J01DF01), + cefa: cefaloridine (J01DB02), + cfep: cefepime (J01DE01), + cfot: cefotaxime (J01DD01), + cfox: cefoxitin (J01DC01), + cfra: cefradine (J01DB09), + cfta: ceftazidime (J01DD02), + cftr: ceftriaxone (J01DD04), + cfur: cefuroxime (J01DC02), + chlo: chloramphenicol (J01BA01), + cipr: ciprofloxacin (J01MA02), + clar: clarithromycin (J01FA09), + clin: clindamycin (J01FF01), + clox: flucloxacillin (J01CF05), + coli: colistin (J01XB01), + czol: cefazolin (J01DB04), + dapt: daptomycin (J01XX09), + doxy: doxycycline (J01AA02), + erta: ertapenem (J01DH03), + eryt: erythromycin (J01FA01), + fosf: fosfomycin (J01XX01), + fusi: fusidic acid (J01XC01), + gent: gentamicin (J01GB03), + imip: imipenem (J01DH51), + kana: kanamycin (J01GB04), + levo: levofloxacin (J01MA12), + linc: lincomycin (J01FF02), + line: linezolid (J01XX08), + mero: meropenem (J01DH02), + mezl: mezlocillin (J01CA10), + mino: minocycline (J01AA08), + moxi: moxifloxacin (J01MA14), + nali: nalidixic acid (J01MB02), + neom: neomycin (J01GB05), + neti: netilmicin (J01GB07), + nitr: nitrofurantoin (J01XE01), + norf: norfloxacin (J01MA06), + novo: novobiocin (an ATCvet code: QJ01XX95), + oflo: ofloxacin (J01MA01), + peni: (benzyl)penicillin (J01CE01), + pipe: piperacillin (J01CA12), + pita: piperacillin+tazobactam (J01CR05), + poly: polymyxin B (J01XB02), + pris: pristinamycin (J01FG01), + qida: quinupristin/dalfopristin (J01FG02), + rifa: rifampicin (J04AB02), + roxi: roxithromycin (J01FA06), + siso: sisomicin (J01GB08), + teic: teicoplanin (J01XA02), + tetr: tetracycline (J01AA07), + tica: ticarcillin (J01CA13), + tige: tigecycline (J01AA12), + tobr: tobramycin (J01GB01), + trim: trimethoprim (J01EA01), + trsu: sulfamethoxazole and trimethoprim (J01EE01), + vanc: vancomycin (J01XA01).

    Read more on our website!

    diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index 503cd2cc..64174a59 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -361,11 +361,11 @@ On our website https://msberends.gitla library(dplyr) # Filter on first isolates:septic_patients%>% - mutate(first_isolate=first_isolate(., + mutate(first_isolate=first_isolate(., col_date="date", col_patient_id="patient_id", col_mo="mo")) %>% - filter(first_isolate==TRUE) + filter(first_isolate==TRUE) # Which can be shortened to:septic_patients%>% @@ -376,14 +376,14 @@ On our website https://msberends.gitla # Now let's see if first isolates matter: A <- septic_patients %>% - group_by(hospital_id) %>% - summarise(count=n_rsi(gent), # gentamicin availability + group_by(hospital_id) %>% + summarise(count=n_rsi(gent), # gentamicin availabilityresistance=portion_IR(gent)) # gentamicin resistanceB<-septic_patients%>%filter_first_weighted_isolate() %>%# the 1st isolate filter - group_by(hospital_id) %>% - summarise(count=n_rsi(gent), # gentamicin availability + group_by(hospital_id) %>% + summarise(count=n_rsi(gent), # gentamicin availabilityresistance=portion_IR(gent)) # gentamicin resistance# Have a look at A and B. diff --git a/docs/reference/freq.html b/docs/reference/freq.html index ef11ba9f..cec7b99f 100644 --- a/docs/reference/freq.html +++ b/docs/reference/freq.html @@ -354,7 +354,7 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co
  • Median, using median, with percentage since oldest

  • In factors, all factor levels that are not existing in the input data will be dropped.

    -

    The function top_freq uses top_n internally and will include more than n rows if there are ties.

    +

    The function top_freq uses top_n internally and will include more than n rows if there are ties.

    Read more on our website!

    @@ -378,34 +378,34 @@ On our website https://msberends.gitla # you could also use `select` or `pull` to get your variables septic_patients %>% - filter(hospital_id=="A") %>% - select(mo) %>% + filter(hospital_id=="A") %>% + select(mo) %>%freq() # multiple selected variables will be pasted togetherseptic_patients%>%left_join_microorganisms%>% - filter(hospital_id=="A") %>% + filter(hospital_id=="A") %>%freq(genus, species) # group a variable and analyse anotherseptic_patients%>% - group_by(hospital_id) %>% + group_by(hospital_id) %>%freq(gender) # get top 10 bugs of hospital A as a vectorseptic_patients%>% - filter(hospital_id=="A") %>% + filter(hospital_id=="A") %>%freq(mo) %>%top_freq(10) # save frequency table to an objectyears<-septic_patients%>% - mutate(year=format(date, "%Y")) %>% + mutate(year=format(date, "%Y")) %>%freq(year) @@ -456,11 +456,11 @@ On our website https://msberends.gitla # only get selected columns septic_patients %>% freq(hospital_id) %>% - select(item, percent) + select(item, percent) septic_patients%>%freq(hospital_id) %>% - select(-count, -cum_count) + select(-count, -cum_count) # check differences between frequency tables diff --git a/docs/reference/ggplot_rsi.html b/docs/reference/ggplot_rsi.html index 217298c8..3c78957e 100644 --- a/docs/reference/ggplot_rsi.html +++ b/docs/reference/ggplot_rsi.html @@ -327,7 +327,7 @@ On our website https://msberends.gitla library(ggplot2) # get antimicrobial results for drugs against a UTI: -ggplot(septic_patients%>%select(amox, nitr, fosf, trim, cipr)) + +ggplot(septic_patients%>%select(amox, nitr, fosf, trim, cipr)) + geom_rsi() # prettify the plot using some additional functions: @@ -341,17 +341,17 @@ On our website https://msberends.gitla # or better yet, simplify this using the wrapper function - a single command: septic_patients %>% - select(amox, nitr, fosf, trim, cipr) %>% + select(amox, nitr, fosf, trim, cipr) %>%ggplot_rsi() # get only portions and no counts:septic_patients%>% - select(amox, nitr, fosf, trim, cipr) %>% + select(amox, nitr, fosf, trim, cipr) %>%ggplot_rsi(fun=portion_df) # add other ggplot2 parameters as you like:septic_patients%>% - select(amox, nitr, fosf, trim, cipr) %>% + select(amox, nitr, fosf, trim, cipr) %>%ggplot_rsi(width=0.5, colour="black", size=1, @@ -360,25 +360,25 @@ On our website https://msberends.gitla # resistance of ciprofloxacine per age group septic_patients %>% - mutate(first_isolate=first_isolate(.)) %>% - filter(first_isolate==TRUE, + mutate(first_isolate=first_isolate(.)) %>% + filter(first_isolate==TRUE, mo==as.mo("E. coli")) %>%# `age_group` is also a function of this package: - group_by(age_group=age_groups(age)) %>% - select(age_group, + group_by(age_group=age_groups(age)) %>% + select(age_group, cipr) %>%ggplot_rsi(x="age_group") # }# NOT RUN {# for colourblind mode, use divergent colours from the viridis package:septic_patients%>% - select(amox, nitr, fosf, trim, cipr) %>% + select(amox, nitr, fosf, trim, cipr) %>%ggplot_rsi() + scale_fill_viridis_d() # it also supports groups (don't forget to use the group var on `x` or `facet`):septic_patients%>% - select(hospital_id, amox, nitr, fosf, trim, cipr) %>% - group_by(hospital_id) %>% + select(hospital_id, amox, nitr, fosf, trim, cipr) %>% + group_by(hospital_id) %>%ggplot_rsi(x=hospital_id, facet=Antibiotic, nrow=1) + @@ -388,22 +388,22 @@ On our website https://msberends.gitla # 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(mo=as.mo(mo, Becker=TRUE)) %>% + mutate(mo=as.mo(mo, Becker=TRUE)) %>%# filter on top three bacterial ID's - filter(mo%in%top_freq(freq(.$mo), 3)) %>% + filter(mo%in%top_freq(freq(.$mo), 3)) %>%# determine first isolates - mutate(first_isolate=first_isolate(., + mutate(first_isolate=first_isolate(., col_date="date", col_patient_id="patient_id", col_mo="mo")) %>%# filter on first isolates - filter(first_isolate==TRUE) %>% + filter(first_isolate==TRUE) %>%# get short MO names (like "E. coli") - mutate(mo=mo_shortname(mo, Becker=TRUE)) %>% + mutate(mo=mo_shortname(mo, Becker=TRUE)) %>%# select this short name and some antiseptic drugs - select(mo, cfur, gent, cipr) %>% + select(mo, cfur, gent, cipr) %>%# group by MO - group_by(mo) %>% + group_by(mo) %>%# plot the thing, putting MOs on the facetggplot_rsi(x=Antibiotic, facet=mo, diff --git a/docs/reference/index.html b/docs/reference/index.html index 750abadb..c298ed40 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -221,7 +221,7 @@ @@ -234,7 +234,7 @@ @@ -513,7 +513,7 @@ - +
    -

    Backround information

    +

    Background information

    Some pages about our package and its external sources.

    -

    itis

    +

    ITIS

    ITIS: Integrated Taxonomic Information System

    ...

    other parameters to pass on to dplyr::join.

    other parameters to pass on to dplyr::join.

    Details

    -

    Note: As opposed to the join functions of dplyr, characters vectors are supported and at default existing columns will get a suffix "2" and the newly joined columns will not get a suffix. See join for more information.

    +

    Note: As opposed to the join functions of dplyr, characters vectors are supported and at default existing columns will get a suffix "2" and the newly joined columns will not get a suffix. See join for more information.

    Read more on our website!

    diff --git a/docs/reference/like.html b/docs/reference/like.html index 9037d65d..1f77b2de 100644 --- a/docs/reference/like.html +++ b/docs/reference/like.html @@ -288,7 +288,7 @@ On our website https://msberends.gitla library(dplyr) septic_patients %>% left_join_microorganisms() %>% - filter(genus %like% '^ent') %>% + filter(genus %like% '^ent') %>% freq(genus, species) # }
    diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index 7506fcce..fbc8c601 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -526,68 +526,68 @@

    To define antibiotics column names, leave as it is to determine it automatically with guess_ab or input a text (case-insensitive) or use NULL to skip a column (e.g. tica = NULL). Non-existing columns will anyway be skipped with a warning.

    Abbrevations of the column containing antibiotics in the form: abbreviation: generic name (ATC code)

    -

    amcl: amoxicillin+clavulanic acid (J01CR02), - amik: amikacin (J01GB06), - amox: amoxicillin (J01CA04), - ampi: ampicillin (J01CA01), - azit: azithromycin (J01FA10), - azlo: azlocillin (J01CA09), - aztr: aztreonam (J01DF01), - cefa: cefaloridine (J01DB02), - cfep: cefepime (J01DE01), - cfot: cefotaxime (J01DD01), - cfox: cefoxitin (J01DC01), - cfra: cefradine (J01DB09), - cfta: ceftazidime (J01DD02), - cftr: ceftriaxone (J01DD04), - cfur: cefuroxime (J01DC02), - chlo: chloramphenicol (J01BA01), - cipr: ciprofloxacin (J01MA02), - clar: clarithromycin (J01FA09), - clin: clindamycin (J01FF01), - clox: flucloxacillin (J01CF05), - coli: colistin (J01XB01), - czol: cefazolin (J01DB04), - dapt: daptomycin (J01XX09), - doxy: doxycycline (J01AA02), - erta: ertapenem (J01DH03), - eryt: erythromycin (J01FA01), - fosf: fosfomycin (J01XX01), - fusi: fusidic acid (J01XC01), - gent: gentamicin (J01GB03), - imip: imipenem (J01DH51), - kana: kanamycin (J01GB04), - levo: levofloxacin (J01MA12), - linc: lincomycin (J01FF02), - line: linezolid (J01XX08), - mero: meropenem (J01DH02), - mezl: mezlocillin (J01CA10), - mino: minocycline (J01AA08), - moxi: moxifloxacin (J01MA14), - nali: nalidixic acid (J01MB02), - neom: neomycin (J01GB05), - neti: netilmicin (J01GB07), - nitr: nitrofurantoin (J01XE01), - norf: norfloxacin (J01MA06), - novo: novobiocin (an ATCvet code: QJ01XX95), - oflo: ofloxacin (J01MA01), - peni: penicillin (J01RA01), - pipe: piperacillin (J01CA12), - pita: piperacillin+tazobactam (J01CR05), - poly: polymyxin B (J01XB02), - pris: pristinamycin (J01FG01), - qida: quinupristin/dalfopristin (J01FG02), - rifa: rifampicin (J04AB02), - roxi: roxithromycin (J01FA06), - siso: sisomicin (J01GB08), - teic: teicoplanin (J01XA02), - tetr: tetracycline (J01AA07), - tica: ticarcillin (J01CA13), - tige: tigecycline (J01AA12), - tobr: tobramycin (J01GB01), - trim: trimethoprim (J01EA01), - trsu: sulfamethoxazole and trimethoprim (J01EE01), - vanc: vancomycin (J01XA01).

    +

    amcl: amoxicillin+clavulanic acid (J01CR02), + amik: amikacin (J01GB06), + amox: amoxicillin (J01CA04), + ampi: ampicillin (J01CA01), + azit: azithromycin (J01FA10), + azlo: azlocillin (J01CA09), + aztr: aztreonam (J01DF01), + cefa: cefaloridine (J01DB02), + cfep: cefepime (J01DE01), + cfot: cefotaxime (J01DD01), + cfox: cefoxitin (J01DC01), + cfra: cefradine (J01DB09), + cfta: ceftazidime (J01DD02), + cftr: ceftriaxone (J01DD04), + cfur: cefuroxime (J01DC02), + chlo: chloramphenicol (J01BA01), + cipr: ciprofloxacin (J01MA02), + clar: clarithromycin (J01FA09), + clin: clindamycin (J01FF01), + clox: flucloxacillin (J01CF05), + coli: colistin (J01XB01), + czol: cefazolin (J01DB04), + dapt: daptomycin (J01XX09), + doxy: doxycycline (J01AA02), + erta: ertapenem (J01DH03), + eryt: erythromycin (J01FA01), + fosf: fosfomycin (J01XX01), + fusi: fusidic acid (J01XC01), + gent: gentamicin (J01GB03), + imip: imipenem (J01DH51), + kana: kanamycin (J01GB04), + levo: levofloxacin (J01MA12), + linc: lincomycin (J01FF02), + line: linezolid (J01XX08), + mero: meropenem (J01DH02), + mezl: mezlocillin (J01CA10), + mino: minocycline (J01AA08), + moxi: moxifloxacin (J01MA14), + nali: nalidixic acid (J01MB02), + neom: neomycin (J01GB05), + neti: netilmicin (J01GB07), + nitr: nitrofurantoin (J01XE01), + norf: norfloxacin (J01MA06), + novo: novobiocin (an ATCvet code: QJ01XX95), + oflo: ofloxacin (J01MA01), + peni: (benzyl)penicillin (J01CE01), + pipe: piperacillin (J01CA12), + pita: piperacillin+tazobactam (J01CR05), + poly: polymyxin B (J01XB02), + pris: pristinamycin (J01FG01), + qida: quinupristin/dalfopristin (J01FG02), + rifa: rifampicin (J04AB02), + roxi: roxithromycin (J01FA06), + siso: sisomicin (J01GB08), + teic: teicoplanin (J01XA02), + tetr: tetracycline (J01AA07), + tica: ticarcillin (J01CA13), + tige: tigecycline (J01AA12), + tobr: tobramycin (J01GB01), + trim: trimethoprim (J01EA01), + trsu: sulfamethoxazole and trimethoprim (J01EE01), + vanc: vancomycin (J01XA01).

    Read more on our website!

    diff --git a/docs/reference/microorganisms.certe.html b/docs/reference/microorganisms.certe.html index 9962f58c..ef184a02 100644 --- a/docs/reference/microorganisms.certe.html +++ b/docs/reference/microorganisms.certe.html @@ -216,7 +216,7 @@
    -

    A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from microorganisms$mo (using left_join_microorganisms). GLIMS codes can also be translated to valid MOs with guess_mo.

    +

    A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from microorganisms$mo (using left_join_microorganisms). GLIMS codes can also be translated to valid MOs with guess_mo.

    diff --git a/docs/reference/microorganisms.umcg.html b/docs/reference/microorganisms.umcg.html index b0c49dd4..ba61c085 100644 --- a/docs/reference/microorganisms.umcg.html +++ b/docs/reference/microorganisms.umcg.html @@ -216,7 +216,7 @@
    -

    A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from microorganisms$mo (using left_join_microorganisms). GLIMS codes can also be translated to valid MOs with guess_mo.

    +

    A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from microorganisms$mo (using left_join_microorganisms). GLIMS codes can also be translated to valid MOs with guess_mo.

    diff --git a/docs/reference/portion.html b/docs/reference/portion.html index f86ad334..44896e60 100644 --- a/docs/reference/portion.html +++ b/docs/reference/portion.html @@ -217,7 +217,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
    -

    These functions can be used to calculate the (co-)resistance of microbial isolates (i.e. percentage S, SI, I, IR or R). All functions support quasiquotation with pipes, can be used in dplyrs summarise and support grouped variables, see Examples.

    +

    These functions can be used to calculate the (co-)resistance of microbial isolates (i.e. percentage S, SI, I, IR or R). All functions support quasiquotation with pipes, can be used in dplyrs summarise and support grouped variables, see Examples.

    portion_R and portion_IR can be used to calculate resistance, portion_S and portion_SI can be used to calculate susceptibility.

    @@ -333,17 +333,17 @@ On our website https://msberends.gitla septic_patients %>% portion_SI(amox) septic_patients %>% - group_by(hospital_id) %>% - summarise(p = portion_S(cipr), + group_by(hospital_id) %>% + summarise(p = portion_S(cipr), n = n_rsi(cipr)) # n_rsi works like n_distinct in dplyr septic_patients %>% - group_by(hospital_id) %>% - summarise(R = portion_R(cipr, as_percent = TRUE), + group_by(hospital_id) %>% + summarise(R = portion_R(cipr, as_percent = TRUE), I = portion_I(cipr, as_percent = TRUE), S = portion_S(cipr, as_percent = TRUE), n = n_rsi(cipr), # works like n_distinct in dplyr - total = n()) # NOT the amount of tested isolates! + total = n()) # NOT the amount of tested isolates! # Calculate co-resistance between amoxicillin/clav acid and gentamicin, # so we can see that combination therapy does a lot more than mono therapy: @@ -358,8 +358,8 @@ On our website https://msberends.gitla septic_patients %>% - group_by(hospital_id) %>% - summarise(cipro_p = portion_S(cipr, as_percent = TRUE), + group_by(hospital_id) %>% + summarise(cipro_p = portion_S(cipr, as_percent = TRUE), cipro_n = count_all(cipr), genta_p = portion_S(gent, as_percent = TRUE), genta_n = count_all(gent), @@ -368,22 +368,22 @@ On our website https://msberends.gitla # Get portions S/I/R immediately of all rsi columns septic_patients %>% - select(amox, cipr) %>% + select(amox, cipr) %>% portion_df(translate = FALSE) # It also supports grouping variables septic_patients %>% - select(hospital_id, amox, cipr) %>% - group_by(hospital_id) %>% + select(hospital_id, amox, cipr) %>% + group_by(hospital_id) %>% portion_df(translate = FALSE) # }# NOT RUN { # calculate current empiric combination therapy of Helicobacter gastritis: my_table %>% - filter(first_isolate == TRUE, + filter(first_isolate == TRUE, genus == "Helicobacter") %>% - summarise(p = portion_S(amox, metr), # amoxicillin with metronidazole + summarise(p = portion_S(amox, metr), # amoxicillin with metronidazole n = count_all(amox, metr)) # } diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html index 57407280..2d789bbe 100644 --- a/docs/reference/resistance_predict.html +++ b/docs/reference/resistance_predict.html @@ -311,7 +311,7 @@ On our website https://msberends.gitla # or use dplyr so you can actually read it: library(dplyr) tbl %>% - filter(first_isolate == TRUE, + filter(first_isolate == TRUE, genus == "Haemophilus") %>% resistance_predict(amcl, date) # }# NOT RUN { @@ -322,9 +322,9 @@ On our website https://msberends.gitla # get bacteria properties like genus and species left_join_microorganisms("mo") %>% # calculate first isolates - mutate(first_isolate = first_isolate(.)) %>% + mutate(first_isolate = first_isolate(.)) %>% # filter on first E. coli isolates - filter(genus == "Escherichia", + filter(genus == "Escherichia", species == "coli", first_isolate == TRUE) %>% # predict resistance of cefotaxime for next years @@ -338,7 +338,7 @@ On our website https://msberends.gitla if (!require(ggplot2)) { data <- septic_patients %>% - filter(mo == as.mo("E. coli")) %>% + filter(mo == as.mo("E. coli")) %>% resistance_predict(col_ab = "amox", col_date = "date", info = FALSE, diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 6aec9f24..430b986c 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -9,6 +9,9 @@ https://msberends.gitlab.io/AMR/reference/AMR.html + + https://msberends.gitlab.io/AMR/reference/ITIS.html + https://msberends.gitlab.io/AMR/reference/ab_property.html @@ -63,9 +66,6 @@ https://msberends.gitlab.io/AMR/reference/guess_ab.html - - https://msberends.gitlab.io/AMR/reference/itis.html - https://msberends.gitlab.io/AMR/reference/join.html diff --git a/man/itis.Rd b/man/ITIS.Rd similarity index 96% rename from man/itis.Rd rename to man/ITIS.Rd index 15aa9e06..2b859cba 100644 --- a/man/itis.Rd +++ b/man/ITIS.Rd @@ -1,7 +1,7 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/itis.R -\name{itis} -\alias{itis} +\name{ITIS} +\alias{ITIS} \title{ITIS: Integrated Taxonomic Information System} \description{ All taxonomic names of all microorganisms are included in this package, using the authoritative Integrated Taxonomic Information System (ITIS). @@ -25,7 +25,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// \examples{ # Get a note when a species was renamed mo_shortname("Chlamydia psittaci") -# Note: 'Chlamydia psittaci' (Page, 1968) was renamed +# Note: 'Chlamydia psittaci' (Page, 1968) was renamed # 'Chlamydophila psittaci' (Everett et al., 1999) # [1] "C. psittaci" diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index 33d13699..7e1e319f 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -17,8 +17,8 @@ \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf} } \item{ - EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 8.1, 2018. \cr - \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_8.1_Breakpoint_Tables.xlsx} + EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 9.0, 2019. \cr + \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_9.0_Breakpoint_Tables.xlsx} } } } @@ -78,68 +78,68 @@ To define antibiotics column names, leave as it is to determine it automatically Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code}) - \strong{amcl}: amoxicillin+clavulanic acid (\emph{J01CR02}), - \strong{amik}: amikacin (\emph{J01GB06}), - \strong{amox}: amoxicillin (\emph{J01CA04}), - \strong{ampi}: ampicillin (\emph{J01CA01}), - \strong{azit}: azithromycin (\emph{J01FA10}), - \strong{azlo}: azlocillin (\emph{J01CA09}), - \strong{aztr}: aztreonam (\emph{J01DF01}), - \strong{cefa}: cefaloridine (\emph{J01DB02}), - \strong{cfep}: cefepime (\emph{J01DE01}), - \strong{cfot}: cefotaxime (\emph{J01DD01}), - \strong{cfox}: cefoxitin (\emph{J01DC01}), - \strong{cfra}: cefradine (\emph{J01DB09}), - \strong{cfta}: ceftazidime (\emph{J01DD02}), - \strong{cftr}: ceftriaxone (\emph{J01DD04}), - \strong{cfur}: cefuroxime (\emph{J01DC02}), - \strong{chlo}: chloramphenicol (\emph{J01BA01}), - \strong{cipr}: ciprofloxacin (\emph{J01MA02}), - \strong{clar}: clarithromycin (\emph{J01FA09}), - \strong{clin}: clindamycin (\emph{J01FF01}), - \strong{clox}: flucloxacillin (\emph{J01CF05}), - \strong{coli}: colistin (\emph{J01XB01}), - \strong{czol}: cefazolin (\emph{J01DB04}), - \strong{dapt}: daptomycin (\emph{J01XX09}), - \strong{doxy}: doxycycline (\emph{J01AA02}), - \strong{erta}: ertapenem (\emph{J01DH03}), - \strong{eryt}: erythromycin (\emph{J01FA01}), - \strong{fosf}: fosfomycin (\emph{J01XX01}), - \strong{fusi}: fusidic acid (\emph{J01XC01}), - \strong{gent}: gentamicin (\emph{J01GB03}), - \strong{imip}: imipenem (\emph{J01DH51}), - \strong{kana}: kanamycin (\emph{J01GB04}), - \strong{levo}: levofloxacin (\emph{J01MA12}), - \strong{linc}: lincomycin (\emph{J01FF02}), - \strong{line}: linezolid (\emph{J01XX08}), - \strong{mero}: meropenem (\emph{J01DH02}), - \strong{mezl}: mezlocillin (\emph{J01CA10}), - \strong{mino}: minocycline (\emph{J01AA08}), - \strong{moxi}: moxifloxacin (\emph{J01MA14}), - \strong{nali}: nalidixic acid (\emph{J01MB02}), - \strong{neom}: neomycin (\emph{J01GB05}), - \strong{neti}: netilmicin (\emph{J01GB07}), - \strong{nitr}: nitrofurantoin (\emph{J01XE01}), - \strong{norf}: norfloxacin (\emph{J01MA06}), - \strong{novo}: novobiocin (an ATCvet code: \emph{QJ01XX95}), - \strong{oflo}: ofloxacin (\emph{J01MA01}), - \strong{peni}: penicillin (\emph{J01RA01}), - \strong{pipe}: piperacillin (\emph{J01CA12}), - \strong{pita}: piperacillin+tazobactam (\emph{J01CR05}), - \strong{poly}: polymyxin B (\emph{J01XB02}), - \strong{pris}: pristinamycin (\emph{J01FG01}), - \strong{qida}: quinupristin/dalfopristin (\emph{J01FG02}), - \strong{rifa}: rifampicin (\emph{J04AB02}), - \strong{roxi}: roxithromycin (\emph{J01FA06}), - \strong{siso}: sisomicin (\emph{J01GB08}), - \strong{teic}: teicoplanin (\emph{J01XA02}), - \strong{tetr}: tetracycline (\emph{J01AA07}), - \strong{tica}: ticarcillin (\emph{J01CA13}), - \strong{tige}: tigecycline (\emph{J01AA12}), - \strong{tobr}: tobramycin (\emph{J01GB01}), - \strong{trim}: trimethoprim (\emph{J01EA01}), - \strong{trsu}: sulfamethoxazole and trimethoprim (\emph{J01EE01}), - \strong{vanc}: vancomycin (\emph{J01XA01}). + \strong{amcl}: amoxicillin+clavulanic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR02}{J01CR02}), + \strong{amik}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}), + \strong{amox}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}), + \strong{ampi}: ampicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA01}{J01CA01}), + \strong{azit}: azithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA10}{J01FA10}), + \strong{azlo}: azlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA09}{J01CA09}), + \strong{aztr}: aztreonam (\href{https://www.whocc.no/atc_ddd_index/?code=J01DF01}{J01DF01}), + \strong{cefa}: cefaloridine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB02}{J01DB02}), + \strong{cfep}: cefepime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DE01}{J01DE01}), + \strong{cfot}: cefotaxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD01}{J01DD01}), + \strong{cfox}: cefoxitin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC01}{J01DC01}), + \strong{cfra}: cefradine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB09}{J01DB09}), + \strong{cfta}: ceftazidime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD02}{J01DD02}), + \strong{cftr}: ceftriaxone (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD04}{J01DD04}), + \strong{cfur}: cefuroxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC02}{J01DC02}), + \strong{chlo}: chloramphenicol (\href{https://www.whocc.no/atc_ddd_index/?code=J01BA01}{J01BA01}), + \strong{cipr}: ciprofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA02}{J01MA02}), + \strong{clar}: clarithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA09}{J01FA09}), + \strong{clin}: clindamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF01}{J01FF01}), + \strong{clox}: flucloxacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CF05}{J01CF05}), + \strong{coli}: colistin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB01}{J01XB01}), + \strong{czol}: cefazolin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB04}{J01DB04}), + \strong{dapt}: daptomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX09}{J01XX09}), + \strong{doxy}: doxycycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA02}{J01AA02}), + \strong{erta}: ertapenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH03}{J01DH03}), + \strong{eryt}: erythromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA01}{J01FA01}), + \strong{fosf}: fosfomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX01}{J01XX01}), + \strong{fusi}: fusidic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XC01}{J01XC01}), + \strong{gent}: gentamicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB03}{J01GB03}), + \strong{imip}: imipenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH51}{J01DH51}), + \strong{kana}: kanamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB04}{J01GB04}), + \strong{levo}: levofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA12}{J01MA12}), + \strong{linc}: lincomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF02}{J01FF02}), + \strong{line}: linezolid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX08}{J01XX08}), + \strong{mero}: meropenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH02}{J01DH02}), + \strong{mezl}: mezlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA10}{J01CA10}), + \strong{mino}: minocycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA08}{J01AA08}), + \strong{moxi}: moxifloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA14}{J01MA14}), + \strong{nali}: nalidixic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01MB02}{J01MB02}), + \strong{neom}: neomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB05}{J01GB05}), + \strong{neti}: netilmicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB07}{J01GB07}), + \strong{nitr}: nitrofurantoin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XE01}{J01XE01}), + \strong{norf}: norfloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA06}{J01MA06}), + \strong{novo}: novobiocin (an ATCvet code: \href{https://www.whocc.no/atc_ddd_index/?code=QJ01XX95}{QJ01XX95}), + \strong{oflo}: ofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA01}{J01MA01}), + \strong{peni}: (benzyl)penicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CE01}{J01CE01}), + \strong{pipe}: piperacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA12}{J01CA12}), + \strong{pita}: piperacillin+tazobactam (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR05}{J01CR05}), + \strong{poly}: polymyxin B (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB02}{J01XB02}), + \strong{pris}: pristinamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG01}{J01FG01}), + \strong{qida}: quinupristin/dalfopristin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG02}{J01FG02}), + \strong{rifa}: rifampicin (\href{https://www.whocc.no/atc_ddd_index/?code=J04AB02}{J04AB02}), + \strong{roxi}: roxithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA06}{J01FA06}), + \strong{siso}: sisomicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB08}{J01GB08}), + \strong{teic}: teicoplanin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA02}{J01XA02}), + \strong{tetr}: tetracycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA07}{J01AA07}), + \strong{tica}: ticarcillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA13}{J01CA13}), + \strong{tige}: tigecycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA12}{J01AA12}), + \strong{tobr}: tobramycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB01}{J01GB01}), + \strong{trim}: trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EA01}{J01EA01}), + \strong{trsu}: sulfamethoxazole and trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EE01}{J01EE01}), + \strong{vanc}: vancomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA01}{J01XA01}). } \section{Read more on our website!}{ diff --git a/man/mdro.Rd b/man/mdro.Rd index a0915e83..04efb7d4 100644 --- a/man/mdro.Rd +++ b/man/mdro.Rd @@ -181,68 +181,68 @@ To define antibiotics column names, leave as it is to determine it automatically Abbrevations of the column containing antibiotics in the form: \strong{abbreviation}: generic name (\emph{ATC code}) - \strong{amcl}: amoxicillin+clavulanic acid (\emph{J01CR02}), - \strong{amik}: amikacin (\emph{J01GB06}), - \strong{amox}: amoxicillin (\emph{J01CA04}), - \strong{ampi}: ampicillin (\emph{J01CA01}), - \strong{azit}: azithromycin (\emph{J01FA10}), - \strong{azlo}: azlocillin (\emph{J01CA09}), - \strong{aztr}: aztreonam (\emph{J01DF01}), - \strong{cefa}: cefaloridine (\emph{J01DB02}), - \strong{cfep}: cefepime (\emph{J01DE01}), - \strong{cfot}: cefotaxime (\emph{J01DD01}), - \strong{cfox}: cefoxitin (\emph{J01DC01}), - \strong{cfra}: cefradine (\emph{J01DB09}), - \strong{cfta}: ceftazidime (\emph{J01DD02}), - \strong{cftr}: ceftriaxone (\emph{J01DD04}), - \strong{cfur}: cefuroxime (\emph{J01DC02}), - \strong{chlo}: chloramphenicol (\emph{J01BA01}), - \strong{cipr}: ciprofloxacin (\emph{J01MA02}), - \strong{clar}: clarithromycin (\emph{J01FA09}), - \strong{clin}: clindamycin (\emph{J01FF01}), - \strong{clox}: flucloxacillin (\emph{J01CF05}), - \strong{coli}: colistin (\emph{J01XB01}), - \strong{czol}: cefazolin (\emph{J01DB04}), - \strong{dapt}: daptomycin (\emph{J01XX09}), - \strong{doxy}: doxycycline (\emph{J01AA02}), - \strong{erta}: ertapenem (\emph{J01DH03}), - \strong{eryt}: erythromycin (\emph{J01FA01}), - \strong{fosf}: fosfomycin (\emph{J01XX01}), - \strong{fusi}: fusidic acid (\emph{J01XC01}), - \strong{gent}: gentamicin (\emph{J01GB03}), - \strong{imip}: imipenem (\emph{J01DH51}), - \strong{kana}: kanamycin (\emph{J01GB04}), - \strong{levo}: levofloxacin (\emph{J01MA12}), - \strong{linc}: lincomycin (\emph{J01FF02}), - \strong{line}: linezolid (\emph{J01XX08}), - \strong{mero}: meropenem (\emph{J01DH02}), - \strong{mezl}: mezlocillin (\emph{J01CA10}), - \strong{mino}: minocycline (\emph{J01AA08}), - \strong{moxi}: moxifloxacin (\emph{J01MA14}), - \strong{nali}: nalidixic acid (\emph{J01MB02}), - \strong{neom}: neomycin (\emph{J01GB05}), - \strong{neti}: netilmicin (\emph{J01GB07}), - \strong{nitr}: nitrofurantoin (\emph{J01XE01}), - \strong{norf}: norfloxacin (\emph{J01MA06}), - \strong{novo}: novobiocin (an ATCvet code: \emph{QJ01XX95}), - \strong{oflo}: ofloxacin (\emph{J01MA01}), - \strong{peni}: penicillin (\emph{J01RA01}), - \strong{pipe}: piperacillin (\emph{J01CA12}), - \strong{pita}: piperacillin+tazobactam (\emph{J01CR05}), - \strong{poly}: polymyxin B (\emph{J01XB02}), - \strong{pris}: pristinamycin (\emph{J01FG01}), - \strong{qida}: quinupristin/dalfopristin (\emph{J01FG02}), - \strong{rifa}: rifampicin (\emph{J04AB02}), - \strong{roxi}: roxithromycin (\emph{J01FA06}), - \strong{siso}: sisomicin (\emph{J01GB08}), - \strong{teic}: teicoplanin (\emph{J01XA02}), - \strong{tetr}: tetracycline (\emph{J01AA07}), - \strong{tica}: ticarcillin (\emph{J01CA13}), - \strong{tige}: tigecycline (\emph{J01AA12}), - \strong{tobr}: tobramycin (\emph{J01GB01}), - \strong{trim}: trimethoprim (\emph{J01EA01}), - \strong{trsu}: sulfamethoxazole and trimethoprim (\emph{J01EE01}), - \strong{vanc}: vancomycin (\emph{J01XA01}). + \strong{amcl}: amoxicillin+clavulanic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR02}{J01CR02}), + \strong{amik}: amikacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB06}{J01GB06}), + \strong{amox}: amoxicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA04}{J01CA04}), + \strong{ampi}: ampicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA01}{J01CA01}), + \strong{azit}: azithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA10}{J01FA10}), + \strong{azlo}: azlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA09}{J01CA09}), + \strong{aztr}: aztreonam (\href{https://www.whocc.no/atc_ddd_index/?code=J01DF01}{J01DF01}), + \strong{cefa}: cefaloridine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB02}{J01DB02}), + \strong{cfep}: cefepime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DE01}{J01DE01}), + \strong{cfot}: cefotaxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD01}{J01DD01}), + \strong{cfox}: cefoxitin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC01}{J01DC01}), + \strong{cfra}: cefradine (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB09}{J01DB09}), + \strong{cfta}: ceftazidime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD02}{J01DD02}), + \strong{cftr}: ceftriaxone (\href{https://www.whocc.no/atc_ddd_index/?code=J01DD04}{J01DD04}), + \strong{cfur}: cefuroxime (\href{https://www.whocc.no/atc_ddd_index/?code=J01DC02}{J01DC02}), + \strong{chlo}: chloramphenicol (\href{https://www.whocc.no/atc_ddd_index/?code=J01BA01}{J01BA01}), + \strong{cipr}: ciprofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA02}{J01MA02}), + \strong{clar}: clarithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA09}{J01FA09}), + \strong{clin}: clindamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF01}{J01FF01}), + \strong{clox}: flucloxacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CF05}{J01CF05}), + \strong{coli}: colistin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB01}{J01XB01}), + \strong{czol}: cefazolin (\href{https://www.whocc.no/atc_ddd_index/?code=J01DB04}{J01DB04}), + \strong{dapt}: daptomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX09}{J01XX09}), + \strong{doxy}: doxycycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA02}{J01AA02}), + \strong{erta}: ertapenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH03}{J01DH03}), + \strong{eryt}: erythromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA01}{J01FA01}), + \strong{fosf}: fosfomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX01}{J01XX01}), + \strong{fusi}: fusidic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XC01}{J01XC01}), + \strong{gent}: gentamicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB03}{J01GB03}), + \strong{imip}: imipenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH51}{J01DH51}), + \strong{kana}: kanamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB04}{J01GB04}), + \strong{levo}: levofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA12}{J01MA12}), + \strong{linc}: lincomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FF02}{J01FF02}), + \strong{line}: linezolid (\href{https://www.whocc.no/atc_ddd_index/?code=J01XX08}{J01XX08}), + \strong{mero}: meropenem (\href{https://www.whocc.no/atc_ddd_index/?code=J01DH02}{J01DH02}), + \strong{mezl}: mezlocillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA10}{J01CA10}), + \strong{mino}: minocycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA08}{J01AA08}), + \strong{moxi}: moxifloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA14}{J01MA14}), + \strong{nali}: nalidixic acid (\href{https://www.whocc.no/atc_ddd_index/?code=J01MB02}{J01MB02}), + \strong{neom}: neomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB05}{J01GB05}), + \strong{neti}: netilmicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB07}{J01GB07}), + \strong{nitr}: nitrofurantoin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XE01}{J01XE01}), + \strong{norf}: norfloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA06}{J01MA06}), + \strong{novo}: novobiocin (an ATCvet code: \href{https://www.whocc.no/atc_ddd_index/?code=QJ01XX95}{QJ01XX95}), + \strong{oflo}: ofloxacin (\href{https://www.whocc.no/atc_ddd_index/?code=J01MA01}{J01MA01}), + \strong{peni}: (benzyl)penicillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CE01}{J01CE01}), + \strong{pipe}: piperacillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA12}{J01CA12}), + \strong{pita}: piperacillin+tazobactam (\href{https://www.whocc.no/atc_ddd_index/?code=J01CR05}{J01CR05}), + \strong{poly}: polymyxin B (\href{https://www.whocc.no/atc_ddd_index/?code=J01XB02}{J01XB02}), + \strong{pris}: pristinamycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG01}{J01FG01}), + \strong{qida}: quinupristin/dalfopristin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FG02}{J01FG02}), + \strong{rifa}: rifampicin (\href{https://www.whocc.no/atc_ddd_index/?code=J04AB02}{J04AB02}), + \strong{roxi}: roxithromycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01FA06}{J01FA06}), + \strong{siso}: sisomicin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB08}{J01GB08}), + \strong{teic}: teicoplanin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA02}{J01XA02}), + \strong{tetr}: tetracycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA07}{J01AA07}), + \strong{tica}: ticarcillin (\href{https://www.whocc.no/atc_ddd_index/?code=J01CA13}{J01CA13}), + \strong{tige}: tigecycline (\href{https://www.whocc.no/atc_ddd_index/?code=J01AA12}{J01AA12}), + \strong{tobr}: tobramycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01GB01}{J01GB01}), + \strong{trim}: trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EA01}{J01EA01}), + \strong{trsu}: sulfamethoxazole and trimethoprim (\href{https://www.whocc.no/atc_ddd_index/?code=J01EE01}{J01EE01}), + \strong{vanc}: vancomycin (\href{https://www.whocc.no/atc_ddd_index/?code=J01XA01}{J01XA01}). } \section{Read more on our website!}{ diff --git a/pkgdown/extra.css b/pkgdown/extra.css index 7cc9e8c6..df38f6b5 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -59,7 +59,7 @@ a pre[href], a pre[href]:hover, a pre[href]:focus { /* syntax font */ pre, code { - font-family: 'Courier New'; + font-family: 'Courier New', monospace; font-size: 100% !important; font-weight: bold; background-color: transparent; @@ -102,6 +102,15 @@ help { display: none; } +/* Date of vignettes */ +.template-article .date:before { + content: 'Last updated: '; +} +.template-article .date { + font-size: 14px; + padding-top: 40px; +} + /* more space between icon and text in top menu */ #navbar .fa, #navbar .fab, diff --git a/pkgdown/extra.js b/pkgdown/extra.js index 2268acc2..ca621c42 100644 --- a/pkgdown/extra.js +++ b/pkgdown/extra.js @@ -38,3 +38,5 @@ $( document ).ready(function() { // Edit title of manual $('.template-reference-index h1').text('Manual'); }); + +$('head').append(""); diff --git a/vignettes/AMR.Rmd b/vignettes/AMR.Rmd index 6482e667..662d03e3 100755 --- a/vignettes/AMR.Rmd +++ b/vignettes/AMR.Rmd @@ -1,6 +1,7 @@ --- title: "How to conduct AMR analysis" author: "Matthijs S. Berends" +date: '`r format(Sys.Date(), "%d %B %Y")`' output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/EUCAST.Rmd b/vignettes/EUCAST.Rmd index 3a552c22..f9d5a35f 100644 --- a/vignettes/EUCAST.Rmd +++ b/vignettes/EUCAST.Rmd @@ -1,6 +1,7 @@ --- title: "How to apply EUCAST rules" author: "Matthijs S. Berends" +date: '`r format(Sys.Date(), "%d %B %Y")`' output: rmarkdown::html_vignette: toc: true @@ -30,7 +31,7 @@ What are EUCAST rules? The European Committee on Antimicrobial Susceptibility Te > *EUCAST expert rules are a tabulated collection of expert knowledge on intrinsic resistances, exceptional resistance phenotypes and interpretive rules that may be applied to antimicrobial susceptibility testing in order to reduce errors and make appropriate recommendations for reporting particular resistances.* -In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the `eucast_rules()` function we use for this purpose can also apply additional rules, like forcing ampicillin = R in isolates when amoxicillin/clavulanic acid = R. +In Europe, a lot of medical microbiological laboratories already apply these rules ([Brown *et al.*, 2015](https://www.eurosurveillance.org/content/10.2807/1560-7917.ES2015.20.2.21008)). Our package features their latest insights on intrinsic resistance and exceptional phenotypes (version 9.0, 2019). Moreover, the `eucast_rules()` function we use for this purpose can also apply additional rules, like forcing ampicillin = R in isolates when amoxicillin/clavulanic acid = R. *(more will be available soon)* diff --git a/vignettes/G_test.Rmd b/vignettes/G_test.Rmd index 9c6590d6..64a89f49 100755 --- a/vignettes/G_test.Rmd +++ b/vignettes/G_test.Rmd @@ -1,6 +1,7 @@ --- title: "How to use the *G*-test" author: "Matthijs S. Berends" +date: '`r format(Sys.Date(), "%d %B %Y")`' output: rmarkdown::html_vignette: toc: true @@ -21,4 +22,4 @@ knitr::opts_chunk$set( Sys.setlocale(locale = "C") ``` -*(will be available soon - in the meanwhile, please read about [this *G*-test in the manual](./reference/g.test.html))* +*(will be available soon - in the meanwhile, please read about [this *G*-test in the manual](./../reference/g.test.html))* diff --git a/vignettes/Predict.Rmd b/vignettes/Predict.Rmd index 06c305b8..8ee2e1cd 100755 --- a/vignettes/Predict.Rmd +++ b/vignettes/Predict.Rmd @@ -1,6 +1,7 @@ --- title: "How to predict antimicrobial resistance" author: "Matthijs S. Berends" +date: '`r format(Sys.Date(), "%d %B %Y")`' output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/ab_property.Rmd b/vignettes/ab_property.Rmd index 6a1e70e1..bf17254f 100755 --- a/vignettes/ab_property.Rmd +++ b/vignettes/ab_property.Rmd @@ -1,6 +1,7 @@ --- title: "How to get properties of an antibiotic" author: "Matthijs S. Berends" +date: '`r format(Sys.Date(), "%d %B %Y")`' output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/freq.Rmd b/vignettes/freq.Rmd index 547b51c3..cbf22f04 100644 --- a/vignettes/freq.Rmd +++ b/vignettes/freq.Rmd @@ -1,6 +1,7 @@ --- title: "How to create frequency tables" author: "Matthijs S. Berends" +date: '`r format(Sys.Date(), "%d %B %Y")`' output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/mo_property.Rmd b/vignettes/mo_property.Rmd index 6879e124..4ccbbdeb 100755 --- a/vignettes/mo_property.Rmd +++ b/vignettes/mo_property.Rmd @@ -1,6 +1,7 @@ --- title: "How to get properties of a microorganism" author: "Matthijs S. Berends" +date: '`r format(Sys.Date(), "%d %B %Y")`' output: rmarkdown::html_vignette: toc: true