(v1.6.0.9044) betalactams() selector

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-05-18 00:53:04 +02:00
parent be49131ed7
commit cfb7df823e
28 changed files with 275 additions and 200 deletions

View File

@ -97,8 +97,9 @@ jobs:
if: runner.os == 'Linux'
# update the below with sysreqs::sysreqs("DESCRIPTION") and check the "DEB" entries (for Ubuntu).
# we don't want to depend on the sysreqs pkg here, as it requires a quite new R version
# as of May 2021: https://sysreqs.r-hub.io/pkg/AMR,R,cleaner,curl,dplyr,ggplot2,ggtext,knitr,microbenchmark,pillar,readxl,rmarkdown,rstudioapi,rvest,skimr,tidyr,tinytest,xml2,backports,crayon,rlang,vctrs,evaluate,highr,markdown,stringr,yaml,xfun,cli,ellipsis,fansi,lifecycle,utf8,glue,mime,magrittr,stringi,generics,R6,tibble,tidyselect,pkgconfig,purrr,digest,gtable,isoband,MASS,mgcv,scales,withr,nlme,Matrix,farver,labeling,munsell,RColorBrewer,viridisLite,lattice,colorspace,gridtext,Rcpp,RCurl,png,jpeg,bitops,cellranger,progress,rematch,hms,prettyunits,htmltools,jsonlite,tinytex,base64enc,httr,selectr,openssl,askpass,sys,repr,cpp11
run: |
sudo apt install -y libssl-dev pandoc pandoc-citeproc libxml2-dev libicu-dev libcurl4-openssl-dev
sudo apt install -y libssl-dev pandoc pandoc-citeproc libxml2-dev libicu-dev libcurl4-openssl-dev libpng-dev
- name: Restore cached R packages
# this step will add the step 'Post Restore cached R packages' on a succesful run
@ -109,10 +110,7 @@ jobs:
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-v4
- name: Install AMR and tinytest and update dependencies
# some old R instances have trouble installing tinytest, so we ship it too
run: |
install.packages("data-raw/AMR_latest.tar.gz")
trimws <- AMR:::trimws; install.packages("data-raw/tinytest_1.2.4.tar.gz")
source("data-raw/_install_deps.R")
shell: Rscript {0}
@ -122,26 +120,16 @@ jobs:
utils::sessionInfo()
as.data.frame(utils::installed.packages())[, "Version", drop = FALSE]
shell: Rscript {0}
- name: Run R CMD check on Windows
if: runner.os == 'Windows'
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_: false
_R_CHECK_DEPENDS_ONLY_: true
_R_CHECK_LENGTH_1_CONDITION_: verbose
_R_CHECK_LENGTH_1_LOGIC2_: verbose
# during 'R CMD check', R_LIBS_USER will be overwritten, so:
R_LIBS_USER_GH_ACTIONS: ${{ env.R_LIBS_USER }}
R_RUN_TINYTEST: true
- name: Unpack shipped version and remove vignettes
if: always()
run: |
tar -xf data-raw/AMR_latest.tar.gz
rm -rf AMR/vignettes
R CMD check AMR
Rscript -e "writeLines(readLines('DESCRIPTION')[!grepl('VignetteBuilder', readLines('DESCRIPTION'))], 'DESCRIPTION')"
shell: bash
- name: Run R CMD check on Linux and macOS
if: runner.os != 'Windows'
- name: Run R CMD check
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_: false
@ -152,9 +140,7 @@ jobs:
R_LIBS_USER_GH_ACTIONS: ${{ env.R_LIBS_USER }}
R_RUN_TINYTEST: true
run: |
tar -xf data-raw/AMR_latest.tar.gz
rm -rf AMR/vignettes
R CMD check AMR --no-manual --no-vignettes
R CMD check --no-manual --no-vignettes AMR
shell: bash
- name: Show unit tests output

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.6.0.9043
Date: 2021-05-17
Version: 1.6.0.9044
Date: 2021-05-18
Title: Antimicrobial Resistance Data Analysis
Authors@R: c(
person(role = c("aut", "cre"),

View File

@ -174,6 +174,7 @@ export(atc_online_ddd)
export(atc_online_groups)
export(atc_online_property)
export(availability)
export(betalactams)
export(brmo)
export(bug_drug_combinations)
export(carbapenems)
@ -206,6 +207,7 @@ export(filter_4th_cephalosporins)
export(filter_5th_cephalosporins)
export(filter_ab_class)
export(filter_aminoglycosides)
export(filter_betalactams)
export(filter_carbapenems)
export(filter_cephalosporins)
export(filter_first_isolate)

11
NEWS.md
View File

@ -1,5 +1,5 @@
# `AMR` 1.6.0.9043
## <small>Last updated: 17 May 2021</small>
# `AMR` 1.6.0.9044
## <small>Last updated: 18 May 2021</small>
### New
* Function `custom_eucast_rules()` that brings support for custom AMR rules in `eucast_rules()`
@ -11,7 +11,9 @@
* The `first_isolate()` function can now take a vector of values for `col_keyantibiotics` and can have an episode length of `Inf`
* Since the phenotype-based method is the new default, `filter_first_isolate()` renders the `filter_first_weighted_isolate()` function redundant. For this reason, `filter_first_weighted_isolate()` is now deprecated.
* The documentation of the `first_isolate()` and `key_antimicrobials()` functions has been completely rewritten.
* Added `ggplot()` method for `resistance_predict()`
* Function `betalactams()` as additional antbiotic column selector and function `filter_betalactams()` as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
* A `ggplot()` method for `resistance_predict()`
### Changed
* Custom MDRO guidelines (`mdro()`, `custom_mdro_guideline()`):
@ -41,7 +43,8 @@
* Updated `skimr::skim()` usage for MIC values to also include 25th and 75th percentiles
* Fix for plotting missing MIC/disk diffusion values
* Updated join functions to always use `dplyr` join functions if the `dplyr` package is installed - now also preserving grouped variables
* Fix for filtering on antibiotic classes (such as `filter_cephalosporins()`)
* Fix for filtering on antibiotic classes (such as `filter_cephalosporins()`), which now also supports dplyr groups
* Antibiotic class selectors (such as `cephalosporins()`) now maintain the column order from the original data
### Other
* All unit tests are now processed by the `tinytest` package, instead of the `testthat` package. The `testthat` package unfortunately requires tons of dependencies that are also heavy and only usable for recent R versions, defeating the purpose to test our package under less recent R versions. On the contrary, the `tinytest` package is very lightweight and dependency-free.

View File

@ -1172,14 +1172,13 @@ strrep <- function(x, times) {
paste0(replicate(times, x), collapse = "")
}, list(x = x, times = times), MoreArgs = list()), use.names = FALSE)
}
trimws <- function(x, which = c("both", "left", "right")) {
trimws <- function(x, which = c("both", "left", "right"), whitespace = "[ \t\r\n]") {
which <- match.arg(which)
mysub <- function(re, x) sub(re, "", x, perl = TRUE)
if (which == "left")
return(mysub("^[ \t\r\n]+", x))
if (which == "right")
return(mysub("[ \t\r\n]+$", x))
mysub("[ \t\r\n]+$", mysub("^[ \t\r\n]+", x))
switch(which,
left = mysub(paste0("^", whitespace, "+"), x),
right = mysub(paste0(whitespace, "+$"), x),
both = mysub(paste0(whitespace, "+$"), mysub(paste0("^", whitespace, "+"), x)))
}
isFALSE <- function(x) {
is.logical(x) && length(x) == 1L && !is.na(x) && !x

View File

@ -32,6 +32,8 @@
#' @details \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
#'
#' All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector like e.g. [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
#'
#' The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
#' @rdname antibiotic_class_selectors
#' @seealso [filter_ab_class()] for the `filter()` equivalent.
#' @name antibiotic_class_selectors
@ -91,6 +93,11 @@ aminoglycosides <- function(only_rsi_columns = FALSE) {
ab_selector("aminoglycoside", function_name = "aminoglycosides", only_rsi_columns = only_rsi_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
betalactams <- function(only_rsi_columns = FALSE) {
ab_selector("carbapenem|cephalosporin|penicillin", function_name = "betalactams", only_rsi_columns = only_rsi_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
carbapenems <- function(only_rsi_columns = FALSE) {
@ -187,7 +194,7 @@ ab_selector <- function(ab_class,
# improve speed here so it will only run once when e.g. in one select call
if (!identical(pkg_env$ab_selector, unique_call_id())) {
ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns)
ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE)
pkg_env$ab_selector <- unique_call_id()
pkg_env$ab_selector_cols <- ab_in_data
} else {
@ -212,6 +219,7 @@ ab_selector <- function(ab_class,
}
# get the columns with a group names in the chosen ab class
agents <- ab_in_data[names(ab_in_data) %in% ab_reference$ab]
if (message_not_thrown_before(function_name)) {
if (length(agents) == 0) {
message_("No antimicrobial agents of class ", ab_group, " found", examples, ".")

View File

@ -34,6 +34,8 @@
#' @param only_rsi_columns a [logical] to indicate whether only columns must be included that were transformed to class `<rsi>` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
#' @param ... arguments passed on to [filter_ab_class()]
#' @details All columns of `x` will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a filter function like e.g. [filter_aminoglycosides()] will include column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
#'
#' The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
#' @rdname filter_ab_class
#' @seealso [antibiotic_class_selectors()] for the `select()` equivalent.
#' @export
@ -88,16 +90,16 @@ filter_ab_class <- function(x,
if (is.null(.call_depth)) {
.call_depth <- 0
}
meet_criteria(x, allow_class = "data.frame", .call_depth = .call_depth)
meet_criteria(ab_class, allow_class = "character", has_length = 1, .call_depth = .call_depth)
meet_criteria(result, allow_class = "character", has_length = c(1, 2, 3), allow_NULL = TRUE, .call_depth = .call_depth)
meet_criteria(scope, allow_class = "character", has_length = 1, is_in = c("all", "any"), .call_depth = .call_depth)
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, .call_depth = .call_depth)
check_dataset_integrity()
# save to return later
x_class <- class(x)
x.bak <- x
x <- as.data.frame(x, stringsAsFactors = FALSE)
@ -111,14 +113,24 @@ filter_ab_class <- function(x,
stop_ifnot(all(scope %in% c("any", "all")), "`scope` must be one of: 'any', 'all'")
# get all columns in data with names that resemble antibiotics
ab_in_data <- get_column_abx(x, info = FALSE, only_rsi_columns = only_rsi_columns)
ab_in_data <- get_column_abx(x, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE)
# improve speed here so it will only run once when e.g. in one select call
if (!identical(pkg_env$filter_ab_selector, unique_call_id())) {
ab_in_data <- get_column_abx(x, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE)
pkg_env$filter_ab_selector <- unique_call_id()
pkg_env$filter_ab_selector_cols <- ab_in_data
} else {
ab_in_data <- pkg_env$filter_ab_selector_cols
}
if (length(ab_in_data) == 0) {
message_("No columns with class <rsi> found (see ?as.rsi), data left unchanged.")
message_("No columns with antibiotic test results found (see ?as.rsi), data left unchanged.")
return(x.bak)
}
# get reference data
ab_class.bak <- ab_class
ab_class <- gsub("[^a-zA-Z0-9]+", ".*", ab_class)
ab_class <- gsub("[^a-zA-Z|0-9]+", ".*", ab_class)
ab_class <- gsub("(ph|f)", "(ph|f)", ab_class)
ab_class <- gsub("(t|th)", "(t|th)", ab_class)
ab_reference <- subset(antibiotics,
@ -133,8 +145,8 @@ filter_ab_class <- function(x,
# get the columns with a group names in the chosen ab class
agents <- ab_in_data[names(ab_in_data) %in% ab_reference$ab]
if (length(agents) == 0) {
message_("No antimicrobial agents of class ", ab_group,
" found (such as ", find_ab_names(ab_class, 2),
message_("No antimicrobial agents of class '", ab_group,
"' found (such as ", find_ab_names(ab_class, 2),
")",
ifelse(only_rsi_columns == TRUE, " with class <rsi>,", ","),
" data left unchanged.")
@ -162,18 +174,22 @@ filter_ab_class <- function(x,
# sort columns on official name
agents <- agents[order(ab_name(names(agents), language = NULL))]
agents_formatted <- paste0("'", font_bold(agents, collapse = NULL), "'")
agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL)
need_name <- tolower(gsub("[^a-zA-Z]", "", agents)) != tolower(gsub("[^a-zA-Z]", "", agents_names))
agents_formatted[need_name] <- paste0(agents_formatted[need_name],
" (", agents_names[need_name], ")")
message_("Filtering on ", ab_group, ": ", scope,
paste(paste0("`", font_bold(agents, collapse = NULL),
"` (", ab_name(names(agents), tolower = TRUE, language = NULL), ")"),
collapse = scope_txt),
vector_or(agents_formatted, quotes = FALSE, last_sep = scope_txt),
operator, " ", vector_or(result, quotes = TRUE),
as_note = FALSE,
extra_indent = 6)
x_transposed <- as.list(as.data.frame(t(x[, agents, drop = FALSE]), stringsAsFactors = FALSE))
filtered <- vapply(FUN.VALUE = logical(1), x_transposed, function(y) scope_fn(y %in% result, na.rm = TRUE))
x <- x[which(filtered), , drop = FALSE]
class(x) <- x_class
x
# this returns the original data with the filtering, also preserving attributes (such as dplyr groups)
x.bak[which(filtered), , drop = FALSE]
}
#' @rdname filter_ab_class
@ -192,6 +208,21 @@ filter_aminoglycosides <- function(x,
...)
}
#' @rdname filter_ab_class
#' @export
filter_betalactams <- function(x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...) {
filter_ab_class(x = x,
ab_class = "carbapenem|cephalosporin|penicillin",
result = result,
scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1,
...)
}
#' @rdname filter_ab_class
#' @export
filter_carbapenems <- function(x,
@ -401,8 +432,10 @@ filter_tetracyclines <- function(x,
}
find_ab_group <- function(ab_class) {
ab_class[ab_class == "carbapenem|cephalosporin|penicillin"] <- "betalactam"
ab_class <- gsub("[^a-zA-Z0-9]", ".*", ab_class)
ifelse(ab_class %in% c("aminoglycoside",
"betalactam",
"carbapenem",
"cephalosporin",
"fluoroquinolone",
@ -424,9 +457,20 @@ find_ab_group <- function(ab_class) {
}
find_ab_names <- function(ab_group, n = 3) {
ab_group <- gsub("[^a-zA-Z0-9]", ".*", ab_group)
drugs <- antibiotics[which(antibiotics$group %like% ab_group & antibiotics$ab %unlike% "[0-9]$"), ]$name
paste0(sort(ab_name(sample(drugs, size = min(n, length(drugs)), replace = FALSE),
tolower = TRUE, language = NULL)),
collapse = ", ")
ab_group <- gsub("[^a-zA-Z|0-9]", ".*", ab_group)
# try popular first, they have DDDs
drugs <- antibiotics[which((!is.na(antibiotics$iv_ddd) | !is.na(antibiotics$oral_ddd)) &
antibiotics$name %unlike% " " &
antibiotics$group %like% ab_group &
antibiotics$ab %unlike% "[0-9]$"), ]$name
if (length(drugs) < n) {
# now try it all
drugs <- antibiotics[which(antibiotics$group %like% ab_group &
antibiotics$ab %unlike% "[0-9]$"), ]$name
}
vector_or(ab_name(sample(drugs, size = min(n, length(drugs)), replace = FALSE),
tolower = TRUE,
language = NULL),
quotes = FALSE)
}

Binary file not shown.

View File

@ -23,7 +23,14 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
pkg_suggests <- AMR:::trimws(unlist(strsplit(packageDescription("AMR")$Suggests, ",(\n)?")))
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
# some old R instances have trouble installing tinytest, so we ship it too
# R < 3.2 does not contain trimws(), which is part of this script and of a tinytest script
trimws <- AMR:::trimws
intall.packages("data-raw/tinytest_1.2.4.tar.gz")
pkg_suggests <- trimws(unlist(strsplit(packageDescription("AMR")$Suggests, ",(\n)?")))
to_install <- pkg_suggests[!pkg_suggests %in% rownames(utils::installed.packages())]
to_update <- as.data.frame(utils::old.packages(repos = "https://cran.rstudio.com/"), stringsAsFactors = FALSE)

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>

View File

@ -81,7 +81,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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>

View File

@ -39,7 +39,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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -192,7 +192,7 @@
<div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1>
<h4 class="date">17 May 2021</h4>
<h4 class="date">18 May 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small>
<div class="hidden name"><code>datasets.Rmd</code></div>

View File

@ -81,7 +81,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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>

View File

@ -81,7 +81,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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>

View File

@ -1,76 +1,37 @@
<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AMR (for R) • AMR (for R)</title>
<!-- favicons -->
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<title>Antimicrobial Resistance Data Analysis • AMR (for R)</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="apple-touch-icon.png" />
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png" />
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>
<!-- bootstrap-toc -->
<link rel="stylesheet" href="bootstrap-toc.css">
<script src="bootstrap-toc.js"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script>
<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="pkgdown.css" rel="stylesheet">
<script src="pkgdown.js"></script>
<link href="extra.css" rel="stylesheet">
<script src="extra.js"></script>
<meta property="og:title" content="AMR (for R) " />
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
<!--[if lt IE 9]>
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="bootstrap-toc.css">
<script src="bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet">
<script src="pkgdown.js"></script><link href="extra.css" rel="stylesheet">
<script src="extra.js"></script><meta property="og:title" content="Antimicrobial Resistance Data Analysis">
<meta property="og:description" content="Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by
using evidence-based methods and reliable reference data such as LPSN
&lt;doi:10.1099/ijsem.0.004332&gt;.">
<meta property="og:image" content="https://msberends.github.io/AMR/logo.png">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container template-title-body">
<header>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container template-home">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
@ -81,13 +42,13 @@
</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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<li>
<a href="index.html">
<span class="fas fa-home"></span>
@ -103,7 +64,7 @@
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<li>
<a href="articles/AMR.html">
<span class="fas fa-directions"></span>
@ -204,8 +165,8 @@
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/msberends/AMR">
<span class="fab fa-github"></span>
@ -220,23 +181,21 @@
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--/.navbar -->
</header>
<div class="row">
</header><div class="row">
<div class="contents col-md-9">
<div class="page-header">
<h1>AMR (for R) </h1>
</div>
<div id="amr-for-r-" class="section level1">
<div class="page-header"><h1 class="hasAnchor">
<a href="#amr-for-r-" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px">
</h1></div>
<p><em>Note: the rules of EUCAST Clinical Breakpoints v11.0 (2021) are now implemented.</em></p>
<div id="what-is-amr-for-r" class="section level3">
<h3 class="hasAnchor">
@ -259,9 +218,9 @@
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span>
<span class="va">example_isolates</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/dplyr/man/mutate.html">mutate</a></span><span class="op">(</span>bacteria <span class="op">=</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/dplyr/man/filter.html">filter</a></span><span class="op">(</span><span class="fu"><a href="reference/mo_property.html">mo_is_gram_negative</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span>ab <span class="op">=</span> <span class="st">"cefotax"</span><span class="op">)</span><span class="op">)</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/dplyr/man/select.html">select</a></span><span class="op">(</span><span class="va">bacteria</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>bacteria <span class="op">=</span> <span class="fu"><a href="reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="fu"><a href="reference/mo_property.html">mo_is_gram_negative</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/mo_property.html">mo_is_intrinsic_resistant</a></span><span class="op">(</span>ab <span class="op">=</span> <span class="st">"cefotax"</span><span class="op">)</span><span class="op">)</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">bacteria</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>, <span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
<span class="co">#&gt; NOTE: Using column 'mo' as input for mo_is_gram_negative()</span>
<span class="co">#&gt; NOTE: Using column 'mo' as input for mo_is_intrinsic_resistant()</span>
<span class="co">#&gt; NOTE: Determining intrinsic resistance based on 'EUCAST Expert Rules' and</span>
@ -270,7 +229,7 @@
<span class="co">#&gt; 'KAN' (kanamycin) and 'TOB' (tobramycin)</span>
<span class="co">#&gt; Selecting carbapenems: columns 'IPM' (imipenem) and 'MEM' (meropenem)</span></code></pre></div>
<p>With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (<code><a href="reference/mo_property.html">mo_is_gram_negative()</a></code> and <code><a href="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and <code><a href="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <a href="./reference/microorganisms.html">all microorganisms</a> and <a href="./reference/antibiotics.html">all antibiotics</a> in the <code>AMR</code> package make sure you get what you meant:</p>
<table>
<table class="table">
<thead><tr class="header">
<th align="left">bacteria</th>
<th align="center">AMK</th>
@ -432,7 +391,7 @@
<p>The latest and unpublished development version can be installed from GitHub using:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span><span class="op">(</span><span class="st">"remotes"</span><span class="op">)</span> <span class="co"># if you haven't already</span>
<span class="fu">remotes</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/remotes/man/install_github.html">install_github</a></span><span class="op">(</span><span class="st">"msberends/AMR"</span><span class="op">)</span></code></pre></div>
<span class="fu">remotes</span><span class="fu">::</span><span class="fu"><a href="https://remotes.r-lib.org/reference/install_github.html">install_github</a></span><span class="op">(</span><span class="st">"msberends/AMR"</span><span class="op">)</span></code></pre></div>
<p>You can also download the latest build from our repository: <a href="https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz" class="uri">https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz</a></p>
</div>
</div>
@ -494,7 +453,7 @@
<li>
<p>It <strong>analyses the data</strong> with convenient functions that use well-known methods.</p>
<ul>
<li>Calculate the microbial susceptibility or resistance (and even co-resistance) with the <code><a href="reference/proportion.html">susceptibility()</a></code> and <code><a href="reference/proportion.html">resistance()</a></code> functions, or be even more specific with the <code><a href="reference/proportion.html">proportion_R()</a></code>, <code><a href="reference/proportion.html">proportion_IR()</a></code>, <code><a href="reference/proportion.html">proportion_I()</a></code>, <code><a href="reference/proportion.html">proportion_SI()</a></code> and <code><a href="reference/proportion.html">proportion_S()</a></code> functions. Similarly, the <em>number</em> of isolates can be determined with the <code><a href="reference/count.html">count_resistant()</a></code>, <code><a href="reference/count.html">count_susceptible()</a></code> and <code><a href="reference/count.html">count_all()</a></code> functions. All these functions can be used with the <code>dplyr</code> package (e.g. in conjunction with <code><a href="https://rdrr.io/pkg/dplyr/man/summarise.html">summarise()</a></code>)</li>
<li>Calculate the microbial susceptibility or resistance (and even co-resistance) with the <code><a href="reference/proportion.html">susceptibility()</a></code> and <code><a href="reference/proportion.html">resistance()</a></code> functions, or be even more specific with the <code><a href="reference/proportion.html">proportion_R()</a></code>, <code><a href="reference/proportion.html">proportion_IR()</a></code>, <code><a href="reference/proportion.html">proportion_I()</a></code>, <code><a href="reference/proportion.html">proportion_SI()</a></code> and <code><a href="reference/proportion.html">proportion_S()</a></code> functions. Similarly, the <em>number</em> of isolates can be determined with the <code><a href="reference/count.html">count_resistant()</a></code>, <code><a href="reference/count.html">count_susceptible()</a></code> and <code><a href="reference/count.html">count_all()</a></code> functions. All these functions can be used with the <code>dplyr</code> package (e.g. in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>)</li>
<li>Plot AMR results with <code><a href="reference/ggplot_rsi.html">geom_rsi()</a></code>, a function made for the <code>ggplot2</code> package</li>
<li>Predict antimicrobial resistance for the nextcoming years using logistic regression models with the <code><a href="reference/resistance_predict.html">resistance_predict()</a></code> function</li>
</ul>
@ -541,22 +500,59 @@
</ul>
</div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top">
<h2 data-toc-skip>Contents</h2>
</nav>
</div>
<div class="links">
<h2>Links</h2>
<ul class="list-unstyled">
<li>Download from CRAN at <br><a href="https://cloud.r-project.org/package=AMR">https://cloud.r-project.org/package=AMR</a>
</li>
<li>Browse source code at <br><a href="https://github.com/msberends/AMR/">https://github.com/msberends/AMR/</a>
</li>
<li>Report a bug at <br><a href="https://github.com/msberends/AMR/issues">https://github.com/msberends/AMR/issues</a>
</li>
</ul>
</div>
<div class="license">
<h2>License</h2>
<ul class="list-unstyled">
<li>
<a href="https://www.r-project.org/Licenses/GPL-2">GPL-2</a> | file <a href="LICENSE-text.html">LICENSE</a>
</li>
</ul>
</div>
<div class="citation">
<h2>Citation</h2>
<ul class="list-unstyled">
<li><a href="authors.html">Citing AMR</a></li>
</ul>
</div>
<div class="developers">
<h2>Developers</h2>
<ul class="list-unstyled">
<li>
<a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a> <br><small class="roles"> Author, maintainer </small> <a href="https://orcid.org/0000-0001-7620-1800" target="orcid.widget" aria-label="ORCID"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>
<a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a> <br><small class="roles"> Author, contributor </small> <a href="https://orcid.org/0000-0001-5809-5995" target="orcid.widget" aria-label="ORCID"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>
<a href="https://www.rug.nl/staff/a.w.friedrich/">Alexander W. Friedrich</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-4881-038X" target="orcid.widget" aria-label="ORCID"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>
<a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-1634-0010" target="orcid.widget" aria-label="ORCID"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>
<a href="https://www.rug.nl/staff/c.j.albers/">Casper J. Albers</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0002-9213-6743" target="orcid.widget" aria-label="ORCID"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>
<a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-1241-1328" target="orcid.widget" aria-label="ORCID"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li><a href="authors.html">All authors...</a></li>
</ul>
</div>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alexander W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
<footer><div class="copyright">
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/">Alexander W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a>, <a href="https://www.rug.nl/staff/c.j.albers/">Casper J. Albers</a>, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>.</p>
</div>
<div class="pkgdown">
@ -564,12 +560,10 @@
</div>
</footer>
</div>
</div>
</body>
</html>

View File

@ -81,7 +81,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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -236,12 +236,12 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1609043" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9043">
<a href="#amr-1609043" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9043</h1>
<div id="last-updated-17-may-2021" class="section level2">
<div id="amr-1609044" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9044">
<a href="#amr-1609044" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9044</h1>
<div id="last-updated-18-may-2021" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-17-may-2021" class="anchor"></a><small>Last updated: 17 May 2021</small>
<a href="#last-updated-18-may-2021" class="anchor"></a><small>Last updated: 18 May 2021</small>
</h2>
<div id="new" class="section level3">
<h3 class="hasAnchor">
@ -262,7 +262,8 @@
<li>The documentation of the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> and <code><a href="../reference/key_antimicrobials.html">key_antimicrobials()</a></code> functions has been completely rewritten.</li>
</ul>
</li>
<li>Added <code>ggplot()</code> method for <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>
<li>Function <code><a href="../reference/antibiotic_class_selectors.html">betalactams()</a></code> as additional antbiotic column selector and function <code><a href="../reference/filter_ab_class.html">filter_betalactams()</a></code> as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.</li>
<li>A <code>ggplot()</code> method for <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>
</li>
</ul>
</div>
@ -306,7 +307,8 @@
<li>Updated <code><a href="https://docs.ropensci.org/skimr/reference/skim.html">skimr::skim()</a></code> usage for MIC values to also include 25th and 75th percentiles</li>
<li>Fix for plotting missing MIC/disk diffusion values</li>
<li>Updated join functions to always use <code>dplyr</code> join functions if the <code>dplyr</code> package is installed - now also preserving grouped variables</li>
<li>Fix for filtering on antibiotic classes (such as <code><a href="../reference/filter_ab_class.html">filter_cephalosporins()</a></code>)</li>
<li>Fix for filtering on antibiotic classes (such as <code><a href="../reference/filter_ab_class.html">filter_cephalosporins()</a></code>), which now also supports dplyr groups</li>
<li>Antibiotic class selectors (such as <code><a href="../reference/antibiotic_class_selectors.html">cephalosporins()</a></code>) now maintain the column order from the original data</li>
</ul>
</div>
<div id="other" class="section level3">

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2021-05-17T17:42Z
last_built: 2021-05-17T22:52Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles

View File

@ -83,7 +83,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">1.6.0.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -248,6 +248,8 @@
<span class='fu'>aminoglycosides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>betalactams</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>carbapenems</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>cephalosporins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
@ -292,6 +294,7 @@
<p><strong>
</strong></p>
<p>All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.) in the <a href='antibiotics.html'>antibiotics</a> data set. This means that a selector like e.g. <code>aminoglycosides()</code> will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.</p>
<p>The group of betalactams consists of all carbapenems, cephalosporins and penicillins.</p>
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>

View File

@ -82,7 +82,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">1.6.0.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -259,6 +259,14 @@
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_betalactams</span><span class='op'>(</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_carbapenems</span><span class='op'>(</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
@ -395,6 +403,7 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>All columns of <code>x</code> will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a filter function like e.g. <code>filter_aminoglycosides()</code> will include column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.</p>
<p>The group of betalactams consists of all carbapenems, cephalosporins and penicillins.</p>
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>

View File

@ -83,7 +83,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">1.6.0.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -375,7 +375,7 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>To conduct epidemiological analyses on antimicrobial resistance data, only so-called first isolates should be included to prevent overestimation and underestimation of antimicrobial resistance. Different methods can be used to do so, see below.</p>
<p>These functions are context-aware. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
<p>These functions are context-aware. This means that the <code>x</code> argument can be left blank if used inside a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> call, see <em>Examples</em>.</p>
<p>The <code>first_isolate()</code> function is a wrapper around the <code><a href='get_episode.html'>is_new_episode()</a></code> function, but more efficient for data sets containing microorganism codes or names.</p>
<p>All isolates with a microbial ID of <code>NA</code> will be excluded as first isolate.</p><h3 class='hasAnchor' id='arguments'><a class='anchor' href='#arguments'></a>Different methods</h3>

View File

@ -81,7 +81,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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -526,13 +526,13 @@
</tr><tr>
<td>
<p><code><a href="antibiotic_class_selectors.html">ab_class()</a></code> <code><a href="antibiotic_class_selectors.html">aminoglycosides()</a></code> <code><a href="antibiotic_class_selectors.html">carbapenems()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_1st()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_2nd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_3rd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_4th()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_5th()</a></code> <code><a href="antibiotic_class_selectors.html">fluoroquinolones()</a></code> <code><a href="antibiotic_class_selectors.html">glycopeptides()</a></code> <code><a href="antibiotic_class_selectors.html">macrolides()</a></code> <code><a href="antibiotic_class_selectors.html">oxazolidinones()</a></code> <code><a href="antibiotic_class_selectors.html">penicillins()</a></code> <code><a href="antibiotic_class_selectors.html">tetracyclines()</a></code> </p>
<p><code><a href="antibiotic_class_selectors.html">ab_class()</a></code> <code><a href="antibiotic_class_selectors.html">aminoglycosides()</a></code> <code><a href="antibiotic_class_selectors.html">betalactams()</a></code> <code><a href="antibiotic_class_selectors.html">carbapenems()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_1st()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_2nd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_3rd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_4th()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_5th()</a></code> <code><a href="antibiotic_class_selectors.html">fluoroquinolones()</a></code> <code><a href="antibiotic_class_selectors.html">glycopeptides()</a></code> <code><a href="antibiotic_class_selectors.html">macrolides()</a></code> <code><a href="antibiotic_class_selectors.html">oxazolidinones()</a></code> <code><a href="antibiotic_class_selectors.html">penicillins()</a></code> <code><a href="antibiotic_class_selectors.html">tetracyclines()</a></code> </p>
</td>
<td><p>Antibiotic Class Selectors</p></td>
</tr><tr>
<td>
<p><code><a href="filter_ab_class.html">filter_ab_class()</a></code> <code><a href="filter_ab_class.html">filter_aminoglycosides()</a></code> <code><a href="filter_ab_class.html">filter_carbapenems()</a></code> <code><a href="filter_ab_class.html">filter_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_1st_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_2nd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_3rd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_4th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_5th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_fluoroquinolones()</a></code> <code><a href="filter_ab_class.html">filter_glycopeptides()</a></code> <code><a href="filter_ab_class.html">filter_macrolides()</a></code> <code><a href="filter_ab_class.html">filter_oxazolidinones()</a></code> <code><a href="filter_ab_class.html">filter_penicillins()</a></code> <code><a href="filter_ab_class.html">filter_tetracyclines()</a></code> </p>
<p><code><a href="filter_ab_class.html">filter_ab_class()</a></code> <code><a href="filter_ab_class.html">filter_aminoglycosides()</a></code> <code><a href="filter_ab_class.html">filter_betalactams()</a></code> <code><a href="filter_ab_class.html">filter_carbapenems()</a></code> <code><a href="filter_ab_class.html">filter_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_1st_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_2nd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_3rd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_4th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_5th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_fluoroquinolones()</a></code> <code><a href="filter_ab_class.html">filter_glycopeptides()</a></code> <code><a href="filter_ab_class.html">filter_macrolides()</a></code> <code><a href="filter_ab_class.html">filter_oxazolidinones()</a></code> <code><a href="filter_ab_class.html">filter_penicillins()</a></code> <code><a href="filter_ab_class.html">filter_tetracyclines()</a></code> </p>
</td>
<td><p>Filter Isolates on Result in Antimicrobial Class</p></td>
</tr><tr>

View File

@ -82,7 +82,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">1.6.0.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -323,7 +323,7 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>The <code>key_antimicrobials()</code> and <code>all_antimicrobials()</code> functions are context-aware. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
<p>The <code>key_antimicrobials()</code> and <code>all_antimicrobials()</code> functions are context-aware. This means that the <code>x</code> argument can be left blank if used inside a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> call, see <em>Examples</em>.</p>
<p>The function <code>key_antimicrobials()</code> returns a <a href='https://rdrr.io/r/base/character.html'>character</a> vector with 12 antimicrobial results for every isolate. The function <code>all_antimicrobials()</code> returns a <a href='https://rdrr.io/r/base/character.html'>character</a> vector with all antimicrobial results for every isolate. These vectors can then be compared using <code>antimicrobials_equal()</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>) by <code>key_antimicrobials()</code> and ignored by <code>antimicrobials_equal()</code>.</p>
<p>Please see the <code><a href='first_isolate.html'>first_isolate()</a></code> function how these important functions enable the 'phenotype-based' method for determination of first isolates.</p>
<p>The default antimicrobial agents used for <strong>all rows</strong> (set in <code>universal</code>) are:</p><ul>

View File

@ -82,7 +82,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">1.6.0.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>
@ -330,7 +330,7 @@ Ordered <a href='https://rdrr.io/r/base/factor.html'>factor</a> with levels <cod
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>These functions are context-aware. This means that then the <code>x</code> argument can be left blank, see <em>Examples</em>.</p>
<p>These functions are context-aware. This means that the <code>x</code> argument can be left blank if used inside a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> call, see <em>Examples</em>.</p>
<p>For the <code>pct_required_classes</code> argument, values above 1 will be divided by 100. This is to support both fractions (<code>0.75</code> or <code>3/4</code>) and percentages (<code>75</code>).</p>
<p><strong>Note:</strong> Every test that involves the Enterobacteriaceae family, will internally be performed using its newly named <em>order</em> Enterobacterales, since the Enterobacteriaceae family has been taxonomically reclassified by Adeolu <em>et al.</em> in 2016. Before that, Enterobacteriaceae was the only family under the Enterobacteriales (with an i) order. All species under the old Enterobacteriaceae family are still under the new Enterobacterales (without an i) order, but divided into multiple families. The way tests are performed now by this <code>mdro()</code> function makes sure that results from before 2016 and after 2016 are identical.</p>
<h2 class="hasAnchor" id="supported-international-national-guidelines"><a class="anchor" href="#supported-international-national-guidelines"></a>Supported International / National Guidelines</h2>

View File

@ -81,7 +81,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">1.6.0.9043</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9044</span>
</span>
</div>

View File

@ -23,20 +23,21 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
if (pkg_is_available("dplyr")) {
expect_true(example_isolates %>% select(aminoglycosides()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(carbapenems()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(cephalosporins()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(cephalosporins_1st()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(cephalosporins_2nd()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(cephalosporins_3rd()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(cephalosporins_4th()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(cephalosporins_5th()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(fluoroquinolones()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(glycopeptides()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(macrolides()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(oxazolidinones()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(penicillins()) %>% ncol() < ncol(example_isolates))
expect_true(example_isolates %>% select(tetracyclines()) %>% ncol() < ncol(example_isolates))
if (as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) >= 3.2) {
# antibiotic class selectors require at least R-3.2
expect_true(ncol(example_isolates[, aminoglycosides(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, betalactams(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, carbapenems(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, cephalosporins(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, cephalosporins_1st(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, cephalosporins_2nd(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, cephalosporins_3rd(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, cephalosporins_4th(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, cephalosporins_5th(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, fluoroquinolones(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, glycopeptides(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, macrolides(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, oxazolidinones(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, penicillins(), drop = FALSE]) < ncol(example_isolates))
expect_true(ncol(example_isolates[, tetracyclines(), drop = FALSE]) < ncol(example_isolates))
}

View File

@ -26,13 +26,14 @@
if (pkg_is_available("dplyr")) {
expect_true(example_isolates %>% filter_ab_class("carbapenem") %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_aminoglycosides() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_betalactams() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_carbapenems() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_cephalosporins() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_1st_cephalosporins() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_2nd_cephalosporins() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_3rd_cephalosporins() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_4th_cephalosporins() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_5th_cephalosporins() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% mutate(ceftaroline = CTX) %>% filter_5th_cephalosporins() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_fluoroquinolones() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_glycopeptides() %>% nrow() < nrow(example_isolates))
expect_true(example_isolates %>% filter_macrolides() %>% nrow() < nrow(example_isolates))

View File

@ -4,6 +4,7 @@
\alias{antibiotic_class_selectors}
\alias{ab_class}
\alias{aminoglycosides}
\alias{betalactams}
\alias{carbapenems}
\alias{cephalosporins}
\alias{cephalosporins_1st}
@ -23,6 +24,8 @@ ab_class(ab_class, only_rsi_columns = FALSE)
aminoglycosides(only_rsi_columns = FALSE)
betalactams(only_rsi_columns = FALSE)
carbapenems(only_rsi_columns = FALSE)
cephalosporins(only_rsi_columns = FALSE)
@ -61,6 +64,8 @@ These functions help to select the columns of antibiotics that are of a specific
\strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.) in the \link{antibiotics} data set. This means that a selector like e.g. \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
}
\section{Stable Lifecycle}{

View File

@ -3,6 +3,7 @@
\name{filter_ab_class}
\alias{filter_ab_class}
\alias{filter_aminoglycosides}
\alias{filter_betalactams}
\alias{filter_carbapenems}
\alias{filter_cephalosporins}
\alias{filter_1st_cephalosporins}
@ -35,6 +36,14 @@ filter_aminoglycosides(
...
)
filter_betalactams(
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_carbapenems(
x,
result = NULL,
@ -157,6 +166,8 @@ Filter isolates on results in specific antimicrobial classes. This makes it easy
}
\details{
All columns of \code{x} will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a filter function like e.g. \code{\link[=filter_aminoglycosides]{filter_aminoglycosides()}} will include column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
The group of betalactams consists of all carbapenems, cephalosporins and penicillins.
}
\section{Stable Lifecycle}{