(v0.7.1.9007) mdro update

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-07-04 15:26:07 +02:00
parent 4ff20af123
commit c57ad26c5b
26 changed files with 146 additions and 117 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 0.7.1.9006
Date: 2019-07-02
Version: 0.7.1.9007
Date: 2019-07-04
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

View File

@ -1,4 +1,4 @@
# AMR 0.7.1.9006
# AMR 0.7.1.9007
### New
* Additional way to calculate co-resistance, i.e. when using multiple antibiotics as input for `portion_*` functions or `count_*` functions. This can be used to determine the empiric susceptibily of a combination therapy. A new parameter `only_all_tested` (**which defaults to `FALSE`**) replaces the old `also_single_tested` and can be used to select one of the two methods to count isolates and calculate portions. The difference can be seen in this example table (which is also on the `portion` and `count` help pages), where the %SI is being determined:
@ -37,6 +37,8 @@
* Fix and speed improvement for `mo_shortname()`
* Fix for `as.mo()` where misspelled input would not be understood
* Fix for using `mo_*` functions where the coercion uncertainties and failures would not be available through `mo_uncertainties()` and `mo_failures()` anymore
* Deprecated the `country` parameter of `mdro()` in favour of the already existing `guideline` parameter to support multiple guidelines within one country
* Fix for frequency tables when creating one directly on a group (using `group_by()`)
# AMR 0.7.1

View File

