Compare commits
2 Commits
20d638c193
...
8fda473e49
Author | SHA1 | Date | |
---|---|---|---|
8fda473e49 | |||
2eca8c3f01 |
4
.github/workflows/check.yaml
vendored
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
on:
|
||||
|
4
.github/workflows/codecovr.yaml
vendored
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
on:
|
||||
|
4
.github/workflows/lintr.yaml
vendored
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
on:
|
||||
|
@ -1,7 +1,7 @@
|
||||
Package: AMR
|
||||
Version: 1.5.0.9013
|
||||
Date: 2021-01-28
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Version: 1.5.0.9015
|
||||
Date: 2021-02-04
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
family = "Berends", given = c("Matthijs", "S."), email = "m.s.berends@umcg.nl", comment = c(ORCID = "0000-0001-7620-1800")),
|
||||
|
36
NEWS.md
@ -1,5 +1,25 @@
|
||||
# AMR 1.5.0.9013
|
||||
## <small>Last updated: 28 January 2021</small>
|
||||
# AMR 1.5.0.9015
|
||||
## <small>Last updated: 4 February 2021</small>
|
||||
|
||||
### Breaking
|
||||
* Functions that are applied to a data set containing antibiotic columns gained the argument `only_rsi_columns`, which defaults to `TRUE` if any of the columns are of class `<rsi>` (i.e., transformed with `as.rsi()`). This increases reliability of automatic determination of antibiotic columns (so only columns that are defined to be `<rsi>` will be affected).
|
||||
|
||||
This change might invalidate existing code. But since the new argument always returns `FALSE` when no `<rsi>` column can be found in the data, this chance is low.
|
||||
|
||||
Affected functions are:
|
||||
* All antibiotic selector functions (`ab_class()` and its wrappers, such as `aminoglocysides()`, `carbapenems()`, `penicillins()`)
|
||||
* All antibiotic filter functions (`filter_ab_class()` and its wrappers, such as `filter_aminoglocysides()`, `filter_carbapenems()`, `filter_penicillins()`)
|
||||
* `eucast_rules()`
|
||||
* `mdro()` (including wrappers such as `brmo()`, `mrgn` and `eucast_exceptional_phenotypes()`)
|
||||
* `guess_ab_col()`
|
||||
|
||||
You can quickly transform all your eligible columns using either:
|
||||
|
||||
```r
|
||||
library(dplyr)
|
||||
your_date %>% mutate_if(is.rsi.eligible, as.rsi) # old dplyr
|
||||
your_date %>% mutate(across((is.rsi.eligible), as.rsi)) # new dplyr
|
||||
```
|
||||
|
||||
### New
|
||||
* Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package.
|
||||
@ -28,21 +48,23 @@
|
||||
```
|
||||
|
||||
### Changed
|
||||
* `is.rsi()` and `is.rsi.eligible()` now return a vector of `TRUE`/`FALSE` when the input is a data set, by iterating over all columns
|
||||
* Using functions without setting a data set (e.g., `mo_is_gram_negative()`, `mo_is_gram_positive()`, `mo_is_intrinsic_resistant()`, `first_isolate()`, `mdro()`) now work with `dplyr`s `group_by()` again
|
||||
* `first_isolate()` can be used with `group_by()` (also when using a dot `.` as input for the data) and now returns the names of the groups
|
||||
* Updated the data set `microorganisms.codes` (which contains popular LIS and WHONET codes for microorganisms) for some species of *Mycobacterium* that previously incorrectly returned *M. africanum*
|
||||
* Added Pretomanid (PMD, J04AK08) to the `antibiotics` data set
|
||||
* WHONET code `"PNV"` will now correctly be interpreted as `PHN`, the antibiotic code for phenoxymethylpenicillin ('peni V')
|
||||
* Fix for verbose output of `mdro(..., verbose = TRUE)` for German guideline (3MGRN and 4MGRN) and Dutch guideline (BRMO, only *P. aeruginosa*)
|
||||
* `is.rsi.eligible()` now returns `FALSE` immediately if the input does not contain any of the values "R", "S" or "I". This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
|
||||
* `is.rsi.eligible()` now detects if the column name resembles an antibiotic name or code and now returns `TRUE` immediately if the input contains any of the values "R", "S" or "I". This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
|
||||
* Functions `get_episode()` and `is_new_episode()` now support less than a day as value for argument `episode_days` (e.g., to include one patient/test per hour)
|
||||
* Argument `ampc_cephalosporin_resistance` in `eucast_rules()` now also applies to value "I" (not only "S")
|
||||
* Updated colours of values R, S and I in tibble printing
|
||||
* Functions `print()` and `summary()` on a Principal Components Analysis object (`pca()`) now print additional group info if the original data was grouped using `dplyr::group_by()`
|
||||
|
||||
* Improved speed of `guess_ab_col()`
|
||||
|
||||
### Other
|
||||
* Big documentation updates
|
||||
* Loading the package (i.e., `library(AMR)`) now is ~50 times faster than before, in costs of package size (increased with ~3 MB)
|
||||
* Loading the package (i.e., `library(AMR)`) now is ~50 times faster than before, in costs of package size (which increased by ~3 MB)
|
||||
|
||||
|
||||
# AMR 1.5.0
|
||||
@ -698,7 +720,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag
|
||||
We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.gitlab.io/AMR/) (built with the great [`pkgdown`](https://pkgdown.r-lib.org/))
|
||||
|
||||
* Contains the complete manual of this package and all of its functions with an explanation of their arguments
|
||||
* Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis, import data from WHONET or SPSS and many more.
|
||||
* Contains a comprehensive tutorial about how to conduct AMR data analysis, import data from WHONET or SPSS and many more.
|
||||
|
||||
#### New
|
||||
* **BREAKING**: removed deprecated functions, arguments and references to 'bactid'. Use `as.mo()` to identify an MO code.
|
||||
@ -757,7 +779,7 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git
|
||||
* New function `mo_uncertainties()` to review values that could be coerced to a valid MO code using `as.mo()`, but with uncertainty.
|
||||
* New function `mo_renamed()` to get a list of all returned values from `as.mo()` that have had taxonomic renaming
|
||||
* New function `age()` to calculate the (patients) age in years
|
||||
* New function `age_groups()` to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
|
||||
* New function `age_groups()` to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic AMR data analysis per age group.
|
||||
* New function `ggplot_rsi_predict()` as well as the base R `plot()` function can now be used for resistance prediction calculated with `resistance_predict()`:
|
||||
```r
|
||||
x <- resistance_predict(septic_patients, col_ab = "amox")
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# faster implementation of left_join than using merge() by poorman - we use match():
|
||||
@ -85,7 +85,7 @@ check_dataset_integrity <- function() {
|
||||
warning_(ifelse(length(overwritten) == 1,
|
||||
"The following data set is overwritten by your global environment and prevents the AMR package from working correctly: ",
|
||||
"The following data sets are overwritten by your global environment and prevent the AMR package from working correctly: "),
|
||||
paste0("'", overwritten, "'", collapse = ", "),
|
||||
vector_and(overwritten, quotes = "'"),
|
||||
".\nPlease rename your object(s).", call = FALSE)
|
||||
}
|
||||
# check if other packages did not overwrite our data sets
|
||||
@ -442,29 +442,38 @@ create_ab_documentation <- function(ab) {
|
||||
out
|
||||
}
|
||||
|
||||
vector_or <- function(v, quotes = TRUE, reverse = FALSE, last_sep = " or ") {
|
||||
vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, last_sep = " or ") {
|
||||
# makes unique and sorts, and this also removed NAs
|
||||
v <- sort(unique(v))
|
||||
if (length(v) == 1) {
|
||||
return(paste0(ifelse(quotes, '"', ""), v, ifelse(quotes, '"', "")))
|
||||
v <- unique(v)
|
||||
if (isTRUE(sort)) {
|
||||
v <- sort(v)
|
||||
}
|
||||
if (reverse == TRUE) {
|
||||
if (isTRUE(reverse)) {
|
||||
v <- rev(v)
|
||||
}
|
||||
if (identical(v, c("I", "R", "S"))) {
|
||||
# class <rsi> should be sorted like this
|
||||
v <- c("R", "S", "I")
|
||||
}
|
||||
if (isTRUE(quotes)) {
|
||||
quotes <- '"'
|
||||
} else if (isFALSE(quotes)) {
|
||||
quotes <- ""
|
||||
} else {
|
||||
quotes <- quotes[1L]
|
||||
}
|
||||
if (length(v) == 1) {
|
||||
return(paste0(quotes, v, quotes))
|
||||
}
|
||||
if (identical(v, c("I", "R", "S"))) {
|
||||
# class <rsi> should be sorted like this
|
||||
v <- c("R", "S", "I")
|
||||
}
|
||||
# all commas except for last item, so will become '"val1", "val2", "val3" or "val4"'
|
||||
paste0(paste0(quotes, v[seq_len(length(v) - 1)], quotes, collapse = ", "),
|
||||
last_sep, paste0(quotes, v[length(v)], quotes))
|
||||
}
|
||||
|
||||
vector_and <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE) {
|
||||
vector_or(v = v, quotes = quotes, reverse = reverse, sort = sort, last_sep = " and ")
|
||||
}
|
||||
|
||||
format_class <- function(class, plural) {
|
||||
class.bak <- class
|
||||
class[class == "numeric"] <- "number"
|
||||
@ -673,6 +682,45 @@ get_current_data <- function(arg_name, call) {
|
||||
}
|
||||
}
|
||||
|
||||
get_current_column <- function() {
|
||||
# try dplyr::cur_columns() first
|
||||
cur_column <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_column)) {
|
||||
out <- tryCatch(cur_column(), error = function(e) NULL)
|
||||
if (!is.null(out)) {
|
||||
return(out)
|
||||
}
|
||||
}
|
||||
|
||||
# cur_column() doesn't always work (only allowed for conditions set by dplyr), but it's probably still possible:
|
||||
frms <- lapply(sys.frames(), function(el) {
|
||||
if ("i" %in% names(el)) {
|
||||
if ("tibble_vars" %in% names(el)) {
|
||||
# for mutate_if()
|
||||
el$tibble_vars[el$i]
|
||||
} else {
|
||||
# for mutate(across())
|
||||
df <- tryCatch(get_current_data(NA, 0), error = function(e) NULL)
|
||||
if (is.data.frame(df)) {
|
||||
colnames(df)[el$i]
|
||||
} else {
|
||||
el$i
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
})
|
||||
|
||||
vars <- unlist(frms)
|
||||
if (length(vars) > 0) {
|
||||
vars[length(vars)]
|
||||
} else {
|
||||
# not found, so:
|
||||
NULL
|
||||
}
|
||||
}
|
||||
|
||||
unique_call_id <- function(entire_session = FALSE) {
|
||||
if (entire_session == TRUE) {
|
||||
c(envir = "session",
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# ------------------------------------------------
|
||||
|
25
R/ab.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Transform Input to an Antibiotic ID
|
||||
@ -103,6 +103,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
|
||||
initial_search <- is.null(list(...)$initial_search)
|
||||
already_regex <- isTRUE(list(...)$already_regex)
|
||||
fast_mode <- isTRUE(list(...)$fast_mode)
|
||||
|
||||
if (all(toupper(x) %in% antibiotics$ab)) {
|
||||
# valid AB code, but not yet right class
|
||||
@ -115,7 +116,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
# remove diacritics
|
||||
x <- iconv(x, from = "UTF-8", to = "ASCII//TRANSLIT")
|
||||
x <- gsub('"', "", x, fixed = TRUE)
|
||||
x <- gsub("(specimen|specimen date|specimen_date|spec_date)", "", x, ignore.case = TRUE, perl = TRUE)
|
||||
x <- gsub("(specimen|specimen date|specimen_date|spec_date|^dates?$)", "", x, ignore.case = TRUE, perl = TRUE)
|
||||
x_bak_clean <- x
|
||||
if (already_regex == FALSE) {
|
||||
x_bak_clean <- generalise_antibiotic_name(x_bak_clean)
|
||||
@ -133,7 +134,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
}
|
||||
if (length(abnames) > 1) {
|
||||
message_("More than one result was found for item ", index, ": ",
|
||||
paste0(abnames, collapse = ", "))
|
||||
vector_and(abnames, quotes = FALSE))
|
||||
}
|
||||
}
|
||||
found[1L]
|
||||
@ -145,6 +146,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
}
|
||||
|
||||
for (i in seq_len(length(x))) {
|
||||
|
||||
if (initial_search == TRUE) {
|
||||
progress$tick()
|
||||
}
|
||||
@ -161,7 +163,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
next
|
||||
}
|
||||
|
||||
if (isTRUE(flag_multiple_results) & x[i] %like% "[ ]") {
|
||||
if (fast_mode == FALSE && flag_multiple_results == TRUE && x[i] %like% "[ ]") {
|
||||
from_text <- tryCatch(suppressWarnings(ab_from_text(x[i], initial_search = FALSE, translate_ab = FALSE)[[1]]),
|
||||
error = function(e) character(0))
|
||||
} else {
|
||||
@ -283,7 +285,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
|
||||
# INITIAL SEARCH - More uncertain results ----
|
||||
|
||||
if (initial_search == TRUE) {
|
||||
if (initial_search == TRUE && fast_mode == FALSE) {
|
||||
# only run on first try
|
||||
|
||||
# try by removing all spaces
|
||||
@ -358,7 +360,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
|
||||
# try from a bigger text, like from a health care record, see ?ab_from_text
|
||||
# already calculated above if flag_multiple_results = TRUE
|
||||
if (isTRUE(flag_multiple_results)) {
|
||||
if (flag_multiple_results == TRUE) {
|
||||
found <- from_text[1L]
|
||||
} else {
|
||||
found <- tryCatch(suppressWarnings(ab_from_text(x[i], initial_search = FALSE, translate_ab = FALSE)[[1]][1L]),
|
||||
@ -452,21 +454,20 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
|
||||
x_unknown <- x_unknown[!x_unknown %in% x_unknown_ATCs]
|
||||
if (length(x_unknown_ATCs) > 0) {
|
||||
warning_("These ATC codes are not (yet) in the antibiotics data set: ",
|
||||
paste('"', sort(unique(x_unknown_ATCs)), '"', sep = "", collapse = ", "),
|
||||
".",
|
||||
vector_and(x_unknown_ATCs), ".",
|
||||
call = FALSE)
|
||||
}
|
||||
|
||||
if (length(x_unknown) > 0) {
|
||||
if (length(x_unknown) > 0 & fast_mode == FALSE) {
|
||||
warning_("These values could not be coerced to a valid antimicrobial ID: ",
|
||||
paste('"', sort(unique(x_unknown)), '"', sep = "", collapse = ", "),
|
||||
vector_and(x_unknown), ".",
|
||||
".",
|
||||
call = FALSE)
|
||||
}
|
||||
|
||||
x_result <- data.frame(x = x_bak_clean, stringsAsFactors = FALSE) %pm>%
|
||||
pm_left_join(data.frame(x = x, x_new = x_new, stringsAsFactors = FALSE), by = "x") %pm>%
|
||||
pm_pull(x_new)
|
||||
pm_pull(x_new)
|
||||
|
||||
if (length(x_result) == 0) {
|
||||
x_result <- NA_character_
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,13 +20,14 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Antibiotic Class Selectors
|
||||
#'
|
||||
#' These functions help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \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, "."), "")}}
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param only_rsi_columns a logical to indicate whether only columns of class [`<rsi>`]([rsi]) must be selected. If set to `NULL` (default), it will be `TRUE` if any column of the data was [transformed to class `<rsi>`]([rsi]) on beforehand, and `FALSE` otherwise.
|
||||
#' @inheritParams filter_ab_class
|
||||
#' @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, "."), "")}}
|
||||
#'
|
||||
@ -79,91 +80,95 @@
|
||||
#' example_isolates %>% filter_carbapenems("R", "all")
|
||||
#' example_isolates %>% filter(across(carbapenems(), ~. == "R"))
|
||||
#' }
|
||||
ab_class <- function(ab_class) {
|
||||
ab_selector(ab_class, function_name = "ab_class")
|
||||
ab_class <- function(ab_class,
|
||||
only_rsi_columns = NULL) {
|
||||
ab_selector(ab_class, function_name = "ab_class", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
aminoglycosides <- function() {
|
||||
ab_selector("aminoglycoside", function_name = "aminoglycosides")
|
||||
aminoglycosides <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("aminoglycoside", function_name = "aminoglycosides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
carbapenems <- function() {
|
||||
ab_selector("carbapenem", function_name = "carbapenems")
|
||||
carbapenems <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("carbapenem", function_name = "carbapenems", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins <- function() {
|
||||
ab_selector("cephalosporin", function_name = "cephalosporins")
|
||||
cephalosporins <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("cephalosporin", function_name = "cephalosporins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_1st <- function() {
|
||||
ab_selector("cephalosporins.*1", function_name = "cephalosporins_1st")
|
||||
cephalosporins_1st <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("cephalosporins.*1", function_name = "cephalosporins_1st", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_2nd <- function() {
|
||||
ab_selector("cephalosporins.*2", function_name = "cephalosporins_2nd")
|
||||
cephalosporins_2nd <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("cephalosporins.*2", function_name = "cephalosporins_2nd", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_3rd <- function() {
|
||||
ab_selector("cephalosporins.*3", function_name = "cephalosporins_3rd")
|
||||
cephalosporins_3rd <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("cephalosporins.*3", function_name = "cephalosporins_3rd", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_4th <- function() {
|
||||
ab_selector("cephalosporins.*4", function_name = "cephalosporins_4th")
|
||||
cephalosporins_4th <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("cephalosporins.*4", function_name = "cephalosporins_4th", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
cephalosporins_5th <- function() {
|
||||
ab_selector("cephalosporins.*5", function_name = "cephalosporins_5th")
|
||||
cephalosporins_5th <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("cephalosporins.*5", function_name = "cephalosporins_5th", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
fluoroquinolones <- function() {
|
||||
ab_selector("fluoroquinolone", function_name = "fluoroquinolones")
|
||||
fluoroquinolones <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("fluoroquinolone", function_name = "fluoroquinolones", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
glycopeptides <- function() {
|
||||
ab_selector("glycopeptide", function_name = "glycopeptides")
|
||||
glycopeptides <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("glycopeptide", function_name = "glycopeptides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
macrolides <- function() {
|
||||
ab_selector("macrolide", function_name = "macrolides")
|
||||
macrolides <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("macrolide", function_name = "macrolides", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
penicillins <- function() {
|
||||
ab_selector("penicillin", function_name = "penicillins")
|
||||
penicillins <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("penicillin", function_name = "penicillins", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
#' @rdname antibiotic_class_selectors
|
||||
#' @export
|
||||
tetracyclines <- function() {
|
||||
ab_selector("tetracycline", function_name = "tetracyclines")
|
||||
tetracyclines <- function(only_rsi_columns = NULL) {
|
||||
ab_selector("tetracycline", function_name = "tetracyclines", only_rsi_columns = only_rsi_columns)
|
||||
}
|
||||
|
||||
ab_selector <- function(ab_class, function_name) {
|
||||
ab_selector <- function(ab_class,
|
||||
function_name,
|
||||
only_rsi_columns) {
|
||||
meet_criteria(ab_class, allow_class = "character", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(function_name, allow_class = "character", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, allow_NULL = TRUE, .call_depth = 1)
|
||||
|
||||
if (as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2) {
|
||||
warning_("antibiotic class selectors such as ", function_name,
|
||||
@ -173,10 +178,12 @@ ab_selector <- function(ab_class, function_name) {
|
||||
}
|
||||
|
||||
vars_df <- get_current_data(arg_name = NA, call = -3)
|
||||
|
||||
if (is.null(only_rsi_columns)) {
|
||||
only_rsi_columns <- any(is.rsi(vars_df))
|
||||
}
|
||||
# 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)
|
||||
ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns)
|
||||
pkg_env$ab_selector <- unique_call_id()
|
||||
pkg_env$ab_selector_cols <- ab_in_data
|
||||
} else {
|
||||
@ -210,7 +217,7 @@ ab_selector <- function(ab_class, function_name) {
|
||||
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_("Selecting ", ab_group, ": ", paste(agents_formatted, collapse = ", "),
|
||||
message_("Selecting ", ab_group, ": ", vector_and(agents_formatted, quotes = FALSE),
|
||||
as_note = FALSE,
|
||||
extra_indent = 4)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Retrieve Antimicrobial Drug Names and Doses from Clinical Text
|
||||
@ -29,7 +29,7 @@
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @param text text to analyse
|
||||
#' @param type type of property to search for, either `"drug"`, `"dose"` or `"administration"`, see *Examples*
|
||||
#' @param collapse character to pass on to `paste(..., collapse = ...)` to only return one character per element of `text`, see *Examples*
|
||||
#' @param collapse character to pass on to `paste(, collapse = ...)` to only return one character per element of `text`, see *Examples*
|
||||
#' @param translate_ab if `type = "drug"`: a column name of the [antibiotics] data set to translate the antibiotic abbreviations to, using [ab_property()]. Defaults to `FALSE`. Using `TRUE` is equal to using "name".
|
||||
#' @param thorough_search logical to indicate whether the input must be extensively searched for misspelling and other faulty input values. Setting this to `TRUE` will take considerably more time than when using `FALSE`. At default, it will turn `TRUE` when all input elements contain a maximum of three words.
|
||||
#' @param ... arguments passed on to [as.ab()]
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Get Properties of an Antibiotic
|
||||
@ -225,7 +225,7 @@ ab_url <- function(x, open = FALSE, ...) {
|
||||
|
||||
NAs <- ab_name(ab, tolower = TRUE, language = NULL)[!is.na(ab) & is.na(ab_atc(ab))]
|
||||
if (length(NAs) > 0) {
|
||||
warning_("No ATC code available for ", paste0(NAs, collapse = ", "), ".")
|
||||
warning_("No ATC code available for ", vector_and(NAs, quotes = FALSE), ".")
|
||||
}
|
||||
|
||||
if (open == TRUE) {
|
||||
|
4
R/age.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Age in Years of Individuals
|
||||
|
8
R/amr.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' The `AMR` Package
|
||||
@ -37,7 +37,7 @@
|
||||
#' - Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the Catalogue of Life and List of Prokaryotic names with Standing in Nomenclature
|
||||
#' - Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines
|
||||
#' - Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records
|
||||
#' - Determining first isolates to be used for AMR analysis
|
||||
#' - Determining first isolates to be used for AMR data analysis
|
||||
#' - Calculating antimicrobial resistance
|
||||
#' - Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)
|
||||
#' - Calculating (empirical) susceptibility of both mono therapy and combination therapies
|
||||
@ -54,7 +54,7 @@
|
||||
#' @section Reference Data Publicly Available:
|
||||
#' All reference data sets (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) in this `AMR` package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, SAS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find [all download links on our website](https://msberends.github.io/AMR/articles/datasets.html), which is automatically updated with every code change.
|
||||
#' @section Read more on Our Website!:
|
||||
#' On our website <https://msberends.github.io/AMR/> you can find [a comprehensive tutorial](https://msberends.github.io/AMR/articles/AMR.html) about how to conduct AMR analysis, the [complete documentation of all functions](https://msberends.github.io/AMR/reference/) and [an example analysis using WHONET data](https://msberends.github.io/AMR/articles/WHONET.html). As we would like to better understand the backgrounds and needs of our users, please [participate in our survey](https://msberends.github.io/AMR/survey.html)!
|
||||
#' On our website <https://msberends.github.io/AMR/> you can find [a comprehensive tutorial](https://msberends.github.io/AMR/articles/AMR.html) about how to conduct AMR data analysis, the [complete documentation of all functions](https://msberends.github.io/AMR/reference/) and [an example analysis using WHONET data](https://msberends.github.io/AMR/articles/WHONET.html). As we would like to better understand the backgrounds and needs of our users, please [participate in our survey](https://msberends.github.io/AMR/survey.html)!
|
||||
#' @section Contact Us:
|
||||
#' For suggestions, comments or questions, please contact us at:
|
||||
#'
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Get ATC Properties from WHOCC Website
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Check Availability of Columns
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Determine Bug-Drug Combinations
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
format_included_data_number <- function(data) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Count Available Isolates
|
||||
|
8
R/data.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Data Sets with `r format(nrow(antibiotics) + nrow(antivirals), big.mark = ",")` Antimicrobials
|
||||
@ -174,7 +174,7 @@ catalogue_of_life <- list(
|
||||
|
||||
#' Data Set with `r format(nrow(example_isolates), big.mark = ",")` Example Isolates
|
||||
#'
|
||||
#' A data set containing `r format(nrow(example_isolates), big.mark = ",")` microbial isolates with their full antibiograms. The data set reflects reality and can be used to practice AMR analysis. For examples, please read [the tutorial on our website](https://msberends.github.io/AMR/articles/AMR.html).
|
||||
#' A data set containing `r format(nrow(example_isolates), big.mark = ",")` microbial isolates with their full antibiograms. The data set reflects reality and can be used to practice AMR data analysis. For examples, please read [the tutorial on our website](https://msberends.github.io/AMR/articles/AMR.html).
|
||||
#' @format A [data.frame] with `r format(nrow(example_isolates), big.mark = ",")` observations and `r ncol(example_isolates)` variables:
|
||||
#' - `date`\cr date of receipt at the laboratory
|
||||
#' - `hospital_id`\cr ID of the hospital, from A to D
|
||||
@ -192,7 +192,7 @@ catalogue_of_life <- list(
|
||||
|
||||
#' Data Set with Unclean Data
|
||||
#'
|
||||
#' A data set containing `r format(nrow(example_isolates_unclean), big.mark = ",")` microbial isolates that are not cleaned up and consequently not ready for AMR analysis. This data set can be used for practice.
|
||||
#' A data set containing `r format(nrow(example_isolates_unclean), big.mark = ",")` microbial isolates that are not cleaned up and consequently not ready for AMR data analysis. This data set can be used for practice.
|
||||
#' @format A [data.frame] with `r format(nrow(example_isolates_unclean), big.mark = ",")` observations and `r ncol(example_isolates_unclean)` variables:
|
||||
#' - `patient_id`\cr ID of the patient
|
||||
#' - `date`\cr date of receipt at the laboratory
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Deprecated Functions
|
||||
|
8
R/disk.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Transform Input to Disk Diffusion Diameters
|
||||
@ -98,8 +98,8 @@ as.disk <- function(x, na.rm = FALSE) {
|
||||
if (na_before != na_after) {
|
||||
list_missing <- x.bak[is.na(x) & !is.na(x.bak)] %pm>%
|
||||
unique() %pm>%
|
||||
sort()
|
||||
list_missing <- paste0('"', list_missing, '"', collapse = ", ")
|
||||
sort() %pm>%
|
||||
vector_and(quotes = TRUE)
|
||||
warning_(na_after - na_before, " results truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid disk zones: ",
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Determine (New) Episodes for Patients
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,11 +20,11 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and rsi_translation
|
||||
# (running "data-raw/internals.R" will process the TSV file)
|
||||
# (sourcing "data-raw/_internals.R" will process the TSV file)
|
||||
EUCAST_VERSION_BREAKPOINTS <- list("11.0" = list(version_txt = "v11.0",
|
||||
year = 2021,
|
||||
title = "'EUCAST Clinical Breakpoint Tables'",
|
||||
@ -57,7 +57,8 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
" (", lst[[v]]$year, ")"))
|
||||
}
|
||||
}
|
||||
paste0(txt, collapse = ", ")
|
||||
|
||||
vector_and(txt, quotes = FALSE)
|
||||
}
|
||||
|
||||
#' Apply EUCAST Rules
|
||||
@ -73,10 +74,11 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' @param verbose a [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.
|
||||
#' @param version_breakpoints the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either `r vector_or(names(EUCAST_VERSION_BREAKPOINTS), reverse = TRUE)`.
|
||||
#' @param version_expertrules the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either `r vector_or(names(EUCAST_VERSION_EXPERT_RULES), reverse = TRUE)`.
|
||||
#' @param ampc_cephalosporin_resistance a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of `NA` for this argument will remove results for these agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_or(gsub("[^a-zA-Z ]+", "", unlist(strsplit(eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*", last_sep = " and ")`.
|
||||
#' @param ampc_cephalosporin_resistance a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2`; '*EUCAST Expert Rules v3.2 on Enterobacterales*' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of `NA` for this argument will remove results for these agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(eucast_rules_file[which(eucast_rules_file$reference.version == 3.2 & eucast_rules_file$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`.
|
||||
#' @param ... column name of an antibiotic, see section *Antibiotics* below
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
#' @param administration route of administration, either `r vector_or(dosage$administration)`
|
||||
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand. Defaults to `TRUE` if any column of `x` is of class `<rsi>`.
|
||||
#' @inheritParams first_isolate
|
||||
#' @details
|
||||
#' **Note:** This function does not translate MIC values to RSI values. Use [as.rsi()] for that. \cr
|
||||
@ -165,6 +167,7 @@ eucast_rules <- function(x,
|
||||
version_breakpoints = 11.0,
|
||||
version_expertrules = 3.2,
|
||||
ampc_cephalosporin_resistance = NA,
|
||||
only_rsi_columns = any(is.rsi(x)),
|
||||
...) {
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(col_mo, allow_class = "character", has_length = 1, is_in = colnames(x), allow_NULL = TRUE)
|
||||
@ -174,6 +177,7 @@ eucast_rules <- function(x,
|
||||
meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS)))
|
||||
meet_criteria(version_expertrules, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_EXPERT_RULES)))
|
||||
meet_criteria(ampc_cephalosporin_resistance, has_length = 1, allow_NA = TRUE, allow_NULL = TRUE, is_in = c("R", "S", "I"))
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||
|
||||
x_deparsed <- deparse(substitute(x))
|
||||
if (length(x_deparsed) > 1 || !all(x_deparsed %like% "[a-z]+")) {
|
||||
@ -276,8 +280,19 @@ eucast_rules <- function(x,
|
||||
hard_dependencies = NULL,
|
||||
verbose = verbose,
|
||||
info = info,
|
||||
only_rsi_columns = only_rsi_columns,
|
||||
...)
|
||||
|
||||
|
||||
if (only_rsi_columns == TRUE && !paste0(sys.calls()[1], collapse = "") %like% "only_rsi_columns") {
|
||||
cols_rsi_eligible <- colnames(x[, is.rsi.eligible(x), drop = FALSE])
|
||||
if (length(cols_rsi_eligible) > 0) {
|
||||
message_("These columns might be eligible for EUCAST rules, but are ignored since `only_rsi_columns` is `TRUE`: ",
|
||||
vector_and(cols_rsi_eligible, quotes = TRUE, sort = FALSE),
|
||||
as_note = TRUE, add_fn = font_red)
|
||||
}
|
||||
}
|
||||
|
||||
AMC <- cols_ab["AMC"]
|
||||
AMK <- cols_ab["AMK"]
|
||||
AMP <- cols_ab["AMP"]
|
||||
@ -733,12 +748,8 @@ eucast_rules <- function(x,
|
||||
|
||||
} else {
|
||||
if (info == TRUE) {
|
||||
message_("\n\nSkipping inheritance rules defined by this package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R.",
|
||||
as_note = FALSE,
|
||||
add_fn = font_red)
|
||||
message_("Use eucast_rules(..., rules = \"all\") to also apply those rules.",
|
||||
as_note = FALSE,
|
||||
add_fn = font_red)
|
||||
cat("\n")
|
||||
message_("Skipping inheritance rules defined by this package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R. Use `eucast_rules(..., rules = \"all\")` to also apply those rules.")
|
||||
}
|
||||
}
|
||||
|
||||
@ -748,7 +759,7 @@ eucast_rules <- function(x,
|
||||
# this allows: eucast_rules(x, eucast_rules_df = AMR:::eucast_rules_file %>% filter(is.na(have_these_values)))
|
||||
eucast_rules_df <- list(...)$eucast_rules_df
|
||||
} else {
|
||||
# otherwise internal data file, created in data-raw/internals.R
|
||||
# otherwise internal data file, created in data-raw/_internals.R
|
||||
eucast_rules_df <- eucast_rules_file
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Filter Isolates on Result in Antimicrobial Class
|
||||
@ -31,7 +31,8 @@
|
||||
#' @param ab_class an antimicrobial class, like `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
||||
#' @param result an antibiotic result: S, I or R (or a combination of more of them)
|
||||
#' @param scope the scope to check which variables to check, can be `"any"` (default) or `"all"`
|
||||
#' @param ... previously used when this package still depended on the `dplyr` package, now ignored
|
||||
#' @param only_rsi_columns a logical to indicate whether only columns must be included that were [transformed to class `<rsi>`]([rsi]) on beforehand. Defaults to `TRUE` if any column of `x` is of class `<rsi>`.
|
||||
#' @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.
|
||||
#' @rdname filter_ab_class
|
||||
#' @seealso [antibiotic_class_selectors()] for the `select()` equivalent.
|
||||
@ -81,6 +82,7 @@ filter_ab_class <- function(x,
|
||||
ab_class,
|
||||
result = NULL,
|
||||
scope = "any",
|
||||
only_rsi_columns = any(is.rsi(x)),
|
||||
...) {
|
||||
.call_depth <- list(...)$`.call_depth`
|
||||
if (is.null(.call_depth)) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Determine First (Weighted) Isolates
|
||||
@ -100,25 +100,28 @@
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' # basic filtering on first isolates
|
||||
#' example_isolates[first_isolate(example_isolates), ]
|
||||
#' example_isolates[first_isolate(), ]
|
||||
#'
|
||||
#' # filtering based on isolates ----------------------------------------------
|
||||
#' \donttest{
|
||||
#' # get all first Gram-negatives
|
||||
#' example_isolates[which(first_isolate() & mo_is_gram_negative()), ]
|
||||
#'
|
||||
#' if (require("dplyr")) {
|
||||
#' # filter on first isolates:
|
||||
#' # filter on first isolates using dplyr:
|
||||
#' example_isolates %>%
|
||||
#' mutate(first_isolate = first_isolate(.)) %>%
|
||||
#' filter(first_isolate == TRUE)
|
||||
#' filter(first_isolate())
|
||||
#'
|
||||
#' # short-hand versions:
|
||||
#' example_isolates %>%
|
||||
#' filter(first_isolate())
|
||||
#' example_isolates %>%
|
||||
#' filter_first_isolate()
|
||||
#'
|
||||
#' example_isolates %>%
|
||||
#' filter_first_weighted_isolate()
|
||||
#'
|
||||
#' # grouped determination of first isolates (also prints group names):
|
||||
#' example_isolates %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' mutate(first = first_isolate())
|
||||
#'
|
||||
#' # now let's see if first isolates matter:
|
||||
#' A <- example_isolates %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
@ -194,6 +197,14 @@ first_isolate <- function(x,
|
||||
}
|
||||
}
|
||||
|
||||
# fix for using a grouped df as input (a dot as first argument)
|
||||
# such as example_isolates %>% group_by(hospital_id) %>% mutate(first_isolate = first_isolate(.))
|
||||
if (inherits(x, "grouped_df")) {
|
||||
# get_current_data() contains dplyr::cur_data_all()
|
||||
x <- tryCatch(get_current_data(arg_name = "x", 0),
|
||||
error = function(e) x)
|
||||
}
|
||||
|
||||
# remove data.table, grouping from tibbles, etc.
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)
|
||||
|
||||
@ -255,7 +266,7 @@ first_isolate <- function(x,
|
||||
|
||||
# create original row index
|
||||
x$newvar_row_index <- seq_len(nrow(x))
|
||||
x$newvar_mo <- x[, col_mo, drop = TRUE]
|
||||
x$newvar_mo <- as.mo(x[, col_mo, drop = TRUE])
|
||||
x$newvar_genus_species <- paste(mo_genus(x$newvar_mo), mo_species(x$newvar_mo))
|
||||
x$newvar_date <- x[, col_date, drop = TRUE]
|
||||
x$newvar_patient_id <- x[, col_patient_id, drop = TRUE]
|
||||
@ -427,12 +438,33 @@ first_isolate <- function(x,
|
||||
decimal.mark <- getOption("OutDec")
|
||||
big.mark <- ifelse(decimal.mark != ",", ",", ".")
|
||||
|
||||
if (info == TRUE) {
|
||||
# print group name if used in dplyr::group_by()
|
||||
cur_group <- import_fn("cur_group", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_group)) {
|
||||
group_df <- tryCatch(cur_group(), error = function(e) data.frame())
|
||||
if (NCOL(group_df) > 0) {
|
||||
# transform factors to characters
|
||||
group <- vapply(FUN.VALUE = character(1), group_df, function(x) {
|
||||
if (is.numeric(x)) {
|
||||
format(x)
|
||||
} else if (is.logical(x)) {
|
||||
as.character(x)
|
||||
} else {
|
||||
paste0('"', x, '"')
|
||||
}
|
||||
})
|
||||
cat("\nGroup: ", paste0(names(group), " = ", group, collapse = ", "), "\n", sep = "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# handle empty microorganisms
|
||||
if (any(x$newvar_mo == "UNKNOWN", na.rm = TRUE) & info == TRUE) {
|
||||
message_(ifelse(include_unknown == TRUE, "Included ", "Excluded "),
|
||||
format(sum(x$newvar_mo == "UNKNOWN", na.rm = TRUE),
|
||||
decimal.mark = decimal.mark, big.mark = big.mark),
|
||||
" isolates with a microbial ID 'UNKNOWN' (column '", font_bold(col_mo), "')")
|
||||
" isolates with a microbial ID 'UNKNOWN' (in column '", font_bold(col_mo), "')")
|
||||
}
|
||||
x[which(x$newvar_mo == "UNKNOWN"), "newvar_first_isolate"] <- include_unknown
|
||||
|
||||
@ -440,7 +472,7 @@ first_isolate <- function(x,
|
||||
if (any(is.na(x$newvar_mo)) & info == TRUE) {
|
||||
message_("Excluded ", format(sum(is.na(x$newvar_mo), na.rm = TRUE),
|
||||
decimal.mark = decimal.mark, big.mark = big.mark),
|
||||
" isolates with a microbial ID 'NA' (column '", font_bold(col_mo), "')")
|
||||
" isolates with a microbial ID 'NA' (in column '", font_bold(col_mo), "')")
|
||||
}
|
||||
x[which(is.na(x$newvar_mo)), "newvar_first_isolate"] <- FALSE
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' *G*-test for Count Data
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' PCA Biplot with `ggplot2`
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,12 +20,12 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' AMR Plots with `ggplot2`
|
||||
#'
|
||||
#' Use these functions to create bar plots for antimicrobial resistance analysis. All functions rely on [ggplot2][ggplot2::ggplot()] functions.
|
||||
#' Use these functions to create bar plots for AMR data analysis. All functions rely on [ggplot2][ggplot2::ggplot()] functions.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @param data a [data.frame] with column(s) of class [`rsi`] (see [as.rsi()])
|
||||
#' @param position position adjustment of bars, either `"fill"`, `"stack"` or `"dodge"`
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
globalVariables(c(".rowid",
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Guess Antibiotic Column
|
||||
@ -30,6 +30,7 @@
|
||||
#' @param x a [data.frame]
|
||||
#' @param search_string a text to search `x` for, will be checked with [as.ab()] if this value is not a column in `x`
|
||||
#' @param verbose a logical to indicate whether additional info should be printed
|
||||
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand. Defaults to `TRUE` if any column of `x` is of class `<rsi>`.
|
||||
#' @details You can look for an antibiotic (trade) name or abbreviation and it will search `x` and the [antibiotics] data set for any column containing a name or code of that antibiotic. **Longer columns names take precedence over shorter column names.**
|
||||
#' @return A column name of `x`, or `NULL` when no result is found.
|
||||
#' @export
|
||||
@ -62,36 +63,22 @@
|
||||
#' AMP_ED20 = "S")
|
||||
#' guess_ab_col(df, "ampicillin")
|
||||
#' # [1] "AMP_ED20"
|
||||
guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE) {
|
||||
guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_rsi_columns = any(is.rsi(x))) {
|
||||
meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE)
|
||||
meet_criteria(search_string, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(verbose, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (is.null(x) & is.null(search_string)) {
|
||||
return(as.name("guess_ab_col"))
|
||||
}
|
||||
|
||||
if (search_string %in% colnames(x)) {
|
||||
ab_result <- search_string
|
||||
} else {
|
||||
search_string.ab <- suppressWarnings(as.ab(search_string))
|
||||
if (search_string.ab %in% colnames(x)) {
|
||||
ab_result <- colnames(x)[colnames(x) == search_string.ab][1L]
|
||||
|
||||
} else if (any(tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations", language = NULL))))) {
|
||||
ab_result <- colnames(x)[tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations", language = NULL)))][1L]
|
||||
|
||||
} else {
|
||||
# sort colnames on length - longest first
|
||||
cols <- colnames(x[, x %pm>% colnames() %pm>% nchar() %pm>% order() %pm>% rev()])
|
||||
df_trans <- data.frame(cols = cols,
|
||||
abs = suppressWarnings(as.ab(cols)),
|
||||
stringsAsFactors = FALSE)
|
||||
ab_result <- df_trans[which(df_trans$abs == search_string.ab), "cols"]
|
||||
ab_result <- ab_result[!is.na(ab_result)][1L]
|
||||
}
|
||||
meet_criteria(search_string, allow_class = "character", has_length = 1, allow_NULL = FALSE)
|
||||
}
|
||||
|
||||
all_found <- get_column_abx(x, info = verbose, only_rsi_columns = only_rsi_columns, verbose = verbose)
|
||||
search_string.ab <- suppressWarnings(as.ab(search_string))
|
||||
ab_result <- unname(all_found[names(all_found) == search_string.ab])
|
||||
|
||||
if (length(ab_result) == 0) {
|
||||
if (verbose == TRUE) {
|
||||
message_("No column found as input for ", search_string,
|
||||
@ -114,18 +101,24 @@ get_column_abx <- function(x,
|
||||
hard_dependencies = NULL,
|
||||
verbose = FALSE,
|
||||
info = TRUE,
|
||||
only_rsi_columns = FALSE,
|
||||
...) {
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(soft_dependencies, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(hard_dependencies, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(verbose, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (info == TRUE) {
|
||||
message_("Auto-guessing columns suitable for analysis", appendLF = FALSE, as_note = FALSE)
|
||||
}
|
||||
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)
|
||||
if (only_rsi_columns == TRUE) {
|
||||
x <- x[, which(is.rsi(x)), drop = FALSE]
|
||||
}
|
||||
|
||||
if (NROW(x) > 10000) {
|
||||
# only test maximum of 10,000 values per column
|
||||
if (info == TRUE) {
|
||||
@ -141,21 +134,23 @@ get_column_abx <- function(x,
|
||||
# only check columns that are a valid AB code, ATC code, name, abbreviation or synonym,
|
||||
# or already have the <rsi> class (as.rsi)
|
||||
# and that they have no more than 50% invalid values
|
||||
vectr_antibiotics <- unique(toupper(unlist(antibiotics[, c("ab", "atc", "name", "abbreviations", "synonyms")])))
|
||||
vectr_antibiotics <- unlist(AB_lookup$generalised_all)
|
||||
vectr_antibiotics <- vectr_antibiotics[!is.na(vectr_antibiotics) & nchar(vectr_antibiotics) >= 3]
|
||||
x_columns <- vapply(FUN.VALUE = character(1), colnames(x), function(col, df = x) {
|
||||
if (toupper(col) %in% vectr_antibiotics ||
|
||||
is.rsi(x[, col, drop = TRUE]) ||
|
||||
is.rsi.eligible(x[, col, drop = TRUE], threshold = 0.5)
|
||||
) {
|
||||
return(col)
|
||||
} else {
|
||||
return(NA_character_)
|
||||
}
|
||||
})
|
||||
x_columns <- vapply(FUN.VALUE = character(1),
|
||||
colnames(x),
|
||||
function(col, df = x) {
|
||||
if (generalise_antibiotic_name(col) %in% vectr_antibiotics ||
|
||||
is.rsi(x[, col, drop = TRUE]) ||
|
||||
is.rsi.eligible(x[, col, drop = TRUE], threshold = 0.5)
|
||||
) {
|
||||
return(col)
|
||||
} else {
|
||||
return(NA_character_)
|
||||
}
|
||||
})
|
||||
|
||||
x_columns <- x_columns[!is.na(x_columns)]
|
||||
x <- x[, x_columns, drop = FALSE] # without drop = TRUE, x will become a vector when x_columns is length 1
|
||||
x <- x[, x_columns, drop = FALSE] # without drop = FALSE, x will become a vector when x_columns is length 1
|
||||
df_trans <- data.frame(colnames = colnames(x),
|
||||
abcode = suppressWarnings(as.ab(colnames(x), info = FALSE)),
|
||||
stringsAsFactors = FALSE)
|
||||
@ -164,7 +159,7 @@ get_column_abx <- function(x,
|
||||
names(x) <- df_trans$abcode
|
||||
|
||||
# add from self-defined dots (...):
|
||||
# such as get_column_abx(example_isolates %pm>% rename(thisone = AMX), amox = "thisone")
|
||||
# such as get_column_abx(example_isolates %>% rename(thisone = AMX), amox = "thisone")
|
||||
dots <- list(...)
|
||||
if (length(dots) > 0) {
|
||||
newnames <- suppressWarnings(as.ab(names(dots), info = FALSE))
|
||||
@ -231,9 +226,9 @@ get_column_abx <- function(x,
|
||||
if (info == TRUE & !all(soft_dependencies %in% names(x))) {
|
||||
# missing a soft dependency may lower the reliability
|
||||
missing <- soft_dependencies[!soft_dependencies %in% names(x)]
|
||||
missing_msg <- paste(paste0(ab_name(missing, tolower = TRUE, language = NULL),
|
||||
" (", font_bold(missing, collapse = NULL), ")"),
|
||||
collapse = ", ")
|
||||
missing_msg <- vector_and(paste0(ab_name(missing, tolower = TRUE, language = NULL),
|
||||
" (", font_bold(missing, collapse = NULL), ")"),
|
||||
quotes = FALSE)
|
||||
message_("Reliability would be improved if these antimicrobial results would be available too: ",
|
||||
missing_msg)
|
||||
}
|
||||
@ -249,7 +244,7 @@ generate_warning_abs_missing <- function(missing, any = FALSE) {
|
||||
any_txt <- c("", "are")
|
||||
}
|
||||
warning_(paste0("Introducing NAs since", any_txt[1], " these antimicrobials ", any_txt[2], " required: ",
|
||||
paste(missing, collapse = ", ")),
|
||||
vector_and(missing, quotes = FALSE)),
|
||||
immediate = TRUE,
|
||||
call = FALSE)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Create Identifier of an Isolate
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Join [microorganisms] to a Data Set
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Key Antibiotics for First (Weighted) Isolates
|
||||
@ -234,8 +234,9 @@ key_antibiotics <- function(x,
|
||||
GramPos_4, GramPos_5, GramPos_6)
|
||||
gram_positive <- gram_positive[!is.null(gram_positive)]
|
||||
gram_positive <- gram_positive[!is.na(gram_positive)]
|
||||
if (length(gram_positive) < 12) {
|
||||
if (length(gram_positive) < 12 & message_not_thrown_before("key_antibiotics.grampos")) {
|
||||
warning_("Only using ", length(gram_positive), " different antibiotics as key antibiotics for Gram-positives. See ?key_antibiotics.", call = FALSE)
|
||||
remember_thrown_message("key_antibiotics.grampos")
|
||||
}
|
||||
|
||||
gram_negative <- c(universal,
|
||||
@ -243,8 +244,9 @@ key_antibiotics <- function(x,
|
||||
GramNeg_4, GramNeg_5, GramNeg_6)
|
||||
gram_negative <- gram_negative[!is.null(gram_negative)]
|
||||
gram_negative <- gram_negative[!is.na(gram_negative)]
|
||||
if (length(gram_negative) < 12) {
|
||||
if (length(gram_negative) < 12 & message_not_thrown_before("key_antibiotics.gramneg")) {
|
||||
warning_("Only using ", length(gram_negative), " different antibiotics as key antibiotics for Gram-negatives. See ?key_antibiotics.", call = FALSE)
|
||||
remember_thrown_message("key_antibiotics.gramneg")
|
||||
}
|
||||
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Kurtosis of the Sample
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
###############
|
||||
|
4
R/like.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Pattern Matching with Keyboard Shortcut
|
||||
|
43
R/mdro.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Determine Multidrug-Resistant Organisms (MDRO)
|
||||
@ -153,6 +153,7 @@ mdro <- function(x,
|
||||
pct_required_classes = 0.5,
|
||||
combine_SI = TRUE,
|
||||
verbose = FALSE,
|
||||
only_rsi_columns = any(is.rsi(x)),
|
||||
...) {
|
||||
if (missing(x)) {
|
||||
x <- get_current_data(arg_name = "x", call = -2)
|
||||
@ -432,6 +433,7 @@ mdro <- function(x,
|
||||
"MNO"),
|
||||
verbose = verbose,
|
||||
info = info,
|
||||
only_rsi_columns = only_rsi_columns,
|
||||
...)
|
||||
} else if (guideline$code == "eucast3.2") {
|
||||
cols_ab <- get_column_abx(x = x,
|
||||
@ -457,8 +459,9 @@ mdro <- function(x,
|
||||
"TOB",
|
||||
"TZD",
|
||||
"VAN"),
|
||||
info = info,
|
||||
verbose = verbose,
|
||||
info = info,
|
||||
only_rsi_columns = only_rsi_columns,
|
||||
...)
|
||||
} else if (guideline$code == "tb") {
|
||||
cols_ab <- get_column_abx(x = x,
|
||||
@ -470,8 +473,9 @@ mdro <- function(x,
|
||||
"RIF",
|
||||
"RIB",
|
||||
"RFP"),
|
||||
info = info,
|
||||
verbose = verbose,
|
||||
info = info,
|
||||
only_rsi_columns = only_rsi_columns,
|
||||
...)
|
||||
} else if (guideline$code == "mrgn") {
|
||||
cols_ab <- get_column_abx(x = x,
|
||||
@ -483,14 +487,25 @@ mdro <- function(x,
|
||||
"CIP"),
|
||||
verbose = verbose,
|
||||
info = info,
|
||||
only_rsi_columns = only_rsi_columns,
|
||||
...)
|
||||
} else {
|
||||
cols_ab <- get_column_abx(x = x,
|
||||
verbose = verbose,
|
||||
info = info,
|
||||
only_rsi_columns = only_rsi_columns,
|
||||
...)
|
||||
}
|
||||
|
||||
if (only_rsi_columns == TRUE) {
|
||||
cols_rsi_eligible <- colnames(x[, is.rsi.eligible(x), drop = FALSE])
|
||||
if (length(cols_rsi_eligible) > 0) {
|
||||
message_("These columns might be eligible for determining ", guideline$type, ", but are ignored since `only_rsi_columns` is `TRUE`: ",
|
||||
vector_and(cols_rsi_eligible, quotes = TRUE, sort = FALSE),
|
||||
as_note = TRUE, add_fn = font_red)
|
||||
}
|
||||
}
|
||||
|
||||
# nolint start
|
||||
AMC <- cols_ab["AMC"]
|
||||
AMK <- cols_ab["AMK"]
|
||||
@ -1509,55 +1524,55 @@ run_custom_mdro_guideline <- function(df, guideline) {
|
||||
|
||||
#' @rdname mdro
|
||||
#' @export
|
||||
brmo <- function(x, guideline = "BRMO", ...) {
|
||||
brmo <- function(x, guideline = "BRMO", only_rsi_columns = any(is.rsi(x)), ...) {
|
||||
if (missing(x)) {
|
||||
x <- get_current_data(arg_name = "x", call = -2)
|
||||
}
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
mdro(x, guideline = "BRMO", ...)
|
||||
mdro(x, guideline = "BRMO", only_rsi_columns = only_rsi_columns, ...)
|
||||
}
|
||||
|
||||
#' @rdname mdro
|
||||
#' @export
|
||||
mrgn <- function(x, guideline = "MRGN", ...) {
|
||||
mrgn <- function(x, guideline = "MRGN", only_rsi_columns = any(is.rsi(x)), ...) {
|
||||
if (missing(x)) {
|
||||
x <- get_current_data(arg_name = "x", call = -2)
|
||||
}
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
mdro(x = x, guideline = "MRGN", ...)
|
||||
mdro(x = x, guideline = "MRGN", only_rsi_columns = only_rsi_columns, ...)
|
||||
}
|
||||
|
||||
#' @rdname mdro
|
||||
#' @export
|
||||
mdr_tb <- function(x, guideline = "TB", ...) {
|
||||
mdr_tb <- function(x, guideline = "TB", only_rsi_columns = any(is.rsi(x)), ...) {
|
||||
if (missing(x)) {
|
||||
x <- get_current_data(arg_name = "x", call = -2)
|
||||
}
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
mdro(x = x, guideline = "TB", ...)
|
||||
mdro(x = x, guideline = "TB", only_rsi_columns = only_rsi_columns, ...)
|
||||
}
|
||||
|
||||
#' @rdname mdro
|
||||
#' @export
|
||||
mdr_cmi2012 <- function(x, guideline = "CMI2012", ...) {
|
||||
mdr_cmi2012 <- function(x, guideline = "CMI2012", only_rsi_columns = any(is.rsi(x)), ...) {
|
||||
if (missing(x)) {
|
||||
x <- get_current_data(arg_name = "x", call = -2)
|
||||
}
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
mdro(x = x, guideline = "CMI2012", ...)
|
||||
mdro(x = x, guideline = "CMI2012", only_rsi_columns = only_rsi_columns, ...)
|
||||
}
|
||||
|
||||
#' @rdname mdro
|
||||
#' @export
|
||||
eucast_exceptional_phenotypes <- function(x, guideline = "EUCAST", ...) {
|
||||
eucast_exceptional_phenotypes <- function(x, guideline = "EUCAST", only_rsi_columns = any(is.rsi(x)), ...) {
|
||||
if (missing(x)) {
|
||||
x <- get_current_data(arg_name = "x", call = -2)
|
||||
}
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
mdro(x = x, guideline = "EUCAST", ...)
|
||||
mdro(x = x, guideline = "EUCAST", only_rsi_columns = only_rsi_columns, ...)
|
||||
}
|
||||
|
8
R/mic.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Transform Input to Minimum Inhibitory Concentrations (MIC)
|
||||
@ -123,8 +123,8 @@ as.mic <- function(x, na.rm = FALSE) {
|
||||
if (na_before != na_after) {
|
||||
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %pm>%
|
||||
unique() %pm>%
|
||||
sort()
|
||||
list_missing <- paste0('"', list_missing, '"', collapse = ", ")
|
||||
sort() %pm>%
|
||||
vector_and(quotes = TRUE)
|
||||
warning_(na_after - na_before, " results truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid MICs: ",
|
||||
|
16
R/mo.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Transform Input to a Microorganism ID
|
||||
@ -1418,7 +1418,7 @@ exec_as.mo <- function(x,
|
||||
" (covering ", percentage(total_failures / total_n),
|
||||
") could not be coerced and ", plural[3], " considered 'unknown'")
|
||||
if (pm_n_distinct(failures) <= 10) {
|
||||
msg <- paste0(msg, ": ", paste('"', unique(failures), '"', sep = "", collapse = ", "))
|
||||
msg <- paste0(msg, ": ", vector_and(failures, quotes = TRUE))
|
||||
}
|
||||
msg <- paste0(msg,
|
||||
".\nUse mo_failures() to review ", plural[2], ". Edit the `allow_uncertain` argument if needed (see ?as.mo).\n",
|
||||
@ -1450,7 +1450,7 @@ exec_as.mo <- function(x,
|
||||
# - Becker et al. 2014, PMID 25278577
|
||||
# - Becker et al. 2019, PMID 30872103
|
||||
# - Becker et al. 2020, PMID 32056452
|
||||
post_Becker <- character(0) # 2020-10-20 currently all are mentioned in above papers (otherwise uncomment below)
|
||||
post_Becker <- character(0) # 2020-10-20 currently all are mentioned in above papers (otherwise uncomment the section below)
|
||||
|
||||
# nolint start
|
||||
# if (any(x %in% MO_lookup[which(MO_lookup$species %in% post_Becker), property])) {
|
||||
@ -1796,7 +1796,6 @@ print.mo_uncertainties <- function(x, ...) {
|
||||
return(NULL)
|
||||
}
|
||||
message_("Matching scores are based on human pathogenic prevalence and the resemblance between the input and the full taxonomic name. See ?mo_matching_score.", as_note = FALSE)
|
||||
cat("\n")
|
||||
|
||||
msg <- ""
|
||||
for (i in seq_len(nrow(x))) {
|
||||
@ -1807,7 +1806,7 @@ print.mo_uncertainties <- function(x, ...) {
|
||||
candidates <- candidates[order(1 - scores)]
|
||||
scores_formatted <- trimws(formatC(round(scores, 3), format = "f", digits = 3))
|
||||
n_candidates <- length(candidates)
|
||||
candidates <- paste0(candidates, " (", scores_formatted[order(1 - scores)], ")", collapse = ", ")
|
||||
candidates <- vector_and(paste0(candidates, " (", scores_formatted[order(1 - scores)], ")"), quotes = FALSE)
|
||||
# align with input after arrow
|
||||
candidates <- paste0("\n",
|
||||
strwrap(paste0("Also matched",
|
||||
@ -1987,9 +1986,8 @@ replace_ignore_pattern <- function(x, ignore_pattern) {
|
||||
ignore_cases <- x %like% ignore_pattern
|
||||
if (sum(ignore_cases) > 0) {
|
||||
message_("The following input was ignored by `ignore_pattern = \"", ignore_pattern, "\"`: ",
|
||||
paste0("'", sort(unique(x[x %like% ignore_pattern])), "'", collapse = ", "),
|
||||
collapse = ", ")
|
||||
x[x %like% ignore_pattern] <- NA_character_
|
||||
vector_and(x[ignore_cases], quotes = TRUE))
|
||||
x[ignore_cases] <- NA_character_
|
||||
}
|
||||
}
|
||||
x
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Calculate the Matching Score for Microorganisms
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Get Properties of a Microorganism
|
||||
@ -28,7 +28,7 @@
|
||||
#' Use these functions to return a specific property of a microorganism based on the latest accepted taxonomy. All input values will be evaluated internally with [as.mo()], which makes it possible to use microbial abbreviations, codes and names as input. See *Examples*.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x any character (vector) that can be coerced to a valid microorganism code with [as.mo()]. Can be left blank for auto-guessing the column containing microorganism codes if used in a data set, see *Examples*.
|
||||
#' @param property one of the column names of the [microorganisms] data set: `r paste0('"``', colnames(microorganisms), '\``"', collapse = ", ")`, or must be `"shortname"`
|
||||
#' @param property one of the column names of the [microorganisms] data set: `r vector_or(colnames(microorganisms), sort = FALSE, quotes = TRUE)`, or must be `"shortname"`
|
||||
#' @param language language of the returned text, defaults to system language (see [get_locale()]) and can be overwritten by setting the option `AMR_locale`, e.g. `options(AMR_locale = "de")`, see [translate]. Also used to translate text like "no growth". Use `language = NULL` or `language = ""` to prevent translation.
|
||||
#' @param ... other arguments passed on to [as.mo()], such as 'allow_uncertain' and 'ignore_pattern'
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' User-Defined Reference Data Set for Microorganisms
|
||||
@ -283,9 +283,9 @@ check_validity_mo_source <- function(x, refer_to_name = "`reference_df`", stop_o
|
||||
} else {
|
||||
plural <- ""
|
||||
}
|
||||
stop_("Value", plural, " ", paste0("'", invalid[, 1, drop = TRUE], "'", collapse = ", "),
|
||||
stop_("Value", plural, " ", vector_and(invalid[, 1, drop = TRUE], quotes = TRUE),
|
||||
" found in ", tolower(refer_to_name),
|
||||
", but with invalid microorganism code", plural, " ", paste0("'", invalid$mo, "'", collapse = ", "),
|
||||
", but with invalid microorganism code", plural, " ", vector_and(invalid$mo, quotes = TRUE),
|
||||
call = FALSE)
|
||||
} else {
|
||||
return(FALSE)
|
||||
|
8
R/pca.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Principal Component Analysis (for AMR)
|
||||
@ -117,9 +117,7 @@ pca <- function(x,
|
||||
|
||||
pca_data <- x[, which(vapply(FUN.VALUE = logical(1), x, function(x) is.numeric(x)))]
|
||||
|
||||
message_("Columns selected for PCA: ", vector_or(font_bold(colnames(pca_data), collapse = NULL),
|
||||
quotes = "'",
|
||||
last_sep = " and "),
|
||||
message_("Columns selected for PCA: ", vector_and(font_bold(colnames(pca_data), collapse = NULL), quotes = TRUE),
|
||||
". Total observations available: ", nrow(pca_data), ".")
|
||||
|
||||
if (as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.4) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Calculate Microbial Resistance
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,12 +20,12 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Random MIC Values/Disk Zones/RSI Generation
|
||||
#'
|
||||
#' These functions can be used for generating random MIC values and disk diffusion diameters, for AMR analysis practice.
|
||||
#' These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice.
|
||||
#' @inheritSection lifecycle Maturing Lifecycle
|
||||
#' @param size desired size of the returned vector
|
||||
#' @param mo any character that can be coerced to a valid microorganism code with [as.mo()]
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Predict antimicrobial resistance
|
||||
|
51
R/rsi.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Interpret MIC and Disk Values, or Clean Raw R/SI Data
|
||||
@ -65,7 +65,7 @@
|
||||
#'
|
||||
#' ## Supported Guidelines
|
||||
#'
|
||||
#' For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the `guideline` argument are: `r paste0('"', sort(unique(AMR::rsi_translation$guideline)), '"', collapse = ", ")`.
|
||||
#' For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the `guideline` argument are: `r vector_and(AMR::rsi_translation$guideline, quotes = TRUE, reverse = TRUE)`.
|
||||
#'
|
||||
#' Simply using `"CLSI"` or `"EUCAST"` as input will automatically select the latest version of that guideline. You can set your own data set using the `reference_data` argument. The `guideline` argument will then be ignored.
|
||||
#'
|
||||
@ -79,7 +79,9 @@
|
||||
#'
|
||||
#' ## Other
|
||||
#'
|
||||
#' The function [is.rsi.eligible()] returns `TRUE` when a columns contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R), and `FALSE` otherwise. The threshold of 5% can be set with the `threshold` argument.
|
||||
#' The function [is.rsi()] detects if the input contains class `<rsi>`. If the input is a data.frame, it iterates over all columns and returns a logical vector.
|
||||
#'
|
||||
#' The function [is.rsi.eligible()] returns `TRUE` when a columns contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R), and `FALSE` otherwise. The threshold of 5% can be set with the `threshold` argument. If the input is a data.frame, it iterates over all columns and returns a logical vector.
|
||||
#' @section Interpretation of R and S/I:
|
||||
#' In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories R and S/I as shown below (<https://www.eucast.org/newsiandr/>).
|
||||
#'
|
||||
@ -91,7 +93,7 @@
|
||||
#' A microorganism is categorised as *Susceptible, Increased exposure* when there is a high likelihood of therapeutic success because exposure to the agent is increased by adjusting the dosing regimen or by its concentration at the site of infection.
|
||||
#'
|
||||
#' This AMR package honours this new insight. Use [susceptibility()] (equal to [proportion_SI()]) to determine antimicrobial susceptibility and [count_susceptible()] (equal to [count_SI()]) to count susceptible isolates.
|
||||
#' @return Ordered [factor] with new class [`rsi`]
|
||||
#' @return Ordered factor with new class `<rsi>`
|
||||
#' @aliases rsi
|
||||
#' @export
|
||||
#' @seealso [as.mic()], [as.disk()], [as.mo()]
|
||||
@ -189,7 +191,11 @@ as.rsi <- function(x, ...) {
|
||||
#' @rdname as.rsi
|
||||
#' @export
|
||||
is.rsi <- function(x) {
|
||||
inherits(x, "rsi")
|
||||
if (inherits(x, "data.frame")) {
|
||||
unname(vapply(FUN.VALUE = logical(1), x, is.rsi))
|
||||
} else {
|
||||
inherits(x, "rsi")
|
||||
}
|
||||
}
|
||||
|
||||
#' @rdname as.rsi
|
||||
@ -197,9 +203,12 @@ is.rsi <- function(x) {
|
||||
is.rsi.eligible <- function(x, threshold = 0.05) {
|
||||
meet_criteria(threshold, allow_class = "numeric", has_length = 1)
|
||||
|
||||
if (inherits(x, "data.frame")) {
|
||||
return(unname(vapply(FUN.VALUE = logical(1), x, is.rsi.eligible)))
|
||||
}
|
||||
|
||||
stop_if(NCOL(x) > 1, "`x` must be a one-dimensional vector.")
|
||||
if (any(c("logical",
|
||||
"numeric",
|
||||
if (any(c("numeric",
|
||||
"integer",
|
||||
"mo",
|
||||
"ab",
|
||||
@ -213,13 +222,26 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
|
||||
%in% class(x))) {
|
||||
# no transformation needed
|
||||
return(FALSE)
|
||||
} else if (!any(c("R", "S", "I") %in% x, na.rm = TRUE)) {
|
||||
} else if (all(x %in% c("R", "S", "I", NA)) & !all(is.na(x))) {
|
||||
return(TRUE)
|
||||
} else if (!any(c("R", "S", "I") %in% x, na.rm = TRUE) & !all(is.na(x))) {
|
||||
return(FALSE)
|
||||
} else {
|
||||
x <- x[!is.na(x) & !is.null(x) & !identical(x, "")]
|
||||
x <- x[!is.na(x) & !is.null(x) & x != ""]
|
||||
if (length(x) == 0) {
|
||||
# no other values than NA or ""
|
||||
cur_col <- get_current_column()
|
||||
if (!is.null(cur_col)) {
|
||||
ab <- suppressWarnings(as.ab(cur_col, fast_mode = TRUE, info = FALSE))
|
||||
if (!is.na(ab)) {
|
||||
# this is a valid antibiotic code
|
||||
return(TRUE)
|
||||
}
|
||||
}
|
||||
# all values empty and no antibiotic col name - return FALSE
|
||||
return(FALSE)
|
||||
}
|
||||
# transform all values and see if it meets the set threshold
|
||||
checked <- suppressWarnings(as.rsi(x))
|
||||
outcome <- sum(is.na(checked)) / length(x)
|
||||
outcome <= threshold
|
||||
@ -276,8 +298,8 @@ as.rsi.default <- function(x, ...) {
|
||||
if (na_before != na_after) {
|
||||
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %pm>%
|
||||
unique() %pm>%
|
||||
sort()
|
||||
list_missing <- paste0('"', list_missing, '"', collapse = ", ")
|
||||
sort() %pm>%
|
||||
vector_and(quotes = TRUE)
|
||||
warning_(na_after - na_before, " results truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid antimicrobial interpretations: ",
|
||||
@ -533,7 +555,7 @@ as.rsi.data.frame <- function(x,
|
||||
plural <- c("", "s", "a ")
|
||||
}
|
||||
message_("Assuming value", plural[1], " ",
|
||||
paste(paste0('"', values, '"'), collapse = ", "),
|
||||
vector_and(values, quotes = TRUE),
|
||||
" in column '", font_bold(col_specimen),
|
||||
"' reflect", plural[2], " ", plural[3], "urinary tract infection", plural[1],
|
||||
".\n Use `as.rsi(uti = FALSE)` to prevent this.")
|
||||
@ -664,10 +686,9 @@ get_guideline <- function(guideline, reference_data) {
|
||||
|
||||
stop_ifnot(guideline_param %in% reference_data$guideline,
|
||||
"invalid guideline: '", guideline,
|
||||
"'.\nValid guidelines are: ", paste0("'", unique(reference_data$guideline), "'", collapse = ", "), call = FALSE)
|
||||
"'.\nValid guidelines are: ", vector_and(reference_data$guideline, quotes = TRUE, reverse = TRUE), call = FALSE)
|
||||
|
||||
guideline_param
|
||||
|
||||
}
|
||||
|
||||
exec_as.rsi <- function(method,
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,14 +20,14 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
dots2vars <- function(...) {
|
||||
# this function is to give more informative output about
|
||||
# variable names in count_* and proportion_* functions
|
||||
dots <- substitute(list(...))
|
||||
paste(as.character(dots)[2:length(dots)], collapse = ", ")
|
||||
vector_and(as.character(dots)[2:length(dots)], quotes = FALSE)
|
||||
}
|
||||
|
||||
rsi_calc <- function(...,
|
||||
@ -78,7 +78,7 @@ rsi_calc <- function(...,
|
||||
dots <- c(dots[dots %in% colnames(dots_df)],
|
||||
eval(parse(text = dots[!dots %in% colnames(dots_df)]), envir = dots_df, enclos = globalenv()))
|
||||
dots_not_exist <- dots[!dots %in% colnames(dots_df)]
|
||||
stop_if(length(dots_not_exist) > 0, "column(s) not found: ", paste0("'", dots_not_exist, "'", collapse = ", "), call = -2)
|
||||
stop_if(length(dots_not_exist) > 0, "column(s) not found: ", vector_and(dots_not_exist, quotes = TRUE), call = -2)
|
||||
x <- dots_df[, dots, drop = FALSE]
|
||||
}
|
||||
} else if (ndots == 1) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' @rdname proportion
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Skewness of the Sample
|
||||
|
BIN
R/sysdata.rda
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Translate Strings from AMR Package
|
||||
@ -29,7 +29,7 @@
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @details Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: <https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv>. This file will be read by all functions where a translated output can be desired, like all [`mo_*`][mo_property()] functions (such as [mo_name()], [mo_gramstain()], [mo_type()], etc.) and [`ab_*`][ab_property()] functions (such as [ab_name()], [ab_group()], etc.).
|
||||
#'
|
||||
#' Currently supported languages are: `r paste(sort(gsub(";.*", "", ISOcodes::ISO_639_2[which(ISOcodes::ISO_639_2$Alpha_2 %in% LANGUAGES_SUPPORTED), "Name"])), collapse = ", ")`. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.
|
||||
#' Currently supported languages are: `r vector_and(gsub(";.*", "", ISOcodes::ISO_639_2[which(ISOcodes::ISO_639_2$Alpha_2 %in% LANGUAGES_SUPPORTED), "Name"]), quotes = FALSE)`. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.
|
||||
#'
|
||||
#' Please suggest your own translations [by creating a new issue on our repository](https://github.com/msberends/AMR/issues/new?title=Translations).
|
||||
#'
|
||||
@ -83,8 +83,8 @@ get_locale <- function() {
|
||||
if (lang %in% LANGUAGES_SUPPORTED) {
|
||||
return(lang)
|
||||
} else {
|
||||
stop_("unsupported language set as option 'AMR_locale': '", lang, "' - use one of: ",
|
||||
paste0("'", LANGUAGES_SUPPORTED, "'", collapse = ", "))
|
||||
stop_("unsupported language set as option 'AMR_locale': \"", lang, "\" - use either ",
|
||||
vector_or(LANGUAGES_SUPPORTED, quotes = TRUE))
|
||||
}
|
||||
} else {
|
||||
# we now support the LANGUAGE system variable - return it if set
|
||||
@ -138,8 +138,8 @@ translate_AMR <- function(from, language = get_locale(), only_unknown = FALSE) {
|
||||
from_unique_translated <- from_unique
|
||||
|
||||
stop_ifnot(language %in% LANGUAGES_SUPPORTED,
|
||||
"unsupported language: '", language, "' - use one of: ",
|
||||
paste0("'", LANGUAGES_SUPPORTED, "'", collapse = ", "),
|
||||
"unsupported language: \"", language, "\" - use either ",
|
||||
vector_or(LANGUAGES_SUPPORTED, quotes = TRUE),
|
||||
call = FALSE)
|
||||
|
||||
df_trans <- subset(df_trans, lang == language)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' WHOCC: WHO Collaborating Centre for Drug Statistics Methodology
|
||||
|
4
R/zzz.R
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# set up package environment, used by numerous AMR functions
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
title: "AMR (for R)"
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
codecov:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,11 +20,11 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# Run this file to update the package using:
|
||||
# source("data-raw/internals.R")
|
||||
# source("data-raw/_internals.R")
|
||||
|
||||
library(dplyr, warn.conflicts = FALSE)
|
||||
devtools::load_all(quiet = TRUE)
|
||||
@ -74,6 +74,15 @@ create_AB_lookup <- function() {
|
||||
AB_lookup$generalised_synonyms <- lapply(AB_lookup$synonyms, generalise_antibiotic_name)
|
||||
AB_lookup$generalised_abbreviations <- lapply(AB_lookup$abbreviations, generalise_antibiotic_name)
|
||||
AB_lookup$generalised_loinc <- lapply(AB_lookup$loinc, generalise_antibiotic_name)
|
||||
AB_lookup$generalised_all <- unname(lapply(as.list(as.data.frame(t(AB_lookup[,
|
||||
c("ab", "atc", "cid", "name",
|
||||
colnames(AB_lookup)[colnames(AB_lookup) %like% "generalised"]),
|
||||
drop = FALSE]),
|
||||
stringsAsFactors = FALSE)),
|
||||
function(x) {
|
||||
x <- generalise_antibiotic_name(unname(unlist(x)))
|
||||
x[x != ""]
|
||||
}))
|
||||
AB_lookup
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# last updated: 20 January 2020 - Loinc_2.67
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# ------------------------------------------------
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
library(openxlsx)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
library(dplyr)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# get all data from the WHOCC website
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
library(dplyr)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
patients <- unlist(lapply(LETTERS, paste0, 1:10))
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
library(AMR)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# Reproduction of the `microorganisms` data set
|
||||
@ -925,7 +925,7 @@ usethis::use_data(rsi_translation, overwrite = TRUE, version = 2)
|
||||
usethis::use_data(microorganisms.codes, overwrite = TRUE, version = 2)
|
||||
saveRDS(microorganisms.translation, file = "data-raw/microorganisms.translation.rds", version = 2)
|
||||
# to save microorganisms.translation internally to the package
|
||||
source("data-raw/internals.R")
|
||||
source("data-raw/_internals.R")
|
||||
|
||||
# load new data sets again
|
||||
devtools::load_all(".")
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -20,7 +20,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
library(AMR)
|
||||
|
@ -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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
@ -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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -271,7 +271,7 @@
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#examples" class="anchor"></a>Examples</h3>
|
||||
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code>. For example, the output of the default guideline by Magiorakos <em>et al.</em> returns a <code>factor</code> with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in that order.</p>
|
||||
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
|
||||
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR data analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><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="co"># to support pipes: %>%</span>
|
||||
<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://github.com/msberends/cleaner">cleaner</a></span><span class="op">)</span> <span class="co"># to create frequency tables</span></code></pre></div>
|
||||
@ -339,17 +339,17 @@ Unique: 2</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">)</span>
|
||||
<span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span>
|
||||
<span class="co"># 1 R I I R R R</span>
|
||||
<span class="co"># 2 R S I S R S</span>
|
||||
<span class="co"># 3 R R S S R I</span>
|
||||
<span class="co"># 4 S R R S S R</span>
|
||||
<span class="co"># 5 I R R R R S</span>
|
||||
<span class="co"># 6 I I I R S I</span>
|
||||
<span class="co"># 1 I R R I I S</span>
|
||||
<span class="co"># 2 I S R I R R</span>
|
||||
<span class="co"># 3 S I S I S S</span>
|
||||
<span class="co"># 4 S R I S S S</span>
|
||||
<span class="co"># 5 I S I R S S</span>
|
||||
<span class="co"># 6 S R I R S S</span>
|
||||
<span class="co"># kanamycin</span>
|
||||
<span class="co"># 1 I</span>
|
||||
<span class="co"># 1 S</span>
|
||||
<span class="co"># 2 S</span>
|
||||
<span class="co"># 3 S</span>
|
||||
<span class="co"># 4 S</span>
|
||||
<span class="co"># 3 R</span>
|
||||
<span class="co"># 4 I</span>
|
||||
<span class="co"># 5 R</span>
|
||||
<span class="co"># 6 R</span></code></pre></div>
|
||||
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
|
||||
@ -382,40 +382,40 @@ Unique: 5</p>
|
||||
<tr class="odd">
|
||||
<td align="left">1</td>
|
||||
<td align="left">Mono-resistant</td>
|
||||
<td align="right">3163</td>
|
||||
<td align="right">63.26%</td>
|
||||
<td align="right">3163</td>
|
||||
<td align="right">63.26%</td>
|
||||
<td align="right">3211</td>
|
||||
<td align="right">64.22%</td>
|
||||
<td align="right">3211</td>
|
||||
<td align="right">64.22%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Negative</td>
|
||||
<td align="right">1009</td>
|
||||
<td align="right">20.18%</td>
|
||||
<td align="right">4172</td>
|
||||
<td align="right">83.44%</td>
|
||||
<td align="right">990</td>
|
||||
<td align="right">19.80%</td>
|
||||
<td align="right">4201</td>
|
||||
<td align="right">84.02%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">Multi-drug-resistant</td>
|
||||
<td align="right">466</td>
|
||||
<td align="right">9.32%</td>
|
||||
<td align="right">4638</td>
|
||||
<td align="right">92.76%</td>
|
||||
<td align="right">435</td>
|
||||
<td align="right">8.70%</td>
|
||||
<td align="right">4636</td>
|
||||
<td align="right">92.72%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
<td align="left">Poly-resistant</td>
|
||||
<td align="right">255</td>
|
||||
<td align="right">5.10%</td>
|
||||
<td align="right">4893</td>
|
||||
<td align="right">97.86%</td>
|
||||
<td align="right">258</td>
|
||||
<td align="right">5.16%</td>
|
||||
<td align="right">4894</td>
|
||||
<td align="right">97.88%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">5</td>
|
||||
<td align="left">Extensively drug-resistant</td>
|
||||
<td align="right">107</td>
|
||||
<td align="right">2.14%</td>
|
||||
<td align="right">106</td>
|
||||
<td align="right">2.12%</td>
|
||||
<td align="right">5000</td>
|
||||
<td align="right">100.00%</td>
|
||||
</tr>
|
||||
|
@ -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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -193,7 +193,7 @@
|
||||
<h1 data-toc-skip>How to import data from SPSS / SAS / Stata</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">28 January 2021</h4>
|
||||
<h4 class="date">02 February 2021</h4>
|
||||
|
||||
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/SPSS.Rmd"><code>vignettes/SPSS.Rmd</code></a></small>
|
||||
<div class="hidden name"><code>SPSS.Rmd</code></div>
|
||||
@ -228,7 +228,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>R has a huge community.</strong></p>
|
||||
<p>Many R users just ask questions on websites like <a href="https://stackoverflow.com">StackOverflow.com</a>, the largest online community for programmers. At the time of writing, <a href="https://stackoverflow.com/questions/tagged/r?sort=votes">384,445 R-related questions</a> have already been asked on this platform (that covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.</p>
|
||||
<p>Many R users just ask questions on websites like <a href="https://stackoverflow.com">StackOverflow.com</a>, the largest online community for programmers. At the time of writing, <a href="https://stackoverflow.com/questions/tagged/r?sort=votes">385,525 R-related questions</a> have already been asked on this platform (that covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>R understands any data type, including SPSS/SAS/Stata.</strong></p>
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -208,7 +208,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="microorganisms-currently-accepted-names" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#microorganisms-currently-accepted-names" class="anchor"></a>Microorganisms (currently accepted names)</h2>
|
||||
<p>A data set with 67,151 rows and 16 columns, containing the following column names:<br><em>‘mo’, ‘fullname’, ‘kingdom’, ‘phylum’, ‘class’, ‘order’, ‘family’, ‘genus’, ‘species’, ‘subspecies’, ‘rank’, ‘ref’, ‘species_id’, ‘source’, ‘prevalence’, ‘snomed’</em>.</p>
|
||||
<p>A data set with 67,151 rows and 16 columns, containing the following column names:<br><em>class</em>, <em>family</em>, <em>fullname</em>, <em>genus</em>, <em>kingdom</em>, <em>mo</em>, <em>order</em>, <em>phylum</em>, <em>prevalence</em>, <em>rank</em>, <em>ref</em>, <em>snomed</em>, <em>source</em>, <em>species</em>, <em>species_id</em> and <em>subspecies</em>.</p>
|
||||
<p>This data set is in R available as <code>microorganisms</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 3 September 2020 20:59:45 CEST. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/microorganisms.html">here</a>.</p>
|
||||
<p><strong>Direct download links:</strong></p>
|
||||
@ -426,7 +426,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="microorganisms-previously-accepted-names" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#microorganisms-previously-accepted-names" class="anchor"></a>Microorganisms (previously accepted names)</h2>
|
||||
<p>A data set with 12,708 rows and 4 columns, containing the following column names:<br><em>‘fullname’, ‘fullname_new’, ‘ref’, ‘prevalence’</em>.</p>
|
||||
<p>A data set with 12,708 rows and 4 columns, containing the following column names:<br><em>fullname</em>, <em>fullname_new</em>, <em>prevalence</em> and <em>ref</em>.</p>
|
||||
<p><strong>Note:</strong> remember that the ‘ref’ columns contains the scientific reference to the old taxonomic entries, i.e. of column <em>‘fullname’</em>. For the scientific reference of the new names, i.e. of column <em>‘fullname_new’</em>, see the <code>microorganisms</code> data set.</p>
|
||||
<p>This data set is in R available as <code>microorganisms.old</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 28 May 2020 11:17:56 CEST. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/microorganisms.old.html">here</a>.</p>
|
||||
@ -492,7 +492,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="antibiotic-agents" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#antibiotic-agents" class="anchor"></a>Antibiotic agents</h2>
|
||||
<p>A data set with 456 rows and 14 columns, containing the following column names:<br><em>‘ab’, ‘atc’, ‘cid’, ‘name’, ‘group’, ‘atc_group1’, ‘atc_group2’, ‘abbreviations’, ‘synonyms’, ‘oral_ddd’, ‘oral_units’, ‘iv_ddd’, ‘iv_units’, ‘loinc’</em>.</p>
|
||||
<p>A data set with 456 rows and 14 columns, containing the following column names:<br><em>ab</em>, <em>abbreviations</em>, <em>atc</em>, <em>atc_group1</em>, <em>atc_group2</em>, <em>cid</em>, <em>group</em>, <em>iv_ddd</em>, <em>iv_units</em>, <em>loinc</em>, <em>name</em>, <em>oral_ddd</em>, <em>oral_units</em> and <em>synonyms</em>.</p>
|
||||
<p>This data set is in R available as <code>antibiotics</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 14 January 2021 16:04:41 CET. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/antibiotics.html">here</a>.</p>
|
||||
<p><strong>Direct download links:</strong></p>
|
||||
@ -515,7 +515,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<p>This data set contains all EARS-Net and ATC codes gathered from WHO and WHONET, and all compound IDs from PubChem. It also contains all brand names (synonyms) as found on PubChem and Defined Daily Doses (DDDs) for oral and parenteral administration.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://www.whocc.no/atc_ddd_index/">ATC/DDD index from WHO Collaborating Centre for Drug Statistics Methodology</a> (note: this may not be used for commercial purposes, but is frelly available from the WHO CC website for personal use)</li>
|
||||
<a href="https://www.whocc.no/atc_ddd_index/">ATC/DDD index from WHO Collaborating Centre for Drug Statistics Methodology</a> (note: this may not be used for commercial purposes, but is freely available from the WHO CC website for personal use)</li>
|
||||
<li><a href="https://pubchem.ncbi.nlm.nih.gov">PubChem by the US National Library of Medicine</a></li>
|
||||
<li><a href="https://whonet.org">WHONET software 2019</a></li>
|
||||
</ul>
|
||||
@ -660,7 +660,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="antiviral-agents" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#antiviral-agents" class="anchor"></a>Antiviral agents</h2>
|
||||
<p>A data set with 102 rows and 9 columns, containing the following column names:<br><em>‘atc’, ‘cid’, ‘name’, ‘atc_group’, ‘synonyms’, ‘oral_ddd’, ‘oral_units’, ‘iv_ddd’, ‘iv_units’</em>.</p>
|
||||
<p>A data set with 102 rows and 9 columns, containing the following column names:<br><em>atc</em>, <em>atc_group</em>, <em>cid</em>, <em>iv_ddd</em>, <em>iv_units</em>, <em>name</em>, <em>oral_ddd</em>, <em>oral_units</em> and <em>synonyms</em>.</p>
|
||||
<p>This data set is in R available as <code>antivirals</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 29 August 2020 21:53:07 CEST. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/antibiotics.html">here</a>.</p>
|
||||
<p><strong>Direct download links:</strong></p>
|
||||
@ -683,7 +683,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<p>This data set contains all ATC codes gathered from WHO and all compound IDs from PubChem. It also contains all brand names (synonyms) as found on PubChem and Defined Daily Doses (DDDs) for oral and parenteral administration.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://www.whocc.no/atc_ddd_index/">ATC/DDD index from WHO Collaborating Centre for Drug Statistics Methodology</a> (note: this may not be used for commercial purposes, but is frelly available from the WHO CC website for personal use)</li>
|
||||
<a href="https://www.whocc.no/atc_ddd_index/">ATC/DDD index from WHO Collaborating Centre for Drug Statistics Methodology</a> (note: this may not be used for commercial purposes, but is freely available from the WHO CC website for personal use)</li>
|
||||
<li><a href="https://pubchem.ncbi.nlm.nih.gov">PubChem by the US National Library of Medicine</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -787,7 +787,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="intrinsic-bacterial-resistance" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#intrinsic-bacterial-resistance" class="anchor"></a>Intrinsic bacterial resistance</h2>
|
||||
<p>A data set with 93,892 rows and 2 columns, containing the following column names:<br><em>‘microorganism’, ‘antibiotic’</em>.</p>
|
||||
<p>A data set with 93,892 rows and 2 columns, containing the following column names:<br><em>antibiotic</em> and <em>microorganism</em>.</p>
|
||||
<p>This data set is in R available as <code>intrinsic_resistant</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 24 September 2020 00:50:35 CEST. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/intrinsic_resistant.html">here</a>.</p>
|
||||
<p><strong>Direct download links:</strong></p>
|
||||
@ -807,7 +807,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="source-4" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#source-4" class="anchor"></a>Source</h3>
|
||||
<p>This data set contains all defined intrinsic resistance by EUCAST of all bug-drug combinations, and is based on ‘’EUCAST Expert Rules’ and ‘EUCAST Intrinsic Resistance and Unusual Phenotypes’’, v3.2 from 2020.</p>
|
||||
<p>This data set contains all defined intrinsic resistance by EUCAST of all bug-drug combinations, and is based on <a href="https://www.eucast.org/expert_rules_and_intrinsic_resistance/">‘EUCAST Expert Rules’ and ‘EUCAST Intrinsic Resistance and Unusual Phenotypes’ v3.2</a> (2020).</p>
|
||||
</div>
|
||||
<div id="example-content-4" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -1002,7 +1002,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="interpretation-from-mic-values-disk-diameters-to-rsi" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#interpretation-from-mic-values-disk-diameters-to-rsi" class="anchor"></a>Interpretation from MIC values / disk diameters to R/SI</h2>
|
||||
<p>A data set with 20,486 rows and 10 columns, containing the following column names:<br><em>‘guideline’, ‘method’, ‘site’, ‘mo’, ‘ab’, ‘ref_tbl’, ‘disk_dose’, ‘breakpoint_S’, ‘breakpoint_R’, ‘uti’</em>.</p>
|
||||
<p>A data set with 20,486 rows and 10 columns, containing the following column names:<br><em>ab</em>, <em>breakpoint_R</em>, <em>breakpoint_S</em>, <em>disk_dose</em>, <em>guideline</em>, <em>method</em>, <em>mo</em>, <em>ref_tbl</em>, <em>site</em> and <em>uti</em>.</p>
|
||||
<p>This data set is in R available as <code>rsi_translation</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 14 January 2021 16:04:41 CET. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/rsi_translation.html">here</a>.</p>
|
||||
<p><strong>Direct download links:</strong></p>
|
||||
@ -1132,22 +1132,22 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
<div id="dosage-guidelines-from-eucast" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#dosage-guidelines-from-eucast" class="anchor"></a>Dosage guidelines from EUCAST</h2>
|
||||
<p>A data set with 135 rows and 9 columns, containing the following column names:<br><em>‘ab’, ‘name’, ‘type’, ‘dose’, ‘dose_times’, ‘administration’, ‘notes’, ‘original_txt’, ‘eucast_version’</em>.</p>
|
||||
<p>A data set with 169 rows and 9 columns, containing the following column names:<br><em>ab</em>, <em>administration</em>, <em>dose</em>, <em>dose_times</em>, <em>eucast_version</em>, <em>name</em>, <em>notes</em>, <em>original_txt</em> and <em>type</em>.</p>
|
||||
<p>This data set is in R available as <code>dosage</code>, after you load the <code>AMR</code> package.</p>
|
||||
<p>It was last updated on 14 January 2021 16:04:41 CET. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/dosage.html">here</a>.</p>
|
||||
<p>It was last updated on 25 January 2021 21:58:20 CET. Find more info about the structure of this data set <a href="https://msberends.github.io/AMR/reference/dosage.html">here</a>.</p>
|
||||
<p><strong>Direct download links:</strong></p>
|
||||
<ul>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.rds">R file</a> (3 kB)<br>
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.xlsx">Excel file</a> (13 kB)<br>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.xlsx">Excel file</a> (14 kB)<br>
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.txt">plain text file</a> (13 kB)<br>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.txt">plain text file</a> (15 kB)<br>
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.sas">SAS file</a> (48 kB)<br>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.sas">SAS file</a> (52 kB)<br>
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.sav">SPSS file</a> (37 kB)<br>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.sav">SPSS file</a> (45 kB)<br>
|
||||
</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.dta">Stata file</a> (38 kB)</li>
|
||||
<li>Download as <a href="https://github.com/msberends/AMR/raw/master/data-raw/../data-raw/dosage.dta">Stata file</a> (44 kB)</li>
|
||||
</ul>
|
||||
<div id="source-6" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
|
@ -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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -240,7 +240,7 @@
|
||||
<p class="section-desc"></p>
|
||||
|
||||
<dl>
|
||||
<dt><a href="AMR.html">How to conduct AMR analysis</a></dt>
|
||||
<dt><a href="AMR.html">How to conduct AMR data analysis</a></dt>
|
||||
<dd></dt>
|
||||
<dt><a href="EUCAST.html">How to apply EUCAST rules</a></dt>
|
||||
<dd></dt>
|
||||
|
@ -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.5.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -203,7 +203,7 @@
|
||||
<div id="needed-r-packages" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2>
|
||||
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
|
||||
<p>As with many uses in R, we need some additional packages for AMR data analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
|
||||
<p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><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>
|
||||
@ -216,7 +216,7 @@
|
||||
<div id="prediction-analysis" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#prediction-analysis" class="anchor"></a>Prediction analysis</h2>
|
||||
<p>Our package contains a function <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>, which takes the same input as functions for <a href="./AMR.html">other AMR analysis</a>. Based on a date column, it calculates cases per year and uses a regression model to predict antimicrobial resistance.</p>
|
||||
<p>Our package contains a function <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>, which takes the same input as functions for <a href="./AMR.html">other AMR data analysis</a>. Based on a date column, it calculates cases per year and uses a regression model to predict antimicrobial resistance.</p>
|
||||
<p>It is basically as easy as:</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co"># resistance prediction of piperacillin/tazobactam (TZP):</span></span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">resistance_predict</span>(<span class="at">tbl =</span> example_isolates, <span class="at">col_date =</span> <span class="st">"date"</span>, <span class="at">col_ab =</span> <span class="st">"TZP"</span>, <span class="at">model =</span> <span class="st">"binomial"</span>)</span>
|
||||
@ -265,7 +265,8 @@
|
||||
<span class="co"># 26 2027 0.41315710 0.3244399 0.5018743 NA NA 0.41315710</span>
|
||||
<span class="co"># 27 2028 0.43730688 0.3418075 0.5328063 NA NA 0.43730688</span>
|
||||
<span class="co"># 28 2029 0.46175755 0.3597639 0.5637512 NA NA 0.46175755</span>
|
||||
<span class="co"># 29 2030 0.48639359 0.3782932 0.5944939 NA NA 0.48639359</span></code></pre></div>
|
||||
<span class="co"># 29 2030 0.48639359 0.3782932 0.5944939 NA NA 0.48639359</span>
|
||||
<span class="co"># 30 2031 0.51109592 0.3973697 0.6248221 NA NA 0.51109592</span></code></pre></div>
|
||||
<p>The function <code>plot</code> is available in base R, and can be extended by other packages to depend the output based on the type of input. We extended its function to cope with resistance predictions:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R"><span class="fu"><a href="../reference/plot.html">plot</a></span><span class="op">(</span><span class="va">predict_TZP</span><span class="op">)</span></code></pre></div>
|
||||
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 65 KiB |
@ -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.5.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -216,7 +216,7 @@
|
||||
<li>Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the Catalogue of Life and List of Prokaryotic names with Standing in Nomenclature</li>
|
||||
<li>Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines</li>
|
||||
<li>Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records</li>
|
||||
<li>Determining first isolates to be used for AMR analysis</li>
|
||||
<li>Determining first isolates to be used for AMR data analysis</li>
|
||||
<li>Calculating antimicrobial resistance</li>
|
||||
<li>Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)</li>
|
||||
<li>Calculating (empirical) susceptibility of both mono therapy and combination therapies</li>
|
||||
|
@ -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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -21,7 +21,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
*/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Analysis for R #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
@ -21,7 +21,7 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR analysis: https://msberends.github.io/AMR/ #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
*/
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<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>Antimicrobial Resistance Analysis • AMR (for R)</title>
|
||||
<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">
|
||||
@ -18,7 +18,7 @@
|
||||
<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 Analysis">
|
||||
<script src="extra.js"></script><meta property="og:title" content="Antimicrobial Resistance Data Analysis">
|
||||
<meta property="og:description" content="Functions to simplify the analysis and prediction of Antimicrobial
|
||||
Resistance (AMR) and to work with microbial and antimicrobial properties by
|
||||
using evidence-based methods, like those defined by Leclercq et al. (2013)
|
||||
@ -43,7 +43,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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -205,7 +205,7 @@ Since you are one of our users, we would like to know how you use the package an
|
||||
<div id="what-is-amr-for-r" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#what-is-amr-for-r" class="anchor"></a>What is <code>AMR</code> (for R)?</h3>
|
||||
<p><em>(To find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.)</em></p>
|
||||
<p><em>(To find out how to conduct AMR data analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.)</em></p>
|
||||
<p><code>AMR</code> is a free, open-source and independent <a href="https://www.r-project.org">R package</a> to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. <strong>Our aim is to provide a standard</strong> for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p>
|
||||
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
|
||||
<p>This package is <a href="https://en.wikipedia.org/wiki/Dependency_hell">fully independent of any other R package</a> and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). <strong>It was designed to work in any setting, including those with very limited resources</strong>. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the <a href="https://www.rug.nl">University of Groningen</a>, in collaboration with non-profit organisations <a href="https://www.certe.nl">Certe Medical Diagnostics and Advice</a> and <a href="https://www.umcg.nl">University Medical Center Groningen</a>. This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p>
|
||||
@ -361,7 +361,7 @@ Since you are one of our users, we would like to know how you use the package an
|
||||
<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> and <a href="https://lpsn.dsmz.de">List of Prokaryotic names with Standing in Nomenclature</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>Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records (<a href="./reference/ab_from_text.html">manual</a>)</li>
|
||||
<li>Determining first isolates to be used for AMR analysis (<a href="./reference/first_isolate.html">manual</a>)</li>
|
||||
<li>Determining first isolates to be used for AMR data analysis (<a href="./reference/first_isolate.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>
|
||||
<li>Calculating (empirical) susceptibility of both mono therapy and combination therapies (<a href="./articles/AMR.html">tutorial</a>)</li>
|
||||
@ -402,7 +402,7 @@ Since you are one of our users, we would like to know how you use the package an
|
||||
<div id="get-started" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#get-started" class="anchor"></a>Get started</h3>
|
||||
<p>To find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a> or click the links in the ‘How to’ menu.</p>
|
||||
<p>To find out how to conduct AMR data analysis, please <a href="./articles/AMR.html">continue reading here to get started</a> or click the links in the ‘How to’ menu.</p>
|
||||
</div>
|
||||
<div id="short-introduction" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -468,7 +468,7 @@ Since you are one of our users, we would like to know how you use the package an
|
||||
<li>Aside from this website with many tutorials, the package itself contains extensive help pages with many examples for all functions.</li>
|
||||
<li>The package also contains example data sets:
|
||||
<ul>
|
||||
<li>The <a href="./reference/example_isolates.html"><code>example_isolates</code> data set</a>. This data set contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis.</li>
|
||||
<li>The <a href="./reference/example_isolates.html"><code>example_isolates</code> data set</a>. This data set contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR data analysis.</li>
|
||||
<li>The <a href="./reference/WHONET.html"><code>WHONET</code> data set</a>. This data set only contains fake data, but with the exact same structure as files exported by WHONET. Read more about WHONET <a href="./articles/WHONET.html">on its tutorial page</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -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.5.0.9013</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -236,14 +236,39 @@
|
||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1509013" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.5.0.9013">
|
||||
<a href="#amr-1509013" class="anchor"></a>AMR 1.5.0.9013<small> Unreleased </small>
|
||||
<div id="amr-1509015" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.5.0.9015">
|
||||
<a href="#amr-1509015" class="anchor"></a>AMR 1.5.0.9015<small> Unreleased </small>
|
||||
</h1>
|
||||
<div id="last-updated-28-january-2021" class="section level2">
|
||||
<div id="last-updated-4-february-2021" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-28-january-2021" class="anchor"></a><small>Last updated: 28 January 2021</small>
|
||||
<a href="#last-updated-4-february-2021" class="anchor"></a><small>Last updated: 4 February 2021</small>
|
||||
</h2>
|
||||
<div id="breaking" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Functions that are applied to a data set containing antibiotic columns gained the argument <code>only_rsi_columns</code>, which defaults to <code>TRUE</code> if any of the columns are of class <code><rsi></code> (i.e., transformed with <code><a href="../reference/as.rsi.html">as.rsi()</a></code>). This increases reliability of automatic determination of antibiotic columns (so only columns that are defined to be <code><rsi></code> will be affected).</p>
|
||||
<p>This change might invalidate existing code. But since the new argument always returns <code>FALSE</code> when no <code><rsi></code> column can be found in the data, this chance is low.</p>
|
||||
<p>Affected functions are:</p>
|
||||
<ul>
|
||||
<li>All antibiotic selector functions (<code><a href="../reference/antibiotic_class_selectors.html">ab_class()</a></code> and its wrappers, such as <code>aminoglocysides()</code>, <code><a href="../reference/antibiotic_class_selectors.html">carbapenems()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">penicillins()</a></code>)</li>
|
||||
<li>All antibiotic filter functions (<code><a href="../reference/filter_ab_class.html">filter_ab_class()</a></code> and its wrappers, such as <code>filter_aminoglocysides()</code>, <code><a href="../reference/filter_ab_class.html">filter_carbapenems()</a></code>, <code><a href="../reference/filter_ab_class.html">filter_penicillins()</a></code>)</li>
|
||||
<li><code><a href="../reference/eucast_rules.html">eucast_rules()</a></code></li>
|
||||
<li>
|
||||
<code><a href="../reference/mdro.html">mdro()</a></code> (including wrappers such as <code><a href="../reference/mdro.html">brmo()</a></code>, <code>mrgn</code> and <code><a href="../reference/mdro.html">eucast_exceptional_phenotypes()</a></code>)</li>
|
||||
<li><code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code></li>
|
||||
</ul>
|
||||
<p>You can quickly transform all your eligible columns using either:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<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">your_date</span> <span class="op">%>%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_if</a></span><span class="op">(</span><span class="va">is.rsi.eligible</span>, <span class="va">as.rsi</span><span class="op">)</span> <span class="co"># old dplyr</span>
|
||||
<span class="va">your_date</span> <span class="op">%>%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html">across</a></span><span class="op">(</span><span class="op">(</span><span class="va">is.rsi.eligible</span><span class="op">)</span>, <span class="va">as.rsi</span><span class="op">)</span><span class="op">)</span> <span class="co"># new dplyr</span></code></pre></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="new" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#new" class="anchor"></a>New</h3>
|
||||
@ -255,7 +280,7 @@
|
||||
<li><p>Function <code><a href="../reference/isolate_identifier.html">isolate_identifier()</a></code>, which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.</p></li>
|
||||
<li>
|
||||
<p>Function <code><a href="../reference/mo_property.html">mo_is_yeast()</a></code>, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_kingdom</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"Aspergillus"</span>, <span class="st">"Candida"</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="co">#> [1] "Fungi" "Fungi"</span>
|
||||
@ -267,7 +292,7 @@
|
||||
<span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/which.html">which</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_is_yeast</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>, <span class="op">]</span> <span class="co"># base R</span>
|
||||
<span class="va">example_isolates</span> <span class="op">%>%</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_yeast</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="co"># dplyr</span></code></pre></div>
|
||||
<p>The <code><a href="../reference/mo_property.html">mo_type()</a></code> function has also been updated to reflect this change:</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_type</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"Aspergillus"</span>, <span class="st">"Candida"</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="co"># [1] "Fungi" "Yeasts"</span>
|
||||
@ -280,19 +305,25 @@
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#changed" class="anchor"></a>Changed</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<code><a href="../reference/as.rsi.html">is.rsi()</a></code> and <code><a href="../reference/as.rsi.html">is.rsi.eligible()</a></code> now return a vector of <code>TRUE</code>/<code>FALSE</code> when the input is a data set, by iterating over all columns</li>
|
||||
<li>Using functions without setting a data set (e.g., <code><a href="../reference/mo_property.html">mo_is_gram_negative()</a></code>, <code><a href="../reference/mo_property.html">mo_is_gram_positive()</a></code>, <code><a href="../reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>, <code><a href="../reference/first_isolate.html">first_isolate()</a></code>, <code><a href="../reference/mdro.html">mdro()</a></code>) now work with <code>dplyr</code>s <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> again</li>
|
||||
<li>
|
||||
<code><a href="../reference/first_isolate.html">first_isolate()</a></code> can be used with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> (also when using a dot <code>.</code> as input for the data) and now returns the names of the groups</li>
|
||||
<li>Updated the data set <code>microorganisms.codes</code> (which contains popular LIS and WHONET codes for microorganisms) for some species of <em>Mycobacterium</em> that previously incorrectly returned <em>M. africanum</em>
|
||||
</li>
|
||||
<li>Added Pretomanid (PMD, J04AK08) to the <code>antibiotics</code> data set</li>
|
||||
<li>WHONET code <code>"PNV"</code> will now correctly be interpreted as <code>PHN</code>, the antibiotic code for phenoxymethylpenicillin (‘peni V’)</li>
|
||||
<li>Fix for verbose output of <code><a href="../reference/mdro.html">mdro(..., verbose = TRUE)</a></code> for German guideline (3MGRN and 4MGRN) and Dutch guideline (BRMO, only <em>P. aeruginosa</em>)</li>
|
||||
<li>
|
||||
<code><a href="../reference/as.rsi.html">is.rsi.eligible()</a></code> now returns <code>FALSE</code> immediately if the input does not contain any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.</li>
|
||||
<code><a href="../reference/as.rsi.html">is.rsi.eligible()</a></code> now detects if the column name resembles an antibiotic name or code and now returns <code>TRUE</code> immediately if the input contains any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.</li>
|
||||
<li>Functions <code><a href="../reference/get_episode.html">get_episode()</a></code> and <code><a href="../reference/get_episode.html">is_new_episode()</a></code> now support less than a day as value for argument <code>episode_days</code> (e.g., to include one patient/test per hour)</li>
|
||||
<li>Argument <code>ampc_cephalosporin_resistance</code> in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> now also applies to value “I” (not only “S”)</li>
|
||||
<li>Updated colours of values R, S and I in tibble printing</li>
|
||||
<li>Functions <code><a href="https://docs.ropensci.org/skimr/reference/print.html">print()</a></code> and <code><a href="https://rdrr.io/r/base/summary.html">summary()</a></code> on a Principal Components Analysis object (<code><a href="../reference/pca.html">pca()</a></code>) now print additional group info if the original data was grouped using <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">dplyr::group_by()</a></code>
|
||||
</li>
|
||||
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other" class="section level3">
|
||||
@ -300,7 +331,7 @@
|
||||
<a href="#other" class="anchor"></a>Other</h3>
|
||||
<ul>
|
||||
<li>Big documentation updates</li>
|
||||
<li>Loading the package (i.e., <code><a href="https://msberends.github.io/AMR/">library(AMR)</a></code>) now is ~50 times faster than before, in costs of package size (increased with ~3 MB)</li>
|
||||
<li>Loading the package (i.e., <code><a href="https://msberends.github.io/AMR/">library(AMR)</a></code>) now is ~50 times faster than before, in costs of package size (which increased by ~3 MB)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -315,7 +346,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<p>Functions <code><a href="../reference/get_episode.html">get_episode()</a></code> and <code><a href="../reference/get_episode.html">is_new_episode()</a></code> to determine (patient) episodes which are not necessarily based on microorganisms. The <code><a href="../reference/get_episode.html">get_episode()</a></code> function returns the index number of the episode per group, while the <code><a href="../reference/get_episode.html">is_new_episode()</a></code> function returns values <code>TRUE</code>/<code>FALSE</code> to indicate whether an item in a vector is the start of a new episode. They also support <code>dplyr</code>s grouping (i.e. using <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code>):</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<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">%>%</span>
|
||||
@ -369,7 +400,7 @@
|
||||
<code><a href="../reference/mdro.html">mdr_cmi2012()</a></code>,</li>
|
||||
<li><code><a href="../reference/mdro.html">eucast_exceptional_phenotypes()</a></code></li>
|
||||
</ul>
|
||||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># to select first isolates that are Gram-negative </span>
|
||||
<span class="co"># and view results of cephalosporins and aminoglycosides:</span>
|
||||
@ -381,7 +412,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<p>For antibiotic selection functions (such as <code><a href="../reference/antibiotic_class_selectors.html">cephalosporins()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">aminoglycosides()</a></code>) to select columns based on a certain antibiotic group, the dependency on the <code>tidyselect</code> package was removed, meaning that they can now also be used without the need to have this package installed and now also work in base R function calls (they rely on R 3.2 or later):</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># above example in base R:</span>
|
||||
<span class="va">example_isolates</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/which.html">which</a></span><span class="op">(</span><span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span><span class="op">(</span><span class="op">)</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="op">)</span>,
|
||||
@ -432,7 +463,7 @@
|
||||
<li>
|
||||
<p>Data set <code>intrinsic_resistant</code>. This data set contains all bug-drug combinations where the ‘bug’ is intrinsic resistant to the ‘drug’ according to the latest EUCAST insights. It contains just two columns: <code>microorganism</code> and <code>antibiotic</code>.</p>
|
||||
<p>Curious about which enterococci are actually intrinsic resistant to vancomycin?</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<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://msberends.github.io/AMR/">AMR</a></span><span class="op">)</span>
|
||||
<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>
|
||||
@ -455,7 +486,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<p>Support for using <code>dplyr</code>’s <code><a href="https://dplyr.tidyverse.org/reference/across.html">across()</a></code> to interpret MIC values or disk zone diameters, which also automatically determines the column with microorganism names or codes.</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># until dplyr 1.0.0</span>
|
||||
<span class="va">your_data</span> <span class="op">%>%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_if</a></span><span class="op">(</span><span class="va">is.mic</span>, <span class="va">as.rsi</span><span class="op">)</span>
|
||||
@ -473,7 +504,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<p>Added intelligent data cleaning to <code><a href="../reference/as.disk.html">as.disk()</a></code>, so numbers can also be extracted from text and decimal numbers will always be rounded up:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/as.disk.html">as.disk</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"disk zone: 23.4 mm"</span>, <span class="fl">23.4</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="co">#> Class <disk></span>
|
||||
@ -534,7 +565,7 @@
|
||||
<li><p>Function <code><a href="../reference/ab_from_text.html">ab_from_text()</a></code> to retrieve antimicrobial drug names, doses and forms of administration from clinical texts in e.g. health care records, which also corrects for misspelling since it uses <code><a href="../reference/as.ab.html">as.ab()</a></code> internally</p></li>
|
||||
<li>
|
||||
<p><a href="https://tidyselect.r-lib.org/reference/language.html">Tidyverse selection helpers</a> for antibiotic classes, that help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. They can be used in any function that allows selection helpers, like <code><a href="https://dplyr.tidyverse.org/reference/select.html">dplyr::select()</a></code> and <code><a href="https://tidyr.tidyverse.org/reference/pivot_longer.html">tidyr::pivot_longer()</a></code>:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<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>
|
||||
|
||||
@ -610,16 +641,16 @@
|
||||
<h1 class="page-header" data-toc-text="1.2.0">
|
||||
<a href="#amr-120" class="anchor"></a>AMR 1.2.0<small> 2020-05-28 </small>
|
||||
</h1>
|
||||
<div id="breaking" class="section level3">
|
||||
<div id="breaking-1" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking" class="anchor"></a>Breaking</h3>
|
||||
<a href="#breaking-1" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Removed code dependency on all other R packages, making this package fully independent of the development process of others. This is a major code change, but will probably not be noticeable by most users.</p>
|
||||
<p>Making this package independent of especially the tidyverse (e.g. packages <code>dplyr</code> and <code>tidyr</code>) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.</p>
|
||||
<p>Negative effects of this change are:</p>
|
||||
<ul>
|
||||
<li>Function <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> that was borrowed from the <code>cleaner</code> package was removed. Use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">cleaner::freq()</a></code>, or run <code><a href="https://github.com/msberends/cleaner">library("cleaner")</a></code> before you use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>.</li>
|
||||
<li>Function <code>freq()</code> that was borrowed from the <code>cleaner</code> package was removed. Use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">cleaner::freq()</a></code>, or run <code><a href="https://github.com/msberends/cleaner">library("cleaner")</a></code> before you use <code>freq()</code>.</li>
|
||||
<li><del>Printing values of class <code>mo</code> or <code>rsi</code> in a tibble will no longer be in colour and printing <code>rsi</code> in a tibble will show the class <code><ord></code>, not <code><rsi></code> anymore. This is purely a visual effect.</del></li>
|
||||
<li><del>All functions from the <code>mo_*</code> family (like <code><a href="../reference/mo_property.html">mo_name()</a></code> and <code><a href="../reference/mo_property.html">mo_gramstain()</a></code>) are noticeably slower when running on hundreds of thousands of rows.</del></li>
|
||||
<li>For developers: classes <code>mo</code> and <code>ab</code> now both also inherit class <code>character</code>, to support any data transformation. This change invalidates code that checks for class length == 1.</li>
|
||||
@ -723,7 +754,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Fixed important floating point error for some MIC comparisons in EUCAST 2020 guideline</p></li>
|
||||
<li>
|
||||
<p>Interpretation from MIC values (and disk zones) to R/SI can now be used with <code><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at()</a></code> of the <code>dplyr</code> package:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">yourdata</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span><span class="op">(</span><span class="va">antibiotic1</span><span class="op">:</span><span class="va">antibiotic25</span><span class="op">)</span>, <span class="va">as.rsi</span>, mo <span class="op">=</span> <span class="st">"E. coli"</span><span class="op">)</span>
|
||||
@ -752,7 +783,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<ul>
|
||||
<li>
|
||||
<p>Support for LOINC codes in the <code>antibiotics</code> data set. Use <code><a href="../reference/ab_property.html">ab_loinc()</a></code> to retrieve LOINC codes, or use a LOINC code for input in any <code>ab_*</code> function:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/ab_property.html">ab_loinc</a></span><span class="op">(</span><span class="st">"ampicillin"</span><span class="op">)</span>
|
||||
<span class="co">#> [1] "21066-6" "3355-5" "33562-0" "33919-2" "43883-8" "43884-6" "87604-5"</span>
|
||||
@ -763,7 +794,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
<li>
|
||||
<p>Support for SNOMED CT codes in the <code>microorganisms</code> data set. Use <code><a href="../reference/mo_property.html">mo_snomed()</a></code> to retrieve SNOMED codes, or use a SNOMED code for input in any <code>mo_*</code> function:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_snomed</a></span><span class="op">(</span><span class="st">"S. aureus"</span><span class="op">)</span>
|
||||
<span class="co">#> [1] 115329001 3092008 113961008</span>
|
||||
@ -820,19 +851,19 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<h1 class="page-header" data-toc-text="0.9.0">
|
||||
<a href="#amr-090" class="anchor"></a>AMR 0.9.0<small> 2019-11-29 </small>
|
||||
</h1>
|
||||
<div id="breaking-1" class="section level3">
|
||||
<div id="breaking-2" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking-1" class="anchor"></a>Breaking</h3>
|
||||
<a href="#breaking-2" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>Adopted Adeolu <em>et al.</em> (2016), <a href="https:/pubmed.ncbi.nlm.nih.gov/27620848/">PMID 27620848</a> for the <code>microorganisms</code> data set, which means that the new order Enterobacterales now consists of a part of the existing family Enterobacteriaceae, but that this family has been split into other families as well (like <em>Morganellaceae</em> and <em>Yersiniaceae</em>). Although published in 2016, this information is not yet in the Catalogue of Life version of 2019. All MDRO determinations with <code><a href="../reference/mdro.html">mdro()</a></code> will now use the Enterobacterales order for all guidelines before 2016 that were dependent on the Enterobacteriaceae family.
|
||||
<ul>
|
||||
<li>
|
||||
<p>If you were dependent on the old Enterobacteriaceae family e.g. by using in your code:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_family</a></span><span class="op">(</span><span class="va">somebugs</span><span class="op">)</span> <span class="op">==</span> <span class="st">"Enterobacteriaceae"</span><span class="op">)</span> <span class="va">...</span></code></pre></div>
|
||||
<p>then please adjust this to:</p>
|
||||
<div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_order</a></span><span class="op">(</span><span class="va">somebugs</span><span class="op">)</span> <span class="op">==</span> <span class="st">"Enterobacterales"</span><span class="op">)</span> <span class="va">...</span></code></pre></div>
|
||||
</li>
|
||||
@ -846,7 +877,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<ul>
|
||||
<li>
|
||||
<p>Functions <code><a href="../reference/proportion.html">susceptibility()</a></code> and <code><a href="../reference/proportion.html">resistance()</a></code> as aliases of <code><a href="../reference/proportion.html">proportion_SI()</a></code> and <code><a href="../reference/proportion.html">proportion_R()</a></code>, respectively. These functions were added to make it more clear that “I” should be considered susceptible and not resistant.</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<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">%>%</span>
|
||||
@ -875,7 +906,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>More intelligent way of coping with some consonants like “l” and “r”</p></li>
|
||||
<li>
|
||||
<p>Added a score (a certainty percentage) to <code><a href="../reference/as.mo.html">mo_uncertainties()</a></code>, that is calculated using the <a href="https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein distance</a>:</p>
|
||||
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"Stafylococcus aureus"</span>,
|
||||
<span class="st">"staphylokok aureuz"</span><span class="op">)</span><span class="op">)</span>
|
||||
@ -928,20 +959,20 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<h1 class="page-header" data-toc-text="0.8.0">
|
||||
<a href="#amr-080" class="anchor"></a>AMR 0.8.0<small> 2019-10-15 </small>
|
||||
</h1>
|
||||
<div id="breaking-2" class="section level3">
|
||||
<div id="breaking-3" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking-2" class="anchor"></a>Breaking</h3>
|
||||
<a href="#breaking-3" class="anchor"></a>Breaking</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Determination of first isolates now <strong>excludes</strong> all ‘unknown’ microorganisms at default, i.e. microbial code <code>"UNKNOWN"</code>. They can be included with the new argument <code>include_unknown</code>:</p>
|
||||
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span><span class="op">(</span><span class="va">...</span>, include_unknown <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
|
||||
<p>For WHONET users, this means that all records/isolates with organism code <code>"con"</code> (<em>contamination</em>) will be excluded at default, since <code>as.mo("con") = "UNKNOWN"</code>. The function always shows a note with the number of ‘unknown’ microorganisms that were included or excluded.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>For code consistency, classes <code>ab</code> and <code>mo</code> will now be preserved in any subsetting or assignment. For the sake of data integrity, this means that invalid assignments will now result in <code>NA</code>:</p>
|
||||
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb19"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># how it works in base R:</span>
|
||||
<span class="va">x</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op">(</span><span class="st">"A"</span><span class="op">)</span>
|
||||
@ -956,7 +987,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<span class="co">#> invalid microorganism code, NA generated</span></code></pre></div>
|
||||
<p>This is important, because a value like <code>"testvalue"</code> could never be understood by e.g. <code><a href="../reference/mo_property.html">mo_name()</a></code>, although the class would suggest a valid microbial code.</p>
|
||||
</li>
|
||||
<li><p>Function <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</p></li>
|
||||
<li><p>Function <code>freq()</code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code>freq()</code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</p></li>
|
||||
<li><p>Renamed data set <code>septic_patients</code> to <code>example_isolates</code></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -966,7 +997,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<ul>
|
||||
<li>
|
||||
<p>Function <code><a href="../reference/bug_drug_combinations.html">bug_drug_combinations()</a></code> to quickly get a <code>data.frame</code> with the results of all bug-drug combinations in a data set. The column containing microorganism codes is guessed automatically and its input is transformed with <code><a href="../reference/mo_property.html">mo_shortname()</a></code> at default:</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">x</span> <span class="op"><-</span> <span class="fu"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">)</span>
|
||||
<span class="co">#> NOTE: Using column `mo` as input for `col_mo`.</span>
|
||||
@ -989,13 +1020,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<span class="co">#> 4 Gram-negative AMX 227 0 405 632</span>
|
||||
<span class="co">#> NOTE: Use 'format()' on this result to get a publicable/printable format.</span></code></pre></div>
|
||||
<p>You can format this to a printable format, ready for reporting or exporting to e.g. Excel with the base R <code><a href="https://rdrr.io/r/base/format.html">format()</a></code> function:</p>
|
||||
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="https://rdrr.io/r/base/format.html">format</a></span><span class="op">(</span><span class="va">x</span>, combine_IR <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></code></pre></div>
|
||||
</li>
|
||||
<li>
|
||||
<p>Additional way to calculate co-resistance, i.e. when using multiple antimicrobials as input for <code>portion_*</code> functions or <code>count_*</code> functions. This can be used to determine the empiric susceptibility of a combination therapy. A new argument <code>only_all_tested</code> (<strong>which defaults to <code>FALSE</code></strong>) replaces the old <code>also_single_tested</code> 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 <code>portion</code> and <code>count</code> help pages), where the %SI is being determined:</p>
|
||||
<div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># --------------------------------------------------------------------</span>
|
||||
<span class="co"># only_all_tested = FALSE only_all_tested = TRUE</span>
|
||||
@ -1017,7 +1048,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
<li>
|
||||
<p><code>tibble</code> printing support for classes <code>rsi</code>, <code>mic</code>, <code>disk</code>, <code>ab</code> <code>mo</code>. When using <code>tibble</code>s containing antimicrobial columns, values <code>S</code> will print in green, values <code>I</code> will print in yellow and values <code>R</code> will print in red. Microbial IDs (class <code>mo</code>) will emphasise on the genus and species, not on the kingdom.</p>
|
||||
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb23"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># (run this on your own console, as this page does not support colour printing)</span>
|
||||
<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>
|
||||
@ -1100,7 +1131,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<ul>
|
||||
<li>
|
||||
<p>Function <code><a href="../reference/proportion.html">rsi_df()</a></code> to transform a <code>data.frame</code> to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions <code><a href="../reference/count.html">count_df()</a></code> and <code>portion_df()</code> to immediately show resistance percentages and number of available isolates:</p>
|
||||
<div class="sourceCode" id="cb23"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">AMX</span>, <span class="va">CIP</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
@ -1127,7 +1158,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>UPEC (Uropathogenic <em>E. coli</em>)</li>
|
||||
</ul>
|
||||
<p>All these lead to the microbial ID of <em>E. coli</em>:</p>
|
||||
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb25"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"UPEC"</span><span class="op">)</span>
|
||||
<span class="co"># B_ESCHR_COL</span>
|
||||
@ -1225,22 +1256,22 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>The <code><a href="../reference/age.html">age()</a></code> function gained a new argument <code>exact</code> to determine ages with decimals</li>
|
||||
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code>
|
||||
</li>
|
||||
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>):
|
||||
<li>Frequency tables (<code>freq()</code>):
|
||||
<ul>
|
||||
<li><p>speed improvement for microbial IDs</p></li>
|
||||
<li><p>fixed factor level names for R Markdown</p></li>
|
||||
<li><p>when all values are unique it now shows a message instead of a warning</p></li>
|
||||
<li>
|
||||
<p>support for boxplots:</p>
|
||||
<div class="sourceCode" id="cb25"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span><span class="op">(</span><span class="op">)</span>
|
||||
<span class="co"># grouped boxplots:</span>
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
|
||||
</li>
|
||||
</ul>
|
||||
@ -1250,7 +1281,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li>Added ceftazidim intrinsic resistance to <em>Streptococci</em>
|
||||
</li>
|
||||
<li>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+</li>
|
||||
<li>Fix for <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> for when all values are <code>NA</code>
|
||||
<li>Fix for <code>freq()</code> for when all values are <code>NA</code>
|
||||
</li>
|
||||
<li>Fix for <code><a href="../reference/first_isolate.html">first_isolate()</a></code> for when dates are missing</li>
|
||||
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
|
||||
@ -1294,7 +1325,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<p>We’ve got a new website: <a href="https://msberends.gitlab.io/AMR/">https://msberends.gitlab.io/AMR</a> (built with the great <a href="https://pkgdown.r-lib.org/"><code>pkgdown</code></a>)</p>
|
||||
<ul>
|
||||
<li>Contains the complete manual of this package and all of its functions with an explanation of their arguments</li>
|
||||
<li>Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis, import data from WHONET or SPSS and many more.</li>
|
||||
<li>Contains a comprehensive tutorial about how to conduct AMR data analysis, import data from WHONET or SPSS and many more.</li>
|
||||
</ul>
|
||||
<div id="new-10" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
@ -1327,7 +1358,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
<li>
|
||||
<p>New filters for antimicrobial classes. Use these functions to filter isolates on results in one of more antibiotics from a specific class:</p>
|
||||
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/filter_ab_class.html">filter_aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>
|
||||
<span class="fu"><a href="../reference/filter_ab_class.html">filter_carbapenems</a></span><span class="op">(</span><span class="op">)</span>
|
||||
@ -1341,7 +1372,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<span class="fu"><a href="../reference/filter_ab_class.html">filter_macrolides</a></span><span class="op">(</span><span class="op">)</span>
|
||||
<span class="fu"><a href="../reference/filter_ab_class.html">filter_tetracyclines</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
|
||||
<p>The <code>antibiotics</code> data set will be searched, after which the input data will be checked for column names with a value in any abbreviations, codes or official names found in the <code>antibiotics</code> data set. For example:</p>
|
||||
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span> <span class="fu"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span><span class="op">(</span>result <span class="op">=</span> <span class="st">"R"</span><span class="op">)</span>
|
||||
<span class="co"># Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R</span>
|
||||
@ -1350,7 +1381,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
<li>
|
||||
<p>All <code>ab_*</code> functions are deprecated and replaced by <code>atc_*</code> functions:</p>
|
||||
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">ab_property</span> <span class="op">-></span> <span class="fu">atc_property</span><span class="op">(</span><span class="op">)</span>
|
||||
<span class="va">ab_name</span> <span class="op">-></span> <span class="fu">atc_name</span><span class="op">(</span><span class="op">)</span>
|
||||
@ -1368,10 +1399,10 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>New function <code><a href="../reference/as.mo.html">mo_uncertainties()</a></code> to review values that could be coerced to a valid MO code using <code><a href="../reference/as.mo.html">as.mo()</a></code>, but with uncertainty.</p></li>
|
||||
<li><p>New function <code><a href="../reference/as.mo.html">mo_renamed()</a></code> to get a list of all returned values from <code><a href="../reference/as.mo.html">as.mo()</a></code> that have had taxonomic renaming</p></li>
|
||||
<li><p>New function <code><a href="../reference/age.html">age()</a></code> to calculate the (patients) age in years</p></li>
|
||||
<li><p>New function <code><a href="../reference/age_groups.html">age_groups()</a></code> to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.</p></li>
|
||||
<li><p>New function <code><a href="../reference/age_groups.html">age_groups()</a></code> to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic AMR data analysis per age group.</p></li>
|
||||
<li>
|
||||
<p>New function <code><a href="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> as well as the base R <code><a href="../reference/plot.html">plot()</a></code> function can now be used for resistance prediction calculated with <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>:</p>
|
||||
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb30"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">x</span> <span class="op"><-</span> <span class="fu"><a href="../reference/resistance_predict.html">resistance_predict</a></span><span class="op">(</span><span class="va">septic_patients</span>, col_ab <span class="op">=</span> <span class="st">"amox"</span><span class="op">)</span>
|
||||
<span class="fu"><a href="../reference/plot.html">plot</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>
|
||||
@ -1379,13 +1410,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
<li>
|
||||
<p>Functions <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> and <code><a href="../reference/first_isolate.html">filter_first_weighted_isolate()</a></code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
|
||||
<div class="sourceCode" id="cb30"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb31"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span> <span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span><span class="op">(</span><span class="va">...</span><span class="op">)</span>
|
||||
<span class="co"># or</span>
|
||||
<span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span><span class="op">(</span><span class="va">septic_patients</span>, <span class="va">...</span><span class="op">)</span></code></pre></div>
|
||||
<p>is equal to:</p>
|
||||
<div class="sourceCode" id="cb31"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb32"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>only_firsts <span class="op">=</span> <span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span><span class="op">(</span><span class="va">septic_patients</span>, <span class="va">...</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
@ -1418,7 +1449,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<ul>
|
||||
<li>
|
||||
<p>Now handles incorrect spelling, like <code>i</code> instead of <code>y</code> and <code>f</code> instead of <code>ph</code>:</p>
|
||||
<div class="sourceCode" id="cb32"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb33"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># mo_fullname() uses as.mo() internally</span>
|
||||
|
||||
@ -1430,7 +1461,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
<li>
|
||||
<p>Uncertainty of the algorithm is now divided into four levels, 0 to 3, where the default <code>allow_uncertain = TRUE</code> is equal to uncertainty level 2. Run <code><a href="../reference/as.mo.html">?as.mo</a></code> for more info about these levels.</p>
|
||||
<div class="sourceCode" id="cb33"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb34"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># equal:</span>
|
||||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="va">...</span>, allow_uncertain <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>
|
||||
@ -1445,7 +1476,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>All microbial IDs that found are now saved to a local file <code>~/.Rhistory_mo</code>. Use the new function <code>clean_mo_history()</code> to delete this file, which resets the algorithms.</p></li>
|
||||
<li>
|
||||
<p>Incoercible results will now be considered ‘unknown’, MO code <code>UNKNOWN</code>. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:</p>
|
||||
<div class="sourceCode" id="cb34"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb35"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="st">"qwerty"</span>, language <span class="op">=</span> <span class="st">"es"</span><span class="op">)</span>
|
||||
<span class="co"># Warning: </span>
|
||||
@ -1491,25 +1522,25 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function):
|
||||
<li>Frequency tables (<code>freq()</code> function):
|
||||
<ul>
|
||||
<li>
|
||||
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
|
||||
<div class="sourceCode" id="cb35"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb36"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span>
|
||||
<span class="co"># OLD WAY</span>
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>genus <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">genus</span><span class="op">)</span>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="va">genus</span><span class="op">)</span>
|
||||
<span class="co"># NEW WAY</span>
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span>
|
||||
|
||||
<span class="co"># Even supports grouping variables:</span>
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
||||
</li>
|
||||
<li><p>Header info is now available as a list, with the <code>header</code> function</p></li>
|
||||
<li><p>The argument <code>header</code> is now set to <code>TRUE</code> at default, even for markdown</p></li>
|
||||
@ -1579,7 +1610,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Fewer than 3 characters as input for <code>as.mo</code> will return NA</p></li>
|
||||
<li>
|
||||
<p>Function <code>as.mo</code> (and all <code>mo_*</code> wrappers) now supports genus abbreviations with “species” attached</p>
|
||||
<div class="sourceCode" id="cb36"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb37"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"E. species"</span><span class="op">)</span> <span class="co"># B_ESCHR</span>
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="st">"E. spp."</span><span class="op">)</span> <span class="co"># "Escherichia species"</span>
|
||||
@ -1592,22 +1623,22 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Using <code>portion_*</code> functions now throws a warning when total available isolate is below argument <code>minimum</code></p></li>
|
||||
<li><p>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</p></li>
|
||||
<li>
|
||||
<p>Frequency tables - <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>:</p>
|
||||
<p>Frequency tables - <code>freq()</code>:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Support for grouping variables, test with:</p>
|
||||
<div class="sourceCode" id="cb37"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
||||
</li>
|
||||
<li>
|
||||
<p>Support for (un)selecting columns:</p>
|
||||
<div class="sourceCode" id="cb38"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
||||
</li>
|
||||
<li>
|
||||
<p>Support for (un)selecting columns:</p>
|
||||
<div class="sourceCode" id="cb39"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="op">-</span><span class="va">count</span>, <span class="op">-</span><span class="va">cum_count</span><span class="op">)</span> <span class="co"># only get item, percent, cum_percent</span></code></pre></div>
|
||||
</li>
|
||||
<li><p>Check for <code><a href="https://hms.tidyverse.org/reference/Deprecated.html">hms::is.hms</a></code></p></li>
|
||||
@ -1625,7 +1656,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Removed diacritics from all authors (columns <code>microorganisms$ref</code> and <code>microorganisms.old$ref</code>) to comply with CRAN policy to only allow ASCII characters</p></li>
|
||||
<li><p>Fix for <code>mo_property</code> not working properly</p></li>
|
||||
<li><p>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</p></li>
|
||||
<li><p>Support for named vectors of class <code>mo</code>, useful for <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">top_freq()</a></code></p></li>
|
||||
<li><p>Support for named vectors of class <code>mo</code>, useful for <code>top_freq()</code></p></li>
|
||||
<li><p><code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> argument</p></li>
|
||||
<li>
|
||||
<p>AI improvements for <code>as.mo</code>:</p>
|
||||
@ -1684,7 +1715,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
</li>
|
||||
</ul>
|
||||
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
|
||||
<div class="sourceCode" id="cb39"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb40"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span><span class="op">(</span><span class="st">"E. coli"</span><span class="op">)</span>
|
||||
<span class="co"># [1] "Gram negative"</span>
|
||||
@ -1695,7 +1726,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span><span class="op">(</span><span class="st">"S. group A"</span>, language <span class="op">=</span> <span class="st">"pt"</span><span class="op">)</span> <span class="co"># Portuguese</span>
|
||||
<span class="co"># [1] "Streptococcus grupo A"</span></code></pre></div>
|
||||
<p>Furthermore, former taxonomic names will give a note about the current taxonomic name:</p>
|
||||
<div class="sourceCode" id="cb40"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb41"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span><span class="op">(</span><span class="st">"Esc blattae"</span><span class="op">)</span>
|
||||
<span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span>
|
||||
@ -1710,7 +1741,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Function <code>is.rsi.eligible</code> to check for columns that have valid antimicrobial results, but do not have the <code>rsi</code> class yet. Transform the columns of your raw data with: <code>data %>% mutate_if(is.rsi.eligible, as.rsi)</code></p></li>
|
||||
<li>
|
||||
<p>Functions <code>as.mo</code> and <code>is.mo</code> as replacements for <code>as.bactid</code> and <code>is.bactid</code> (since the <code>microoganisms</code> data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The <code>as.mo</code> function determines microbial IDs using intelligent rules:</p>
|
||||
<div class="sourceCode" id="cb41"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"E. coli"</span><span class="op">)</span>
|
||||
<span class="co"># [1] B_ESCHR_COL</span>
|
||||
@ -1719,7 +1750,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"S group A"</span><span class="op">)</span>
|
||||
<span class="co"># [1] B_STRPTC_GRA</span></code></pre></div>
|
||||
<p>And with great speed too - on a quite regular Linux server from 2007 it takes us less than 0.02 seconds to transform 25,000 items:</p>
|
||||
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb43"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">thousands_of_E_colis</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op">(</span><span class="st">"E. coli"</span>, <span class="fl">25000</span><span class="op">)</span>
|
||||
<span class="fu">microbenchmark</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span><span class="op">(</span><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="va">thousands_of_E_colis</span><span class="op">)</span>, unit <span class="op">=</span> <span class="st">"s"</span><span class="op">)</span>
|
||||
@ -1753,7 +1784,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</p></li>
|
||||
<li>
|
||||
<p>Added 163 trade names to the <code>antibiotics</code> data set, it now contains 298 different trade names in total, e.g.:</p>
|
||||
<div class="sourceCode" id="cb43"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb44"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="fu">ab_official</span><span class="op">(</span><span class="st">"Bactroban"</span><span class="op">)</span>
|
||||
<span class="co"># [1] "Mupirocin"</span>
|
||||
@ -1770,7 +1801,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Added arguments <code>minimum</code> and <code>as_percent</code> to <code>portion_df</code></p></li>
|
||||
<li>
|
||||
<p>Support for quasiquotation in the functions series <code>count_*</code> and <code>portions_*</code>, and <code>n_rsi</code>. This allows to check for more than 2 vectors or columns.</p>
|
||||
<div class="sourceCode" id="cb44"><pre class="downlit sourceCode r">
|
||||
<div class="sourceCode" id="cb45"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">septic_patients</span> <span class="op">%>%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">amox</span>, <span class="va">cipr</span><span class="op">)</span> <span class="op">%>%</span> <span class="fu"><a href="../reference/count.html">count_IR</a></span><span class="op">(</span><span class="op">)</span>
|
||||
<span class="co"># which is the same as:</span>
|
||||
@ -1790,16 +1821,16 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<li><p>Added longest en shortest character length in the frequency table (<code>freq</code>) header of class <code>character</code></p></li>
|
||||
<li>
|
||||
<p>Support for types (classes) list and matrix for <code>freq</code></p>
|
||||
<div class="sourceCode" id="cb45"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">my_matrix</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span><span class="op">(</span><span class="va">septic_patients</span>, <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="va">age</span>, <span class="va">gender</span><span class="op">)</span>, ncol <span class="op">=</span> <span class="fl">2</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">my_matrix</span><span class="op">)</span></code></pre></div>
|
||||
<p>For lists, subsetting is possible:</p>
|
||||
<div class="sourceCode" id="cb46"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">my_matrix</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span><span class="op">(</span><span class="va">septic_patients</span>, <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="va">age</span>, <span class="va">gender</span><span class="op">)</span>, ncol <span class="op">=</span> <span class="fl">2</span><span class="op">)</span><span class="op">)</span>
|
||||
<span class="fu">freq</span><span class="op">(</span><span class="va">my_matrix</span><span class="op">)</span></code></pre></div>
|
||||
<p>For lists, subsetting is possible:</p>
|
||||
<div class="sourceCode" id="cb47"><pre class="downlit sourceCode r">
|
||||
<code class="sourceCode R">
|
||||
<span class="va">my_list</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>age <span class="op">=</span> <span class="va">septic_patients</span><span class="op">$</span><span class="va">age</span>, gender <span class="op">=</span> <span class="va">septic_patients</span><span class="op">$</span><span class="va">gender</span><span class="op">)</span>
|
||||
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span>
|
||||
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
||||
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span>
|
||||
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -1873,13 +1904,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
<ul>
|
||||
<li>A vignette to explain its usage</li>
|
||||
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
|
||||
<li>Support for <code>table</code> to use as input: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(table(x, y))</a></code>
|
||||
<li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</code>
|
||||
</li>
|
||||
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://rdrr.io/r/graphics/hist.html">hist(freq(df$age))</a></code>
|
||||
</li>
|
||||
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
|
||||
</li>
|
||||
<li>Support for quasiquotation: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %>% freq(mycolumn)</code>
|
||||
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %>% freq(mycolumn)</code>
|
||||
</li>
|
||||
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
|
||||
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>
|
||||
|
@ -12,7 +12,7 @@ articles:
|
||||
datasets: datasets.html
|
||||
resistance_predict: resistance_predict.html
|
||||
welcome_to_AMR: welcome_to_AMR.html
|
||||
last_built: 2021-01-28T15:08Z
|
||||
last_built: 2021-02-04T15:47Z
|
||||
urls:
|
||||
reference: https://msberends.github.io/AMR//reference
|
||||
article: https://msberends.github.io/AMR//articles
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -255,7 +255,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>retired</
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -253,7 +253,7 @@
|
||||
<li><p>Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the Catalogue of Life and List of Prokaryotic names with Standing in Nomenclature</p></li>
|
||||
<li><p>Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines</p></li>
|
||||
<li><p>Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records</p></li>
|
||||
<li><p>Determining first isolates to be used for AMR analysis</p></li>
|
||||
<li><p>Determining first isolates to be used for AMR data analysis</p></li>
|
||||
<li><p>Calculating antimicrobial resistance</p></li>
|
||||
<li><p>Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)</p></li>
|
||||
<li><p>Calculating (empirical) susceptibility of both mono therapy and combination therapies</p></li>
|
||||
@ -277,7 +277,7 @@
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<h2 class="hasAnchor" id="contact-us"><a class="anchor" href="#contact-us"></a>Contact Us</h2>
|
||||
|
||||
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -257,7 +257,7 @@ This package contains <strong>all ~550 antibiotic, antimycotic and antiviral dru
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='fu'><a href='as.ab.html'>as.ab</a></span><span class='op'>(</span><span class='st'>"meropenem"</span><span class='op'>)</span>
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -285,7 +285,7 @@
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -264,7 +264,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>collapse</th>
|
||||
<td><p>character to pass on to <code><a href='https://rdrr.io/r/base/paste.html'>paste(..., collapse = ...)</a></code> to only return one character per element of <code>text</code>, see <em>Examples</em></p></td>
|
||||
<td><p>character to pass on to <code><a href='https://rdrr.io/r/base/paste.html'>paste(, collapse = ...)</a></code> to only return one character per element of <code>text</code>, see <em>Examples</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>translate_ab</th>
|
||||
@ -311,7 +311,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='co'># mind the bad spelling of amoxicillin in this line, </span>
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -342,7 +342,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||
|
||||
<div class='dont-index'><p><a href='antibiotics.html'>antibiotics</a></p></div>
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -286,7 +286,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||
|
||||
<div class='dont-index'><p>To split ages into groups, use the <code><a href='age_groups.html'>age_groups()</a></code> function.</p></div>
|
||||
|
@ -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.5.0.9008</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -288,7 +288,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
|
||||
|
||||
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR data analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
|
||||
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
|
||||
|
||||
<div class='dont-index'><p>To determine ages, based on one or more reference dates, use the <code><a href='age.html'>age()</a></code> function.</p></div>
|
||||
|