@ -31,7 +31,7 @@
#' @param row.names a logical value indicating whether row indices should be printed as \code{1:nrow(x)}
#' @param markdown a logical value indicating whether the frequency table should be printed in markdown format. This will print all rows (except when \code{nmax} is defined) and is default behaviour in non-interactive R sessions (like when knitting RMarkdown files).
#' @param digits how many significant digits are to be used for numeric values in the header (not for the items themselves, that depends on \code{\link{getOption}("digits")})
#' @param quote a logical value indicating whether or not strings should be printed with surrounding quotes
#' @param quote a logical value indicating whether or not strings should be printed with surrounding quotes. Default is to print them only around characters that are actually numeric values.
#' @param header a logical value indicating whether an informative header should be printed
#' @param title text to show above frequency table, at default to tries to coerce from the variables passed to \code{x}
#' @param na a character string that should be used to show empty (\code{NA}) values (only useful when \code{na.rm = FALSE})
@ -201,7 +201,7 @@ freq <- function(x,
row.names = TRUE,
markdown = !interactive(),
digits = 2,
quote = FALSE,
quote = NULL,
header = TRUE,
title = NULL,
na = "<NA>",
@ -218,12 +218,15 @@ freq <- function(x,
cols.names <- NULL
if (any(class(x) == "list")) {
cols <- names(x)
cols.names <- cols
x <- as.data.frame(x, stringsAsFactors = FALSE)
x.name <- "a list"
} else if (any(class(x) == "matrix")) {
x <- as.data.frame(x, stringsAsFactors = FALSE)
x.name <- "a matrix"
cols <- colnames(x)
quote <- FALSE
cols.names <- cols
if (all(cols %like% "V[0-9]")) {
cols <- NULL
}
@ -245,7 +248,7 @@ freq <- function(x,
} else {
x.name <- "a data.frame"
}
} else {
} else if (!x.name %in% c("a list", "a matrix")) {
x.name <- paste0("`", x.name, "`")
}
x.name.dims <- x %>%
@ -291,6 +294,11 @@ freq <- function(x,
df <- x
}
if (identical(x.group, cols.names)) {
# ... %>% group_by(var = calculation(..)) %>% freq(var)
x.group <- NULL
}
# support grouping variables
if (length(x.group) > 0) {
x.group_cols <- c(x.group, cols.names)
@ -526,6 +534,14 @@ freq <- function(x,
df <- df %>% mutate(item = item %>% gsub("\033", " ", ., fixed = TRUE))
}
if (is.null(quote)) {
if (!is.numeric(df$item) & all(df$item %like% "^[0-9]+$", na.rm = TRUE)) {
quote <- TRUE
} else {
quote <- FALSE
}
}
if (quote == TRUE) {
df$item <- paste0('"', df$item, '"')
if (length(x.group) != 0) {

View File

@ -21,33 +21,36 @@
#' Determine multidrug-resistant organisms (MDRO)
#'
#' Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines.
#' Determine which isolates are multidrug-resistant organisms (MDRO) according to (country-specific) guidelines.
#' @param x table with antibiotic columns, like e.g. \code{AMX} and \code{AMC}
#' @param country country code to determine guidelines. Should be or a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive.
#' @param guideline a specific guideline to mention. For some countries this will be determined automatically, see Details. EUCAST guidelines will be used when left empty, see Details.
#' @param guideline a specific guideline to mention, see Details. EUCAST guidelines will be used when left empty, see Details.
#' @param info print progress
#' @inheritParams eucast_rules
#' @param verbose print additional info: missing antibiotic columns per parameter
#' @inheritSection eucast_rules Antibiotics
#' @details When \code{country} is set, the parameter guideline will be ignored as these guidelines will be used:
#'
#' @details Currently supported guidelines are:
#' \itemize{
#' \item{\code{country = "nl"}: Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (\href{https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH}{link})}
#' \item{\code{guideline = "EUCAST"}: EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\href{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}{link})}
#' \item{\code{guideline = "TB"}: World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (\href{https://www.who.int/tb/publications/pmdt_companionhandbook/en/}{link})}
#' \item{\code{guideline = "MRGN"}: (work in progress)}
#' \item{\code{guideline = "BRMO"}: Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (\href{https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH}{link})}
#' }
#'
#' Please suggest your own country's specific guidelines by letting us know: \url{https://gitlab.com/msberends/AMR/issues/new}.
#' Please suggest your own (country-specific) guidelines by letting us know: \url{https://gitlab.com/msberends/AMR/issues/new}.
#' @return For TB (\code{mdr_tb()}): Ordered factor with levels \code{Negative < Mono-resistance < Poly-resistance < Multidrug resistance < Extensive drug resistance}.
#'
#' Other currently supported guidelines are:
#' \itemize{
#' \item{\code{guideline = "eucast"}: EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\href{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}{link})}
#' \item{\code{guideline = "tb"}: World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (\href{https://www.who.int/tb/publications/pmdt_companionhandbook/en/}{link})}
#' }
#' @return Ordered factor with levels \code{Negative < Positive, unconfirmed < Positive}.
#' For everything else: Ordered factor with levels \code{Negative < Positive, unconfirmed < Positive}. The value \code{"Positive, unconfirmed"} means that, according to the guideline, it is not entirely sure if the isolate is multi-drug resistant and this should be confirmed with additional (e.g. molecular) tests.
#' @rdname mdro
#' @importFrom dplyr %>%
#' @importFrom crayon red blue bold
#' @export
#' @inheritSection AMR Read more on our website!
#' @source
#' EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\href{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}{link})
#'
#' World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (\href{https://www.who.int/tb/publications/pmdt_companionhandbook/en/}{link})
#'
#' Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (\href{https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH}{link})
#' @examples
#' library(dplyr)
#'
@ -55,7 +58,6 @@
#' mutate(EUCAST = mdro(.),
#' BRMO = brmo(.))
mdro <- function(x,
country = NULL,
guideline = NULL,
col_mo = NULL,
info = TRUE,
@ -66,19 +68,25 @@ mdro <- function(x,
stop("`x` must be a data frame.", call. = FALSE)
}
if (!is.null(list(...)$country)) {
warning("Using `country` is deprecated, use `guideline` instead. Please see ?mdro.", call. = FALSE)
guideline <- list(...)$country
}
if (length(guideline) > 1) {
stop("`guideline` must be a length one character string.", call. = FALSE)
}
if (length(country) > 1) {
stop("`country` must be a length one character string.", call. = FALSE)
}
if (!is.null(country)) {
guideline <- country
}
if (is.null(guideline)) {
guideline <- "eucast"
}
if (!tolower(guideline) %in% c("nl", "de", "eucast", "tb")) {
if (tolower(guideline) == "nl") {
guideline <- "BRMO"
}
if (tolower(guideline) == "de") {
guideline <- "MRGN"
}
if (!tolower(guideline) %in% c("brmo", "mrgn", "eucast", "tb")) {
stop("invalid guideline: ", guideline, call. = FALSE)
}
guideline <- list(code = tolower(guideline))
@ -90,8 +98,7 @@ mdro <- function(x,
}
if (is.null(col_mo) & guideline$code == "tb") {
message(blue("NOTE: No column found as input for `col_mo`,",
bold("assuming all records contain",
italic("Mycobacterium tuberculosis.\n"))))
bold("assuming all records contain", italic("Mycobacterium tuberculosis.\n"))))
x$mo <- AMR::as.mo("Mycobacterium tuberculosis")
col_mo <- "mo"
}
@ -99,10 +106,6 @@ mdro <- function(x,
stop("`col_mo` must be set.", call. = FALSE)
}
if (length(country) > 1) {
stop("`country` must be a length one character string.", call. = FALSE)
}
if (guideline$code == "eucast") {
guideline$name <- "EUCAST Expert Rules, \"Intrinsic Resistance and Exceptional Phenotypes Tables\""
guideline$author <- "EUCAST (European Committee on Antimicrobial Susceptibility Testing)"
@ -116,19 +119,16 @@ mdro <- function(x,
guideline$source <- "https://www.who.int/tb/publications/pmdt_companionhandbook/en/"
# support per country:
} else if (guideline$code == "de") {
} else if (guideline$code == "mrgn") {
guideline$name <- "Germany"
guideline$name <- ""
guideline$version <- ""
guideline$source <- ""
} else if (guideline$code == "nl") {
} else if (guideline$code == "brmo") {
guideline$name <- "WIP-Richtlijn Bijzonder Resistente Micro-organismen (BRMO)"
guideline$author <- "RIVM (Rijksinstituut voor de Volksgezondheid)"
guideline$version <- "Revision as of December 2017"
guideline$source <- "https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH"
# add here more countries like this:
# } else if (country$code == "xx") {
# country$name <- "country name"
} else {
stop("This guideline is currently unsupported: ", guideline$code, call. = FALSE)
}
@ -336,12 +336,12 @@ mdro <- function(x,
"any")
}
if (guideline$code == "de") {
if (guideline$code == "mrgn") {
# Germany -----------------------------------------------------------------
stop("We are still working on German guidelines in this beta version.", call. = FALSE)
}
if (guideline$code == "nl") {
if (guideline$code == "brmo") {
# Netherlands -------------------------------------------------------------
aminoglycosides <- aminoglycosides[!is.na(aminoglycosides)]
fluoroquinolones <- fluoroquinolones[!is.na(fluoroquinolones)]
@ -496,14 +496,14 @@ mdro <- function(x,
#' @rdname mdro
#' @export
brmo <- function(..., country = "nl") {
mdro(..., country = "nl")
brmo <- function(..., guideline = "BRMO") {
mdro(..., guideline = "BRMO")
}
#' @rdname mdro
#' @export
mrgn <- function(x, country = "de", ...) {
mdro(x = x, country = "de", ...)
mrgn <- function(x, guideline = "MRGN", ...) {
mdro(x = x, guideline = "MRGN", ...)
}
#' @rdname mdro

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -42,7 +42,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>
@ -202,7 +202,7 @@
<p>We created this package for both academic research and routine analysis at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is actively maintained and is free software; you can freely use and distribute it for both personal and commercial (but <strong>not</strong> patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation. Read the full license <a href="./LICENSE-text.html">here</a>.</p>
<p>This package can be used for:</p>
<ul>
<li>Reference for microorganisms, since it contains all microbial (sub)species from the <a href="http://www.catalogueoflife.org">Catalogue of Life</a> (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the <a href="http://www.catalogueoflife.org">Catalogue of Life</a> (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines (<a href="./reference/as.rsi.html">manual</a>)</li>
<li>Calculating antimicrobial resistance (<a href="./articles/AMR.html">tutorial</a>)</li>
<li>Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO) (<a href="./articles/MDR.html">tutorial</a>)</li>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>
@ -232,9 +232,9 @@
</div>
<div id="amr-0719006" class="section level1">
<div id="amr-0719007" class="section level1">
<h1 class="page-header">
<a href="#amr-0719006" class="anchor"></a>AMR 0.7.1.9006<small> Unreleased </small>
<a href="#amr-0719007" class="anchor"></a>AMR 0.7.1.9007<small> Unreleased </small>
</h1>
<div id="new" class="section level3">
<h3 class="hasAnchor">
@ -280,6 +280,8 @@
</li>
<li>Fix for <code><a href="../reference/as.mo.html">as.mo()</a></code> where misspelled input would not be understood</li>
<li>Fix for using <code>mo_*</code> functions where the coercion uncertainties and failures would not be available through <code><a href="../reference/as.mo.html">mo_uncertainties()</a></code> and <code><a href="../reference/as.mo.html">mo_failures()</a></code> anymore</li>
<li>Deprecated the <code>country</code> parameter of <code><a href="../reference/mdro.html">mdro()</a></code> in favour of the already existing <code>guideline</code> parameter to support multiple guidelines within one country</li>
<li>Fix for frequency tables when creating one directly on a group (using <code>group_by()</code>)</li>
</ul>
</div>
</div>
@ -1192,7 +1194,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0719006">0.7.1.9006</a></li>
<li><a href="#amr-0719007">0.7.1.9007</a></li>
<li><a href="#amr-071">0.7.1</a></li>
<li><a href="#amr-070">0.7.0</a></li>
<li><a href="#amr-061">0.6.1</a></li>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>
@ -245,14 +245,14 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co
<pre class="usage"><span class='fu'>freq</span>(<span class='no'>x</span>, <span class='no'>...</span>, <span class='kw'>sort.count</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>nmax</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a></span>(<span class='st'>"max.print.freq"</span>),
<span class='kw'>na.rm</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>row.names</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>markdown</span> <span class='kw'>=</span> !<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/interactive'>interactive</a></span>(),
<span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>quote</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>header</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>title</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>quote</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>header</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>title</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>na</span> <span class='kw'>=</span> <span class='st'>"&lt;NA&gt;"</span>, <span class='kw'>droplevels</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>sep</span> <span class='kw'>=</span> <span class='st'>" "</span>,
<span class='kw'>decimal.mark</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a></span>(<span class='st'>"OutDec"</span>), <span class='kw'>big.mark</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/ifelse'>ifelse</a></span>(<span class='no'>decimal.mark</span> <span class='kw'>!=</span>
<span class='st'>","</span>, <span class='st'>","</span>, <span class='st'>"."</span>))
<span class='fu'>frequency_tbl</span>(<span class='no'>x</span>, <span class='no'>...</span>, <span class='kw'>sort.count</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>nmax</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a></span>(<span class='st'>"max.print.freq"</span>), <span class='kw'>na.rm</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>row.names</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>markdown</span> <span class='kw'>=</span> !<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/interactive'>interactive</a></span>(), <span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>quote</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='kw'>markdown</span> <span class='kw'>=</span> !<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/interactive'>interactive</a></span>(), <span class='kw'>digits</span> <span class='kw'>=</span> <span class='fl'>2</span>, <span class='kw'>quote</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>header</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>title</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>na</span> <span class='kw'>=</span> <span class='st'>"&lt;NA&gt;"</span>, <span class='kw'>droplevels</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>sep</span> <span class='kw'>=</span> <span class='st'>" "</span>, <span class='kw'>decimal.mark</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a></span>(<span class='st'>"OutDec"</span>),
<span class='kw'>big.mark</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/ifelse'>ifelse</a></span>(<span class='no'>decimal.mark</span> <span class='kw'>!=</span> <span class='st'>","</span>, <span class='st'>","</span>, <span class='st'>"."</span>))
@ -304,7 +304,7 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co
</tr>
<tr>
<th>quote</th>
<td><p>a logical value indicating whether or not strings should be printed with surrounding quotes</p></td>
<td><p>a logical value indicating whether or not strings should be printed with surrounding quotes. Default is to print them only around characters that are actually numeric values.</p></td>
</tr>
<tr>
<th>header</th>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -47,7 +47,7 @@
<script src="../extra.js"></script>
<meta property="og:title" content="Determine multidrug-resistant organisms (MDRO) — mdro" />
<meta property="og:description" content="Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines." />
<meta property="og:description" content="Determine which isolates are multidrug-resistant organisms (MDRO) according to (country-specific) guidelines." />
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png" />
<meta name="twitter:card" content="summary" />
@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>
@ -237,16 +237,16 @@
<div class="ref-description">
<p>Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines.</p>
<p>Determine which isolates are multidrug-resistant organisms (MDRO) according to (country-specific) guidelines.</p>
</div>
<pre class="usage"><span class='fu'>mdro</span>(<span class='no'>x</span>, <span class='kw'>country</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>guideline</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='no'>...</span>)
<pre class="usage"><span class='fu'>mdro</span>(<span class='no'>x</span>, <span class='kw'>guideline</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='no'>...</span>)
<span class='fu'>brmo</span>(<span class='no'>...</span>, <span class='kw'>country</span> <span class='kw'>=</span> <span class='st'>"nl"</span>)
<span class='fu'>brmo</span>(<span class='no'>...</span>, <span class='kw'>guideline</span> <span class='kw'>=</span> <span class='st'>"BRMO"</span>)
<span class='fu'>mrgn</span>(<span class='no'>x</span>, <span class='kw'>country</span> <span class='kw'>=</span> <span class='st'>"de"</span>, <span class='no'>...</span>)
<span class='fu'>mrgn</span>(<span class='no'>x</span>, <span class='kw'>guideline</span> <span class='kw'>=</span> <span class='st'>"MRGN"</span>, <span class='no'>...</span>)
<span class='fu'>mdr_tb</span>(<span class='no'>x</span>, <span class='kw'>guideline</span> <span class='kw'>=</span> <span class='st'>"TB"</span>, <span class='no'>...</span>)
@ -259,13 +259,9 @@
<th>x</th>
<td><p>table with antibiotic columns, like e.g. <code>AMX</code> and <code>AMC</code></p></td>
</tr>
<tr>
<th>country</th>
<td><p>country code to determine guidelines. Should be or a code from the <a href='https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements'>list of ISO 3166-1 alpha-2 country codes</a>. Case-insensitive.</p></td>
</tr>
<tr>
<th>guideline</th>
<td><p>a specific guideline to mention. For some countries this will be determined automatically, see Details. EUCAST guidelines will be used when left empty, see Details.</p></td>
<td><p>a specific guideline to mention, see Details. EUCAST guidelines will be used when left empty, see Details.</p></td>
</tr>
<tr>
<th>col_mo</th>
@ -285,21 +281,26 @@
</tr>
</table>
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>
<p>EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (<a href='http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf'>link</a>)</p>
<p>World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (<a href='https://www.who.int/tb/publications/pmdt_companionhandbook/en/'>link</a>)</p>
<p>Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (<a href='https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH'>link</a>)</p>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>Ordered factor with levels <code>Negative &lt; Positive, unconfirmed &lt; Positive</code>.</p>
<p>For TB (<code>mdr_tb()</code>): Ordered factor with levels <code>Negative &lt; Mono-resistance &lt; Poly-resistance &lt; Multidrug resistance &lt; Extensive drug resistance</code>.</p>
<p>For everything else: Ordered factor with levels <code>Negative &lt; Positive, unconfirmed &lt; Positive</code>. The value <code>"Positive, unconfirmed"</code> means that, according to the guideline, it is not entirely sure if the isolate is multi-drug resistant and this should be confirmed with additional (e.g. molecular) tests.</p>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>When <code>country</code> is set, the parameter guideline will be ignored as these guidelines will be used:</p>
<ul>
<li><p><code>country = "nl"</code>: Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (<a href='https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH'>link</a>)</p></li>
</ul>
<p>Please suggest your own country's specific guidelines by letting us know: <a href='https://gitlab.com/msberends/AMR/issues/new'>https://gitlab.com/msberends/AMR/issues/new</a>.</p>
<p>Other currently supported guidelines are:</p><ul>
<li><p><code>guideline = "eucast"</code>: EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (<a href='http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf'>link</a>)</p></li>
<li><p><code>guideline = "tb"</code>: World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (<a href='https://www.who.int/tb/publications/pmdt_companionhandbook/en/'>link</a>)</p></li>
<p>Currently supported guidelines are:</p><ul>
<li><p><code>guideline = "EUCAST"</code>: EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (<a href='http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf'>link</a>)</p></li>
<li><p><code>guideline = "TB"</code>: World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (<a href='https://www.who.int/tb/publications/pmdt_companionhandbook/en/'>link</a>)</p></li>
<li><p><code>guideline = "MRGN"</code>: (work in progress)</p></li>
<li><p><code>guideline = "BRMO"</code>: Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (<a href='https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH'>link</a>)</p></li>
</ul>
<p>Please suggest your own (country-specific) guidelines by letting us know: <a href='https://gitlab.com/msberends/AMR/issues/new'>https://gitlab.com/msberends/AMR/issues/new</a>.</p>
<h2 class="hasAnchor" id="antibiotics"><a class="anchor" href="#antibiotics"></a>Antibiotics</h2>
@ -399,6 +400,8 @@
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#source">Source</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#details">Details</a></li>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9007</span>
</span>
</div>

View File

@ -15,7 +15,7 @@ This R package is actively maintained and is free software; you can freely use a
This package can be used for:
* Reference for microorganisms, since it contains all microbial (sub)species from the [Catalogue of Life](http://www.catalogueoflife.org) ([manual](./reference/mo_property.html))
* Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the [Catalogue of Life](http://www.catalogueoflife.org) ([manual](./reference/mo_property.html))
* Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines ([manual](./reference/as.rsi.html))
* Calculating antimicrobial resistance ([tutorial](./articles/AMR.html))
* Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO) ([tutorial](./articles/MDR.html))

View File

@ -10,14 +10,14 @@
\usage{
freq(x, ..., sort.count = TRUE, nmax = getOption("max.print.freq"),
na.rm = TRUE, row.names = TRUE, markdown = !interactive(),
digits = 2, quote = FALSE, header = TRUE, title = NULL,
digits = 2, quote = NULL, header = TRUE, title = NULL,
na = "<NA>", droplevels = TRUE, sep = " ",
decimal.mark = getOption("OutDec"), big.mark = ifelse(decimal.mark !=
",", ",", "."))
frequency_tbl(x, ..., sort.count = TRUE,
nmax = getOption("max.print.freq"), na.rm = TRUE, row.names = TRUE,
markdown = !interactive(), digits = 2, quote = FALSE,
markdown = !interactive(), digits = 2, quote = NULL,
header = TRUE, title = NULL, na = "<NA>", droplevels = TRUE,
sep = " ", decimal.mark = getOption("OutDec"),
big.mark = ifelse(decimal.mark != ",", ",", "."))
@ -48,7 +48,7 @@ header(f, property = NULL)
\item{digits}{how many significant digits are to be used for numeric values in the header (not for the items themselves, that depends on \code{\link{getOption}("digits")})}
\item{quote}{a logical value indicating whether or not strings should be printed with surrounding quotes}
\item{quote}{a logical value indicating whether or not strings should be printed with surrounding quotes. Default is to print them only around characters that are actually numeric values.}
\item{header}{a logical value indicating whether an informative header should be printed}

View File

@ -7,13 +7,20 @@
\alias{mdr_tb}
\alias{eucast_exceptional_phenotypes}
\title{Determine multidrug-resistant organisms (MDRO)}
\source{
EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\href{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}{link})
World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (\href{https://www.who.int/tb/publications/pmdt_companionhandbook/en/}{link})
Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (\href{https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH}{link})
}
\usage{
mdro(x, country = NULL, guideline = NULL, col_mo = NULL,
info = TRUE, verbose = FALSE, ...)
mdro(x, guideline = NULL, col_mo = NULL, info = TRUE,
verbose = FALSE, ...)
brmo(..., country = "nl")
brmo(..., guideline = "BRMO")
mrgn(x, country = "de", ...)
mrgn(x, guideline = "MRGN", ...)
mdr_tb(x, guideline = "TB", ...)
@ -22,9 +29,7 @@ eucast_exceptional_phenotypes(x, guideline = "EUCAST", ...)
\arguments{
\item{x}{table with antibiotic columns, like e.g. \code{AMX} and \code{AMC}}
\item{country}{country code to determine guidelines. Should be or a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive.}
\item{guideline}{a specific guideline to mention. For some countries this will be determined automatically, see Details. EUCAST guidelines will be used when left empty, see Details.}
\item{guideline}{a specific guideline to mention, see Details. EUCAST guidelines will be used when left empty, see Details.}
\item{col_mo}{column name of the unique IDs of the microorganisms (see \code{\link{mo}}), defaults to the first column of class \code{mo}. Values will be coerced using \code{\link{as.mo}}.}
@ -35,25 +40,23 @@ eucast_exceptional_phenotypes(x, guideline = "EUCAST", ...)
\item{...}{column name of an antibiotic, see section Antibiotics}
}
\value{
Ordered factor with levels \code{Negative < Positive, unconfirmed < Positive}.
For TB (\code{mdr_tb()}): Ordered factor with levels \code{Negative < Mono-resistance < Poly-resistance < Multidrug resistance < Extensive drug resistance}.
For everything else: Ordered factor with levels \code{Negative < Positive, unconfirmed < Positive}. The value \code{"Positive, unconfirmed"} means that, according to the guideline, it is not entirely sure if the isolate is multi-drug resistant and this should be confirmed with additional (e.g. molecular) tests.
}
\description{
Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines.
Determine which isolates are multidrug-resistant organisms (MDRO) according to (country-specific) guidelines.
}
\details{
When \code{country} is set, the parameter guideline will be ignored as these guidelines will be used:
Currently supported guidelines are:
\itemize{
\item{\code{country = "nl"}: Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (\href{https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH}{link})}
\item{\code{guideline = "EUCAST"}: EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\href{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}{link})}
\item{\code{guideline = "TB"}: World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (\href{https://www.who.int/tb/publications/pmdt_companionhandbook/en/}{link})}
\item{\code{guideline = "MRGN"}: (work in progress)}
\item{\code{guideline = "BRMO"}: Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]" (\href{https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH}{link})}
}
Please suggest your own country's specific guidelines by letting us know: \url{https://gitlab.com/msberends/AMR/issues/new}.
Other currently supported guidelines are:
\itemize{
\item{\code{guideline = "eucast"}: EUCAST Expert Rules Version 3.1 "Intrinsic Resistance and Exceptional Phenotypes Tables" (\href{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf}{link})}
\item{\code{guideline = "tb"}: World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (\href{https://www.who.int/tb/publications/pmdt_companionhandbook/en/}{link})}
}
Please suggest your own (country-specific) guidelines by letting us know: \url{https://gitlab.com/msberends/AMR/issues/new}.
}
\section{Antibiotics}{

View File

@ -182,5 +182,8 @@ test_that("frequency table works", {
"Just a string") # not a freq tbl
))
# directly on group
expect_output(print(septic_patients %>% group_by(ageplusone = as.character(age + 1)) %>% freq(ageplusone)))
})

View File

@ -24,9 +24,9 @@ context("mdro.R")
test_that("mdro works", {
library(dplyr)
expect_error(mdro(septic_patients, country = "invalid", col_mo = "mo", info = TRUE))
expect_error(mdro(septic_patients, country = "fr", info = TRUE))
expect_error(mdro(septic_patients, country = c("de", "nl"), info = TRUE))
expect_error(suppressWarnings(mdro(septic_patients, country = "invalid", col_mo = "mo", info = TRUE)))
expect_error(suppressWarnings(mdro(septic_patients, country = "fr", info = TRUE)))
expect_error(mdro(septic_patients, guideline = c("BRMO", "MRGN"), info = TRUE))
expect_error(mdro(septic_patients, col_mo = "invalid", info = TRUE))
outcome <- mdro(septic_patients)
@ -43,7 +43,7 @@ test_that("mdro works", {
c(1969, 25, 6)) # 1969 neg, 25 unconfirmed, 6 pos
expect_equal(brmo(septic_patients, info = FALSE),
mdro(septic_patients, country = "nl", info = FALSE))
mdro(septic_patients, guideline = "BRMO", info = FALSE))
# still working on German guidelines
expect_error(suppressWarnings(mrgn(septic_patients, info = TRUE)))
@ -58,7 +58,7 @@ test_that("mdro works", {
gent = "S",
tobr = "S",
pita = "S"),
country = "nl",
guideline = "BRMO",
col_mo = "mo",
info = FALSE)),
"Negative")
@ -71,7 +71,7 @@ test_that("mdro works", {
gent = "R",
tobr = "R",
pita = "R"),
country = "nl",
guideline = "BRMO",
col_mo = "mo",
info = FALSE)),
"Positive")