Compare commits

...

5 Commits

54 changed files with 458 additions and 491 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.7.1.9013
Date: 2021-07-04
Version: 1.7.1.9018
Date: 2021-07-11
Title: Antimicrobial Resistance Data Analysis
Authors@R: c(
person(role = c("aut", "cre"),

View File

@ -20,24 +20,20 @@ S3method("[",ab)
S3method("[",disk)
S3method("[",mic)
S3method("[",mo)
S3method("[",taxonomic_name)
S3method("[<-",ab)
S3method("[<-",disk)
S3method("[<-",mic)
S3method("[<-",mo)
S3method("[<-",rsi)
S3method("[<-",taxonomic_name)
S3method("[[",ab)
S3method("[[",disk)
S3method("[[",mic)
S3method("[[",mo)
S3method("[[",taxonomic_name)
S3method("[[<-",ab)
S3method("[[<-",disk)
S3method("[[<-",mic)
S3method("[[<-",mo)
S3method("[[<-",rsi)
S3method("[[<-",taxonomic_name)
S3method("^",mic)
S3method("|",mic)
S3method(abs,mic)
@ -51,7 +47,6 @@ S3method(any,ab_selector_any_all)
S3method(any,mic)
S3method(as.data.frame,ab)
S3method(as.data.frame,mo)
S3method(as.data.frame,taxonomic_name)
S3method(as.double,mic)
S3method(as.integer,mic)
S3method(as.list,custom_eucast_rules)
@ -77,7 +72,6 @@ S3method(c,disk)
S3method(c,mic)
S3method(c,mo)
S3method(c,rsi)
S3method(c,taxonomic_name)
S3method(ceiling,mic)
S3method(cos,mic)
S3method(cosh,mic)
@ -123,11 +117,14 @@ S3method(print,mo_renamed)
S3method(print,mo_uncertainties)
S3method(print,pca)
S3method(print,rsi)
S3method(print,taxonomic_name)
S3method(prod,mic)
S3method(quantile,mic)
S3method(range,mic)
S3method(rep,ab)
S3method(rep,disk)
S3method(rep,mic)
S3method(rep,mo)
S3method(rep,rsi)
S3method(round,mic)
S3method(sign,mic)
S3method(signif,mic)
@ -154,7 +151,6 @@ S3method(unique,disk)
S3method(unique,mic)
S3method(unique,mo)
S3method(unique,rsi)
S3method(unique,taxonomic_name)
export("%like%")
export("%like_case%")
export("%unlike%")

10
NEWS.md
View File

@ -1,11 +1,12 @@
# `AMR` 1.7.1.9013
## <small>Last updated: 4 July 2021</small>
# `AMR` 1.7.1.9018
## <small>Last updated: 11 July 2021</small>
### Changed
* Antibiotic class selectors (see `ab_class()`)
* They now finally also work in R-3.0 and R-3.1, supporting every version of R since 2013
* They now also work in R-3.0 and R-3.1, supporting every version of R since 2013
* Added more selectors: `aminopenicillins()`, `lincosamides()`, `lipoglycopeptides()`, `polymyxins()`, `quinolones()`, `streptogramins()` and `ureidopenicillins()`
* Fix for using selectors multiple times in one call (e.g., using them in `dplyr::filter()` and immediately after in `dplyr::select()`)
* Added argument `only_treatable`, which defaults to `TRUE` and will exclude drugs that are only for laboratory tests and not for treating patients (such as imipenem/EDTA and gentamicin-high)
* Fix for duplicate ATC codes in the `antibiotics` data set
* Added `ggplot2::autoplot()` generic for classes `<mic>`, `<disk>`, `<rsi>` and `<resistance_predict>`
* Fix to prevent introducing `NA`s for old MO codes when running `as.mo()` on them
@ -17,7 +18,8 @@
* When warnings are throws because of too few isolates in any `count_*()`, `proportion_*()` function (or `resistant()` or `susceptible()`), the `dplyr` group will be shown, if available
* Taxonomic names now print in italic in tibbles, if created with `mo_name()`, `mo_fullname()`, `mo_shortname()`, `mo_genus()` or `mo_family()`
* `ab_name()` gained argument `snake_case`, which is useful for column renaming
* Fix for legends created with `scale_rsi_colours()` when using `ggplot2` v3.3.4 or higher (this is `ggplot2` bug #4511, soon to be fixed)
* Fix for legends created with `scale_rsi_colours()` when using `ggplot2` v3.3.4 or higher (this is bug ggplot2#4511, soon to be fixed)
* Fix for minor translation errors
# `AMR` 1.7.1

9
R/ab.R
View File

@ -580,6 +580,15 @@ unique.ab <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep ab
#' @export
#' @noRd
rep.ab <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
generalise_antibiotic_name <- function(x) {
x <- toupper(x)
# remove suffices

View File

@ -29,6 +29,7 @@
#' @inheritSection lifecycle Stable Lifecycle
#' @param ab_class an antimicrobial class, such as `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
#' @param only_treatable a [logical] to indicate whether agents that are only for laboratory tests should be excluded (defaults to `TRUE`), such as gentamicin-high (`GEH`) and imipenem/EDTA (`IPE`)
#' @details
#' These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the [Tidyverse selection helpers][tidyselect::language] such as [`everything()`][tidyselect::everything()], but also work in base \R and not only in `dplyr` verbs. Nonetheless, they are very convenient to use with `dplyr` functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()], see *Examples*.
#'
@ -123,17 +124,20 @@
#' }
#' }
ab_class <- function(ab_class,
only_rsi_columns = FALSE) {
only_rsi_columns = FALSE,
only_treatable = TRUE) {
meet_criteria(ab_class, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
ab_selector(NULL, only_rsi_columns = only_rsi_columns, ab_class = ab_class)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
ab_selector(NULL, only_rsi_columns = only_rsi_columns, ab_class = ab_class, only_treatable = only_treatable)
}
#' @rdname antibiotic_class_selectors
#' @export
aminoglycosides <- function(only_rsi_columns = FALSE) {
aminoglycosides <- function(only_rsi_columns = FALSE, only_treatable = TRUE) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
ab_selector("aminoglycosides", only_rsi_columns = only_rsi_columns)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
ab_selector("aminoglycosides", only_rsi_columns = only_rsi_columns, only_treatable = only_treatable)
}
#' @rdname antibiotic_class_selectors
@ -145,16 +149,18 @@ aminopenicillins <- function(only_rsi_columns = FALSE) {
#' @rdname antibiotic_class_selectors
#' @export
betalactams <- function(only_rsi_columns = FALSE) {
betalactams <- function(only_rsi_columns = FALSE, only_treatable = TRUE) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
ab_selector("betalactams", only_rsi_columns = only_rsi_columns)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
ab_selector("betalactams", only_rsi_columns = only_rsi_columns, only_treatable = only_treatable)
}
#' @rdname antibiotic_class_selectors
#' @export
carbapenems <- function(only_rsi_columns = FALSE) {
carbapenems <- function(only_rsi_columns = FALSE, only_treatable = TRUE) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
ab_selector("carbapenems", only_rsi_columns = only_rsi_columns)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
ab_selector("carbapenems", only_rsi_columns = only_rsi_columns, only_treatable = only_treatable)
}
#' @rdname antibiotic_class_selectors
@ -250,9 +256,10 @@ penicillins <- function(only_rsi_columns = FALSE) {
#' @rdname antibiotic_class_selectors
#' @export
polymyxins <- function(only_rsi_columns = FALSE) {
polymyxins <- function(only_rsi_columns = FALSE, only_treatable = TRUE) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
ab_selector("polymyxins", only_rsi_columns = only_rsi_columns)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
ab_selector("polymyxins", only_rsi_columns = only_rsi_columns, only_treatable = only_treatable)
}
#' @rdname antibiotic_class_selectors
@ -285,6 +292,7 @@ ureidopenicillins <- function(only_rsi_columns = FALSE) {
ab_selector <- function(function_name,
only_rsi_columns,
only_treatable = FALSE,
ab_class = NULL) {
# get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call
# but it only takes a couple of milliseconds
@ -292,6 +300,23 @@ ab_selector <- function(function_name,
# to improve speed, get_column_abx() will only run once when e.g. in a select or group call
ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns, sort = FALSE)
# untreatable drugs
untreatable <- antibiotics[which(antibiotics$name %like% "-high|EDTA|polysorbate"), "ab", drop = TRUE]
if (only_treatable == TRUE & any(untreatable %in% names(ab_in_data))) {
if (message_not_thrown_before(paste0("ab_class.untreatable.", function_name), entire_session = TRUE)) {
warning_("Some agents in `", function_name, "()` were ignored since they cannot be used for treating patients: ",
vector_and(ab_name(names(ab_in_data)[names(ab_in_data) %in% untreatable],
language = NULL,
tolower = TRUE),
quotes = FALSE,
sort = TRUE), ". They can be included using `", function_name, "(only_treatable = FALSE)`. ",
"This warning will be shown once per session.",
call = FALSE)
remember_thrown_message(paste0("ab_class.untreatable.", function_name), entire_session = TRUE)
}
ab_in_data <- ab_in_data[!names(ab_in_data) %in% untreatable]
}
if (length(ab_in_data) == 0) {
message_("No antimicrobial agents found in the data.")
return(NULL)

View File

@ -81,7 +81,7 @@ bug_drug_combinations <- function(x,
unique_mo <- sort(unique(x[, col_mo, drop = TRUE]))
# select only groups and antibiotics
if (inherits(x.bak, "grouped_df")) {
if (is_null_or_grouped_tbl(x.bak)) {
data_has_groups <- TRUE
groups <- setdiff(names(attributes(x.bak)$groups), ".rows")
x <- x[, c(groups, col_mo, colnames(x)[vapply(FUN.VALUE = logical(1), x, is.rsi)]), drop = FALSE]
@ -113,7 +113,7 @@ bug_drug_combinations <- function(x,
data.frame(S = m["S", ], I = m["I", ], R = m["R", ], stringsAsFactors = FALSE)
})
merged <- do.call(rbind, pivot)
out_group <- data.frame(mo = unique_mo[i],
out_group <- data.frame(mo = rep(unique_mo[i], NROW(merged)),
ab = rownames(merged),
S = merged$S,
I = merged$I,

View File

@ -195,6 +195,15 @@ unique.disk <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep disk
#' @export
#' @noRd
rep.disk <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
# will be exported using s3_register() in R/zzz.R
get_skimmers.disk <- function(column) {
skimr::sfl(

11
R/mic.R
View File

@ -320,6 +320,15 @@ unique.mic <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep mic
#' @export
#' @noRd
rep.mic <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
#' @method sort mic
#' @export
#' @noRd
@ -337,7 +346,7 @@ sort.mic <- function(x, decreasing = FALSE, ...) {
#' @export
#' @noRd
hist.mic <- function(x, ...) {
warning_("Use `plot()` or `ggplot()` for optimal plotting of MIC values", call = FALSE)
warning_("Use `plot()` or ggplot2's `autoplot()` for optimal plotting of MIC values", call = FALSE)
hist(log2(x))
}

2
R/mo.R
View File

@ -469,7 +469,7 @@ exec_as.mo <- function(x,
x <- strip_whitespace(x, dyslexia_mode)
# translate 'unknown' names back to English
if (any(x %like% "unbekannt|onbekend|desconocid|sconosciut|iconnu|desconhecid", na.rm = TRUE)) {
trns <- subset(TRANSLATIONS, pattern %like% "unknown" | affect_mo_name == TRUE)
trns <- subset(TRANSLATIONS, pattern %like% "unknown")
langs <- LANGUAGES_SUPPORTED[LANGUAGES_SUPPORTED != "en"]
for (l in langs) {
for (i in seq_len(nrow(trns))) {

View File

@ -48,8 +48,6 @@
#'
#' Intrinsic resistance - [mo_is_intrinsic_resistant()] - will be determined based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.2)`. The [mo_is_intrinsic_resistant()] functions can be vectorised over arguments `x` (input for microorganisms) and over `ab` (input for antibiotics).
#'
#' The functions [mo_family()], [mo_genus()], [mo_name()], [mo_fullname()] and [mo_shortname()] are returned with an additional class `taxonomic_name`, which allows italic printing in [tibbles][tibble::tibble()].
#'
#' All output [will be translated][translate] where possible.
#'
#' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
@ -65,7 +63,6 @@
#' - A [list] in case of [mo_taxonomy()] and [mo_info()]
#' - A named [character] in case of [mo_url()]
#' - A [numeric] in case of [mo_snomed()]
#' - A [character] with additional class `taxonomic_name` in case of [mo_family()], [mo_genus()], [mo_name()], [mo_fullname()] and [mo_shortname()]
#' - A [character] in all other cases
#' @export
#' @seealso Data set [microorganisms]
@ -225,8 +222,7 @@ mo_shortname <- function(x, language = get_locale(), ...) {
shortnames[is.na(x.mo)] <- NA_character_
load_mo_failures_uncertainties_renamed(metadata)
out <- translate_AMR(shortnames, language = language, only_unknown = FALSE, only_affect_mo_names = TRUE)
set_clean_class(out, new_class = c("taxonomic_name", "character"))
translate_AMR(shortnames, language = language, only_unknown = FALSE, only_affect_mo_names = TRUE)
}
@ -744,9 +740,6 @@ mo_validate <- function(x, property, language, ...) {
if (property == "mo") {
return(set_clean_class(x, new_class = c("mo", "character")))
} else if (property %in% c("fullname", "genus", "family")) {
# shortname is considered in mo_shortname()
return(set_clean_class(x, new_class = c("taxonomic_name", "character")))
} else if (property == "snomed") {
return(as.double(eval(parse(text = x))))
} else {
@ -772,87 +765,3 @@ find_mo_col <- function(fn) {
stop_("argument `x` is missing and no column with info about microorganisms could be found.", call = -2)
}
}
#' @method print taxonomic_name
#' @export
#' @noRd
print.taxonomic_name <- function(x, ...) {
print(unclass(x), ...)
}
#' @method as.data.frame taxonomic_name
#' @export
#' @noRd
as.data.frame.taxonomic_name <- function(x, ...) {
nm <- deparse1(substitute(x))
if (!"nm" %in% names(list(...))) {
as.data.frame(unclass(x), ..., nm = nm)
} else {
as.data.frame(unclass(x), ...)
}
}
# will be exported using s3_register() in R/zzz.R
type_sum.taxonomic_name <- function(x, ...) {
"chr/taxon"
}
# will be exported using s3_register() in R/zzz.R
pillar_shaft.taxonomic_name <- function(x, ...) {
out <- format(x)
hits <- tolower(x) %in% MO_lookup$fullname_lower | tolower(gsub("[^a-zA-Z ]", "", x)) %in% c(MO_lookup$g_species)
# grey out the kingdom (part until first "_")
out[hits] <- font_italic(x[hits], collapse = NULL)
out[is.na(x)] <- font_na(out[is.na(x)], collapse = NULL)
create_pillar_column(out, align = "left")
}
#' @method [ taxonomic_name
#' @export
#' @noRd
"[.taxonomic_name" <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
#' @method [[ taxonomic_name
#' @export
#' @noRd
"[[.taxonomic_name" <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
#' @method [<- taxonomic_name
#' @export
#' @noRd
"[<-.taxonomic_name" <- function(i, j, ..., value) {
value <- set_clean_class(value, c("taxonomic_name", "character"))
y <- NextMethod()
attributes(y) <- attributes(i)
y
}
#' @method [[<- taxonomic_name
#' @export
#' @noRd
"[[<-.taxonomic_name" <- function(i, j, ..., value) {
value <- set_clean_class(value, c("taxonomic_name", "character"))
y <- NextMethod()
attributes(y) <- attributes(i)
y
}
#' @method c taxonomic_name
#' @export
#' @noRd
c.taxonomic_name <- function(...) {
set_clean_class(unlist(lapply(list(...), as.character)), c("taxonomic_name", "character"))
}
#' @method unique taxonomic_name
#' @export
#' @noRd
unique.taxonomic_name <- function(x, incomparables = FALSE, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}

View File

@ -1054,6 +1054,15 @@ unique.rsi <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep rsi
#' @export
#' @noRd
rep.rsi <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
check_reference_data <- function(reference_data) {
if (!identical(reference_data, AMR::rsi_translation)) {
class_rsi <- vapply(FUN.VALUE = character(1), rsi_translation, function(x) paste0("<", class(x), ">", collapse = " and "))

View File

@ -228,7 +228,7 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
translate_ab <- get_translate_ab(translate_ab)
# select only groups and antibiotics
if (inherits(data, "grouped_df")) {
if (is_null_or_grouped_tbl(data)) {
data_has_groups <- TRUE
groups <- setdiff(names(attributes(data)$groups), ".rows")
data <- data[, c(groups, colnames(data)[vapply(FUN.VALUE = logical(1), data, is.rsi)]), drop = FALSE]

Binary file not shown.

View File

@ -38,7 +38,7 @@ if (utf8_supported && !is_latex) {
pkg_env$info_icon <- "i"
}
.onLoad <- function(libname, pkgname) {
.onLoad <- function(...) {
# Support for tibble headers (type_sum) and tibble columns content (pillar_shaft)
# without the need to depend on other packages. This was suggested by the
# developers of the vctrs package:
@ -48,13 +48,11 @@ if (utf8_supported && !is_latex) {
s3_register("pillar::pillar_shaft", "rsi")
s3_register("pillar::pillar_shaft", "mic")
s3_register("pillar::pillar_shaft", "disk")
s3_register("pillar::pillar_shaft", "taxonomic_name")
s3_register("tibble::type_sum", "ab")
s3_register("tibble::type_sum", "mo")
s3_register("tibble::type_sum", "rsi")
s3_register("tibble::type_sum", "mic")
s3_register("tibble::type_sum", "disk")
s3_register("tibble::type_sum", "taxonomic_name")
# Support for frequency tables from the cleaner package
s3_register("cleaner::freq", "mo")
s3_register("cleaner::freq", "rsi")
@ -88,7 +86,6 @@ if (utf8_supported && !is_latex) {
assign(x = "INTRINSIC_R", value = create_intr_resistance(), envir = asNamespace("AMR"))
}
# Helper functions --------------------------------------------------------
create_AB_lookup <- function() {

Binary file not shown.

View File

@ -70,6 +70,8 @@ TRANSLATIONS <- utils::read.delim(file = "data-raw/translations.tsv",
# for checking input in `language` argument in e.g. mo_*() and ab_*() functions
LANGUAGES_SUPPORTED <- sort(c("en", colnames(TRANSLATIONS)[nchar(colnames(TRANSLATIONS)) == 2]))
# EXAMPLE_ISOLATES <- readRDS("data-raw/example_isolates.rds")
# vectors of CoNS and CoPS, improves speed in as.mo()
create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
# Determination of which staphylococcal species are CoNS/CoPS according to:
@ -147,6 +149,7 @@ DEFINED_AB_GROUPS <- DEFINED_AB_GROUPS[!DEFINED_AB_GROUPS %in% globalenv_before_
usethis::use_data(EUCAST_RULES_DF,
TRANSLATIONS,
LANGUAGES_SUPPORTED,
# EXAMPLE_ISOLATES,
MO_CONS,
MO_COPS,
AMINOGLYCOSIDES,

Binary file not shown.

View File

@ -1 +1 @@
7c7f6a0ecfc2e122c4547c0ebed09346
1a7fe52f8185c9bb2c470712863d1887

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -16,6 +16,7 @@ unknown genus TRUE TRUE FALSE TRUE unbekannte Gattung onbekend geslacht género
unknown species TRUE TRUE FALSE TRUE unbekannte Art onbekende soort especie desconocida specie sconosciute espèce inconnue espécies desconhecida
unknown subspecies TRUE TRUE FALSE TRUE unbekannte Unterart onbekende ondersoort subespecie desconocida sottospecie sconosciute sous-espèce inconnue subespécies desconhecida
unknown rank TRUE TRUE FALSE TRUE unbekannter Rang onbekende rang rango desconocido grado sconosciuto rang inconnu classificação desconhecido
group TRUE TRUE FALSE TRUE Gruppe groep grupo gruppo groupe grupo
CoNS FALSE TRUE FALSE TRUE KNS CNS SCN
CoPS FALSE TRUE FALSE TRUE KPS CPS SCP
Gram-negative TRUE TRUE FALSE FALSE Gramnegativ Gram-negatief Gram negativo Gram negativo Gram négatif Gram negativo

1 pattern regular_expr case_sensitive affect_ab_name affect_mo_name de nl es it fr pt
16 unknown species TRUE TRUE FALSE TRUE unbekannte Art onbekende soort especie desconocida specie sconosciute espèce inconnue espécies desconhecida
17 unknown subspecies TRUE TRUE FALSE TRUE unbekannte Unterart onbekende ondersoort subespecie desconocida sottospecie sconosciute sous-espèce inconnue subespécies desconhecida
18 unknown rank TRUE TRUE FALSE TRUE unbekannter Rang onbekende rang rango desconocido grado sconosciuto rang inconnu classificação desconhecido
19 group TRUE TRUE FALSE TRUE Gruppe groep grupo gruppo groupe grupo
20 CoNS FALSE TRUE FALSE TRUE KNS CNS SCN
21 CoPS FALSE TRUE FALSE TRUE KPS CPS SCP
22 Gram-negative TRUE TRUE FALSE FALSE Gramnegativ Gram-negatief Gram negativo Gram negativo Gram négatif Gram negativo

View File

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

View File

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

View File

@ -39,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9014</span>
</span>
</div>
@ -193,7 +193,7 @@
<h1 data-toc-skip>How to conduct AMR data analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">04 July 2021</h4>
<h4 class="date">06 July 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/AMR.Rmd"><code>vignettes/AMR.Rmd</code></a></small>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -202,7 +202,7 @@
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 04 July 2021.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 06 July 2021.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -233,21 +233,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2021-07-04</td>
<td align="center">2021-07-06</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2021-07-04</td>
<td align="center">2021-07-06</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2021-07-04</td>
<td align="center">2021-07-06</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -344,32 +344,32 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-09-28</td>
<td align="center">A1</td>
<td align="center">Hospital A</td>
<td align="center">2016-02-04</td>
<td align="center">V9</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2012-09-28</td>
<td align="center">J9</td>
<td align="center">2011-09-24</td>
<td align="center">D2</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2011-10-02</td>
<td align="center">S7</td>
<td align="center">Hospital B</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">2014-06-20</td>
<td align="center">Z9</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -377,9 +377,9 @@
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2016-11-15</td>
<td align="center">U6</td>
<td align="center">Hospital A</td>
<td align="center">2018-01-01</td>
<td align="center">P4</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
@ -388,26 +388,26 @@
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2016-12-08</td>
<td align="center">B10</td>
<td align="center">2014-12-14</td>
<td align="center">W2</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-05-10</td>
<td align="center">M2</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">2016-07-27</td>
<td align="center">R6</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
</tbody>
</table>
@ -441,16 +441,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,434</td>
<td align="right">52.17%</td>
<td align="right">10,434</td>
<td align="right">52.17%</td>
<td align="right">10,365</td>
<td align="right">51.83%</td>
<td align="right">10,365</td>
<td align="right">51.83%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,566</td>
<td align="right">47.83%</td>
<td align="right">9,635</td>
<td align="right">48.18%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -505,9 +505,9 @@ Longest: 1</p>
<span class="co"># Using column 'patient_id' as input for `col_patient_id`.</span>
<span class="co"># Basing inclusion on all antimicrobial results, using a points threshold of</span>
<span class="co"># 2</span>
<span class="co"># =&gt; Found 10,702 first weighted isolates (phenotype-based, 53.5% of total</span>
<span class="co"># =&gt; Found 10,656 first weighted isolates (phenotype-based, 53.3% of total</span>
<span class="co"># where a microbial ID was available)</span></code></pre></div>
<p>So only 53.5% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<p>So only 53.3% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="va">first</span> <span class="op">==</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
@ -515,7 +515,7 @@ Longest: 1</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
<p>So we end up with 10,702 isolates for analysis. Now our data looks like:</p>
<p>So we end up with 10,656 isolates for analysis. Now our data looks like:</p>
<div class="sourceCode" id="cb17"><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">data_1st</span><span class="op">)</span></code></pre></div>
<table class="table">
@ -531,7 +531,7 @@ Longest: 1</p>
<col width="3%">
<col width="6%">
<col width="11%">
<col width="12%">
<col width="13%">
<col width="9%">
<col width="5%">
</colgroup>
@ -553,73 +553,25 @@ Longest: 1</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="left">1</td>
<td align="center">2016-09-28</td>
<td align="center">A1</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="center">2012-09-28</td>
<td align="center">J9</td>
<td align="center">2011-09-24</td>
<td align="center">D2</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="center">2016-12-08</td>
<td align="center">B10</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">7</td>
<td align="center">2015-04-29</td>
<td align="center">W8</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">8</td>
<td align="center">2010-06-19</td>
<td align="center">Q5</td>
<td align="left">3</td>
<td align="center">2014-06-20</td>
<td align="center">Z9</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">S</td>
@ -628,26 +580,74 @@ Longest: 1</p>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center"><em>Staphylococcus</em></td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">6</td>
<td align="center">2016-07-27</td>
<td align="center">R6</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center"><em>Staphylococcus</em></td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">9</td>
<td align="center">2010-08-20</td>
<td align="center">A8</td>
<td align="center">Hospital B</td>
<td align="left">7</td>
<td align="center">2011-07-24</td>
<td align="center">W2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center"><em>Escherichia</em></td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">9</td>
<td align="center">2012-01-12</td>
<td align="center">K9</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center"><em>Escherichia</em></td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">11</td>
<td align="center">2013-03-11</td>
<td align="center">B6</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center"><em>Klebsiella</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>Time for the analysis!</p>
@ -669,8 +669,8 @@ Longest: 1</p>
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</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="va">species</span><span class="op">)</span></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 10,702<br>
Available: 10,702 (100.0%, NA: 0 = 0.0%)<br>
Length: 10,656<br>
Available: 10,656 (100.0%, NA: 0 = 0.0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -687,33 +687,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">4,661</td>
<td align="right">43.55%</td>
<td align="right">4,661</td>
<td align="right">43.55%</td>
<td align="right">4,664</td>
<td align="right">43.77%</td>
<td align="right">4,664</td>
<td align="right">43.77%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">2,697</td>
<td align="right">25.20%</td>
<td align="right">7,358</td>
<td align="right">68.75%</td>
<td align="right">2,730</td>
<td align="right">25.62%</td>
<td align="right">7,394</td>
<td align="right">69.39%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,145</td>
<td align="right">20.04%</td>
<td align="right">9,503</td>
<td align="right">88.80%</td>
<td align="right">2,093</td>
<td align="right">19.64%</td>
<td align="right">9,487</td>
<td align="right">89.03%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,199</td>
<td align="right">11.20%</td>
<td align="right">10,702</td>
<td align="right">1,169</td>
<td align="right">10.97%</td>
<td align="right">10,656</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -732,14 +732,14 @@ Longest: 24</p>
<col width="9%">
<col width="9%">
<col width="9%">
<col width="11%">
<col width="10%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="6%">
<col width="11%">
<col width="11%">
<col width="13%">
<col width="9%">
<col width="5%">
</colgroup>
@ -760,23 +760,38 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-09-28</td>
<td align="center">A1</td>
<td align="center">2011-09-24</td>
<td align="center">D2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">Gram-positive</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2012-09-28</td>
<td align="center">J9</td>
<td align="center">2011-07-24</td>
<td align="center">W2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center"><em>Escherichia</em></td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2011-03-17</td>
<td align="center">D5</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
@ -785,67 +800,52 @@ Longest: 24</p>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2015-04-29</td>
<td align="center">W8</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2017-02-20</td>
<td align="center">P2</td>
<td align="center">Hospital C</td>
<td align="center">2011-06-13</td>
<td align="center">X10</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2010-09-14</td>
<td align="center">T8</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2011-01-26</td>
<td align="center">K8</td>
<td align="center">2010-04-12</td>
<td align="center">Z4</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2017-02-25</td>
<td align="center">B5</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
@ -868,52 +868,52 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">AMX</td>
<td align="center">2209</td>
<td align="center">123</td>
<td align="center">2329</td>
<td align="center">4661</td>
<td align="center">2180</td>
<td align="center">145</td>
<td align="center">2339</td>
<td align="center">4664</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">AMC</td>
<td align="center">3406</td>
<td align="center">165</td>
<td align="center">1090</td>
<td align="center">4661</td>
<td align="center">3360</td>
<td align="center">176</td>
<td align="center">1128</td>
<td align="center">4664</td>
</tr>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">CIP</td>
<td align="center">3416</td>
<td align="center">3405</td>
<td align="center">0</td>
<td align="center">1245</td>
<td align="center">4661</td>
<td align="center">1259</td>
<td align="center">4664</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">GEN</td>
<td align="center">4086</td>
<td align="center">4078</td>
<td align="center">0</td>
<td align="center">575</td>
<td align="center">4661</td>
<td align="center">586</td>
<td align="center">4664</td>
</tr>
<tr class="odd">
<td align="center">K. pneumoniae</td>
<td align="center"><em>K. pneumoniae</em></td>
<td align="center">AMX</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">1199</td>
<td align="center">1199</td>
<td align="center">1169</td>
<td align="center">1169</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center"><em>K. pneumoniae</em></td>
<td align="center">AMC</td>
<td align="center">933</td>
<td align="center">39</td>
<td align="center">227</td>
<td align="center">1199</td>
<td align="center">924</td>
<td align="center">49</td>
<td align="center">196</td>
<td align="center">1169</td>
</tr>
</tbody>
</table>
@ -934,36 +934,36 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">GEN</td>
<td align="center">4086</td>
<td align="center">4078</td>
<td align="center">0</td>
<td align="center">575</td>
<td align="center">4661</td>
<td align="center">586</td>
<td align="center">4664</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center"><em>K. pneumoniae</em></td>
<td align="center">GEN</td>
<td align="center">1068</td>
<td align="center">1042</td>
<td align="center">0</td>
<td align="center">131</td>
<td align="center">1199</td>
<td align="center">127</td>
<td align="center">1169</td>
</tr>
<tr class="odd">
<td align="center">S. aureus</td>
<td align="center"><em>S. aureus</em></td>
<td align="center">GEN</td>
<td align="center">2407</td>
<td align="center">2440</td>
<td align="center">0</td>
<td align="center">290</td>
<td align="center">2697</td>
<td align="center">2730</td>
</tr>
<tr class="even">
<td align="center">S. pneumoniae</td>
<td align="center"><em>S. pneumoniae</em></td>
<td align="center">GEN</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">2145</td>
<td align="center">2145</td>
<td align="center">2093</td>
<td align="center">2093</td>
</tr>
</tbody>
</table>
@ -977,7 +977,7 @@ Longest: 24</p>
<p>As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to <code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to <code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span><span class="op">(</span><span class="va">AMX</span><span class="op">)</span>
<span class="co"># [1] 0.5418613</span></code></pre></div>
<span class="co"># [1] 0.5442005</span></code></pre></div>
<p>Or can be used in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span>
@ -991,19 +991,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5276730</td>
<td align="center">0.5512301</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5422819</td>
<td align="center">0.5383792</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5609308</td>
<td align="center">0.5587121</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5475970</td>
<td align="center">0.5329877</td>
</tr>
</tbody>
</table>
@ -1022,23 +1022,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5276730</td>
<td align="center">3180</td>
<td align="center">0.5512301</td>
<td align="center">3211</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5422819</td>
<td align="center">3725</td>
<td align="center">0.5383792</td>
<td align="center">3739</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5609308</td>
<td align="center">1633</td>
<td align="center">0.5587121</td>
<td align="center">1584</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5475970</td>
<td align="center">2164</td>
<td align="center">0.5329877</td>
<td align="center">2122</td>
</tr>
</tbody>
</table>
@ -1058,28 +1058,28 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.7661446</td>
<td align="center">0.8766359</td>
<td align="center">0.9759708</td>
<td align="center"><em>Escherichia</em></td>
<td align="center">0.7581475</td>
<td align="center">0.8743568</td>
<td align="center">0.9762007</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8106756</td>
<td align="center">0.8907423</td>
<td align="center">0.9833194</td>
<td align="center"><em>Klebsiella</em></td>
<td align="center">0.8323353</td>
<td align="center">0.8913601</td>
<td align="center">0.9760479</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.7942158</td>
<td align="center">0.8924731</td>
<td align="center">0.9818317</td>
<td align="center"><em>Staphylococcus</em></td>
<td align="center">0.7945055</td>
<td align="center">0.8937729</td>
<td align="center">0.9831502</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5501166</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">0.5351171</td>
<td align="center">0.0000000</td>
<td align="center">0.5501166</td>
<td align="center">0.5351171</td>
</tr>
</tbody>
</table>
@ -1104,23 +1104,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="left">Hospital A</td>
<td align="right">52.8%</td>
<td align="right">26.0%</td>
<td align="right">55.1%</td>
<td align="right">27.0%</td>
</tr>
<tr class="even">
<td align="left">Hospital B</td>
<td align="right">54.2%</td>
<td align="right">26.5%</td>
<td align="right">53.8%</td>
<td align="right">26.2%</td>
</tr>
<tr class="odd">
<td align="left">Hospital C</td>
<td align="right">56.1%</td>
<td align="right">26.7%</td>
<td align="right">55.9%</td>
<td align="right">27.7%</td>
</tr>
<tr class="even">
<td align="left">Hospital D</td>
<td align="right">54.8%</td>
<td align="right">27.1%</td>
<td align="right">53.3%</td>
<td align="right">27.0%</td>
</tr>
</tbody>
</table>
@ -1204,19 +1204,16 @@ Longest: 24</p>
<code class="sourceCode R"><span class="va">mic_values</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/random.html">random_mic</a></span><span class="op">(</span>size <span class="op">=</span> <span class="fl">100</span><span class="op">)</span>
<span class="va">mic_values</span>
<span class="co"># Class &lt;mic&gt;</span>
<span class="co"># [1] 32 2 4 &gt;=128 8 1 &lt;=0.0625 &gt;=128 </span>
<span class="co"># [9] &lt;=0.0625 &lt;=0.0625 64 2 0.125 8 &lt;=0.0625 0.125 </span>
<span class="co"># [17] 64 &gt;=128 &gt;=128 16 32 2 8 32 </span>
<span class="co"># [25] 0.5 0.5 16 8 &gt;=128 2 16 &gt;=128 </span>
<span class="co"># [33] 0.5 2 64 64 16 &lt;=0.0625 1 4 </span>
<span class="co"># [41] 0.125 16 &lt;=0.0625 0.125 0.25 0.125 8 4 </span>
<span class="co"># [49] &lt;=0.0625 32 1 &lt;=0.0625 1 0.5 0.5 64 </span>
<span class="co"># [57] 2 &lt;=0.0625 8 &lt;=0.0625 32 4 32 64 </span>
<span class="co"># [65] 0.125 0.5 4 0.125 0.5 4 8 8 </span>
<span class="co"># [73] 0.5 64 &gt;=128 32 0.25 32 4 4 </span>
<span class="co"># [81] 0.25 64 0.125 &lt;=0.0625 2 1 2 &lt;=0.0625</span>
<span class="co"># [89] 1 &gt;=128 0.125 2 64 16 1 64 </span>
<span class="co"># [97] 32 64 0.125 &lt;=0.0625</span></code></pre></div>
<span class="co"># [1] 1 16 8 0.5 64 0.125 4 2 0.25 16 </span>
<span class="co"># [11] 8 64 0.25 64 0.25 0.25 0.125 1 0.5 4 </span>
<span class="co"># [21] 64 0.0625 &gt;=128 0.5 0.5 &gt;=128 0.25 0.125 16 32 </span>
<span class="co"># [31] 16 0.0625 4 8 4 &gt;=128 4 0.25 0.0625 0.5 </span>
<span class="co"># [41] 2 0.125 0.25 1 16 2 0.125 1 2 2 </span>
<span class="co"># [51] 0.25 0.5 8 4 8 1 4 64 2 32 </span>
<span class="co"># [61] 0.5 2 1 8 8 32 64 4 2 32 </span>
<span class="co"># [71] &gt;=128 1 64 4 64 8 8 64 0.125 0.0625</span>
<span class="co"># [81] 8 &gt;=128 0.0625 0.0625 0.25 8 8 0.0625 32 0.25 </span>
<span class="co"># [91] 32 0.0625 0.125 1 &gt;=128 16 0.0625 8 0.0625 2</span></code></pre></div>
<div class="sourceCode" id="cb37"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># base R:</span>
<span class="fu"><a href="../reference/plot.html">plot</a></span><span class="op">(</span><span class="va">mic_values</span><span class="op">)</span></code></pre></div>
@ -1245,10 +1242,10 @@ Longest: 24</p>
<span class="co"># to review it.</span>
<span class="va">disk_values</span>
<span class="co"># Class &lt;disk&gt;</span>
<span class="co"># [1] 23 19 31 23 17 26 25 27 18 29 30 27 25 23 28 27 28 26 20 22 28 21 22 25 23</span>
<span class="co"># [26] 18 20 22 19 30 22 20 23 21 20 24 28 25 31 29 24 21 31 21 23 24 30 17 27 23</span>
<span class="co"># [51] 18 24 27 27 22 17 20 26 22 28 28 26 27 26 21 17 28 27 19 21 22 26 17 21 18</span>
<span class="co"># [76] 28 22 25 30 29 19 17 29 29 24 29 30 28 17 23 25 28 17 27 28 25 23 22 19 24</span></code></pre></div>
<span class="co"># [1] 25 19 26 17 25 27 22 17 29 29 27 28 21 18 26 29 21 27 24 17 18 19 23 19 21</span>
<span class="co"># [26] 18 23 21 27 29 18 25 24 17 31 18 22 25 30 19 29 26 27 22 22 28 21 23 22 20</span>
<span class="co"># [51] 30 19 23 21 30 17 19 22 18 25 29 28 25 31 20 23 20 22 27 24 21 21 24 19 31</span>
<span class="co"># [76] 19 18 27 20 27 21 25 26 29 27 29 21 27 27 25 20 22 25 26 29 19 19 23 19 20</span></code></pre></div>
<div class="sourceCode" id="cb43"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># base R:</span>
<span class="fu"><a href="../reference/plot.html">plot</a></span><span class="op">(</span><span class="va">disk_values</span>, mo <span class="op">=</span> <span class="st">"E. coli"</span>, ab <span class="op">=</span> <span class="st">"cipro"</span><span class="op">)</span></code></pre></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -39,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9018</span>
</span>
</div>
@ -192,7 +192,7 @@
<div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1>
<h4 class="date">04 July 2021</h4>
<h4 class="date">11 July 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small>
<div class="hidden name"><code>datasets.Rmd</code></div>

View File

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

View File

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

View File

@ -42,7 +42,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9018</span>
</span>
</div>
@ -382,17 +382,17 @@
<div id="latest-development-version" class="section level4">
<h4 class="hasAnchor">
<a href="#latest-development-version" class="anchor"></a>Latest development version</h4>
<p>[R-code-check][<a href="https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master" class="uri">https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master</a>](<a href="https://github.com/msberends/AMR/actions" class="uri">https://github.com/msberends/AMR/actions</a>) [CodeFactor][<a href="https://www.codefactor.io/repository/github/msberends/amr/badge" class="uri">https://www.codefactor.io/repository/github/msberends/amr/badge</a>](<a href="https://www.codefactor.io/repository/github/msberends/amr" class="uri">https://www.codefactor.io/repository/github/msberends/amr</a>) [Codecov][<a href="https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg" class="uri">https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg</a>](<a href="https://codecov.io/gh/msberends/AMR?branch=master" class="uri">https://codecov.io/gh/msberends/AMR?branch=master</a>)</p>
<p><a href="https://codecov.io/gh/msberends/AMR?branch=master"><img src="https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master" alt="R-code-check"></a> <a href="https://www.codefactor.io/repository/github/msberends/amr"><img src="https://www.codefactor.io/repository/github/msberends/amr/badge" alt="CodeFactor"></a> <a href="https://codecov.io/gh/msberends/AMR?branch=master"><img src="https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg" alt="Codecov"></a></p>
<p>The latest and unpublished development version can be installed from GitHub in two ways:</p>
<ol>
<li>
<p>Directly, using:</p>
<p>Manually, using:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span><span class="op">(</span><span class="st">"remotes"</span><span class="op">)</span> <span class="co"># if you haven't already</span>
<span class="fu">remotes</span><span class="fu">::</span><span class="fu"><a href="https://remotes.r-lib.org/reference/install_github.html">install_github</a></span><span class="op">(</span><span class="st">"msberends/AMR"</span><span class="op">)</span></code></pre></div>
</li>
<li>
<p>From the <a href="https://ropensci.org/r-universe/">rOpenSci R-universe platform</a>, by adding <a href="https://msberends.r-universe.dev">our R-universe address</a> to your list of repositories (repos):</p>
<p>Automatically, using the <a href="https://ropensci.org/r-universe/">rOpenSci R-universe platform</a>, by adding <a href="https://msberends.r-universe.dev">our R-universe address</a> to your list of repositories (repos):</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span>repos <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="fu"><a href="https://rdrr.io/r/base/options.html">getOption</a></span><span class="op">(</span><span class="st">"repos"</span><span class="op">)</span>,
msberends <span class="op">=</span> <span class="st">"https://msberends.r-universe.dev"</span><span class="op">)</span><span class="op">)</span></code></pre></div>
@ -405,7 +405,7 @@
<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 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>
<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 a link in the <a href="https://msberends.github.io/AMR/articles/">How to menu</a>.</p>
</div>
<div id="short-introduction" class="section level3">
<h3 class="hasAnchor">

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9018</span>
</span>
</div>
@ -236,12 +236,12 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1719013" class="section level1">
<h1 class="page-header" data-toc-text="1.7.1.9013">
<a href="#amr-1719013" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9013</h1>
<div id="last-updated-4-july-2021" class="section level2">
<div id="amr-1719018" class="section level1">
<h1 class="page-header" data-toc-text="1.7.1.9018">
<a href="#amr-1719018" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9018</h1>
<div id="last-updated-11-july-2021" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-4-july-2021" class="anchor"></a><small>Last updated: 4 July 2021</small>
<a href="#last-updated-11-july-2021" class="anchor"></a><small>Last updated: 11 July 2021</small>
</h2>
<div id="changed" class="section level3">
<h3 class="hasAnchor">
@ -249,10 +249,11 @@
<ul>
<li>Antibiotic class selectors (see <code><a href="../reference/antibiotic_class_selectors.html">ab_class()</a></code>)
<ul>
<li>They now finally also work in R-3.0 and R-3.1, supporting every version of R since 2013</li>
<li>They now also work in R-3.0 and R-3.1, supporting every version of R since 2013</li>
<li>Added more selectors: <code><a href="../reference/antibiotic_class_selectors.html">aminopenicillins()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">lincosamides()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">lipoglycopeptides()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">polymyxins()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">quinolones()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">streptogramins()</a></code> and <code><a href="../reference/antibiotic_class_selectors.html">ureidopenicillins()</a></code>
</li>
<li>Fix for using selectors multiple times in one call (e.g., using them in <code><a href="https://dplyr.tidyverse.org/reference/filter.html">dplyr::filter()</a></code> and immediately after in <code><a href="https://dplyr.tidyverse.org/reference/select.html">dplyr::select()</a></code>)</li>
<li>Added argument <code>only_treatable</code>, which defaults to <code>TRUE</code> and will exclude drugs that are only for laboratory tests and not for treating patients (such as imipenem/EDTA and gentamicin-high)</li>
</ul>
</li>
<li>Fix for duplicate ATC codes in the <code>antibiotics</code> data set</li>
@ -272,7 +273,8 @@
</li>
<li>
<code><a href="../reference/ab_property.html">ab_name()</a></code> gained argument <code>snake_case</code>, which is useful for column renaming</li>
<li>Fix for legends created with <code><a href="../reference/ggplot_rsi.html">scale_rsi_colours()</a></code> when using <code>ggplot2</code> v3.3.4 or higher (this is <code>ggplot2</code> bug <a href='https://github.com/msberends/AMR/issues/4511'>#4511</a>, soon to be fixed)</li>
<li>Fix for legends created with <code><a href="../reference/ggplot_rsi.html">scale_rsi_colours()</a></code> when using <code>ggplot2</code> v3.3.4 or higher (this is bug ggplot2<a href='https://github.com/msberends/AMR/issues/4511'>#4511</a>, soon to be fixed)</li>
<li>Fix for minor translation errors</li>
</ul>
</div>
</div>
@ -326,7 +328,7 @@
</ul>
</li>
<li>Function <code><a href="../reference/antibiotic_class_selectors.html">betalactams()</a></code> as additional antbiotic column selector and function <code><a href="../reference/AMR-deprecated.html">filter_betalactams()</a></code> as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.</li>
<li>A <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> method for <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>
<li>A <code>ggplot()</code> method for <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>
</li>
</ul>
</div>
@ -427,7 +429,7 @@
<span class="co">#&gt; Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"</span></code></pre></div>
</li>
<li><p>Support for custom MDRO guidelines, using the new <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code> function, please see <code><a href="../reference/mdro.html">mdro()</a></code> for additional info</p></li>
<li><p><code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> generics for classes <code>&lt;mic&gt;</code> and <code>&lt;disk&gt;</code></p></li>
<li><p><code>ggplot()</code> generics for classes <code>&lt;mic&gt;</code> and <code>&lt;disk&gt;</code></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="cb4"><pre class="downlit sourceCode r">
@ -484,7 +486,7 @@
<li>Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent</li>
<li>All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)</li>
<li>Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see <code>translate</code>)</li>
<li>Plotting is now possible with base R using <code><a href="../reference/plot.html">plot()</a></code> and with ggplot2 using <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> on any vector of MIC and disk diffusion values</li>
<li>Plotting is now possible with base R using <code><a href="../reference/plot.html">plot()</a></code> and with ggplot2 using <code>ggplot()</code> on any vector of MIC and disk diffusion values</li>
</ul>
</li>
<li>Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the <code>microorganisms</code> data set</li>
@ -836,7 +838,7 @@
<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>&lt;ord&gt;</code>, not <code>&lt;rsi&gt;</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>
@ -1168,7 +1170,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<span class="co">#&gt; 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>
@ -1435,7 +1437,7 @@ 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>
@ -1445,12 +1447,12 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
<code class="sourceCode R">
<span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</span>
<span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%&gt;%</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">%&gt;%</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">%&gt;%</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">%&gt;%</span>
<span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%&gt;%</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>
@ -1460,7 +1462,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>
@ -1699,7 +1701,7 @@ 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>
@ -1709,15 +1711,15 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<span class="co"># OLD WAY</span>
<span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</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">%&gt;%</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">%&gt;%</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">%&gt;%</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>
@ -1799,7 +1801,7 @@ 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>
@ -1807,14 +1809,14 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<code class="sourceCode R">
<span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</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="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="cb42"><pre class="downlit sourceCode r">
<code class="sourceCode R">
<span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</span>
<span class="fu">freq</span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="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>
@ -1832,7 +1834,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>
@ -1999,13 +2001,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<div class="sourceCode" id="cb49"><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>
<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="cb50"><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">%&gt;%</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">%&gt;%</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">%&gt;%</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">%&gt;%</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>
@ -2078,13 +2080,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 %&gt;% freq(mycolumn)</code>
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %&gt;% 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>

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2021-07-04T20:09Z
last_built: 2021-07-11T11:19Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles

View File

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

View File

@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9016</span>
</span>
</div>
@ -242,15 +242,15 @@
<p>These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.</p>
</div>
<pre class="usage"><span class='fu'>ab_class</span><span class='op'>(</span><span class='va'>ab_class</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<pre class="usage"><span class='fu'>ab_class</span><span class='op'>(</span><span class='va'>ab_class</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_treatable <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='fu'>aminoglycosides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>aminoglycosides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_treatable <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='fu'>aminopenicillins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>betalactams</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>betalactams</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_treatable <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='fu'>carbapenems</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>carbapenems</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_treatable <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='fu'>cephalosporins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
@ -278,7 +278,7 @@
<span class='fu'>penicillins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>polymyxins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
<span class='fu'>polymyxins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_treatable <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='fu'>streptogramins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
@ -299,6 +299,10 @@
<th>only_rsi_columns</th>
<td><p>a <a href='https://rdrr.io/r/base/logical.html'>logical</a> to indicate whether only columns of class <code>&lt;rsi&gt;</code> must be selected (defaults to <code>FALSE</code>), see <code><a href='as.rsi.html'>as.rsi()</a></code></p></td>
</tr>
<tr>
<th>only_treatable</th>
<td><p>a <a href='https://rdrr.io/r/base/logical.html'>logical</a> to indicate whether agents that are only for laboratory tests should be excluded (defaults to <code>TRUE</code>), such as gentamicin-high (<code>GEH</code>) and imipenem/EDTA (<code>IPE</code>)</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>

View File

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

View File

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

View File

@ -82,7 +82,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9015</span>
</span>
</div>
@ -335,7 +335,6 @@
<li><p>A <a href='https://rdrr.io/r/base/list.html'>list</a> in case of <code>mo_taxonomy()</code> and <code>mo_info()</code></p></li>
<li><p>A named <a href='https://rdrr.io/r/base/character.html'>character</a> in case of <code>mo_url()</code></p></li>
<li><p>A <a href='https://rdrr.io/r/base/numeric.html'>numeric</a> in case of <code>mo_snomed()</code></p></li>
<li><p>A <a href='https://rdrr.io/r/base/character.html'>character</a> with additional class <code>taxonomic_name</code> in case of <code>mo_family()</code>, <code>mo_genus()</code>, <code>mo_name()</code>, <code>mo_fullname()</code> and <code>mo_shortname()</code></p></li>
<li><p>A <a href='https://rdrr.io/r/base/character.html'>character</a> in all other cases</p></li>
</ul>
@ -352,7 +351,6 @@
<p>The Gram stain - <code>mo_gramstain()</code> - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, <a href='https://pubmed.ncbi.nlm.nih.gov/11837318'>PMID 11837318</a>), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value <code>NA</code>. Functions <code>mo_is_gram_negative()</code> and <code>mo_is_gram_positive()</code> always return <code>TRUE</code> or <code>FALSE</code> (except when the input is <code>NA</code> or the MO code is <code>UNKNOWN</code>), thus always return <code>FALSE</code> for species outside the taxonomic kingdom of Bacteria.</p>
<p>Determination of yeasts - <code>mo_is_yeast()</code> - will be based on the taxonomic kingdom and class. <em>Budding yeasts</em> are fungi of the phylum Ascomycetes, class Saccharomycetes (also called Hemiascomycetes). <em>True yeasts</em> are aggregated into the underlying order Saccharomycetales. Thus, for all microorganisms that are fungi and member of the taxonomic class Saccharomycetes, the function will return <code>TRUE</code>. It returns <code>FALSE</code> otherwise (except when the input is <code>NA</code> or the MO code is <code>UNKNOWN</code>).</p>
<p>Intrinsic resistance - <code>mo_is_intrinsic_resistant()</code> - will be determined based on the <a href='intrinsic_resistant.html'>intrinsic_resistant</a> data set, which 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). The <code>mo_is_intrinsic_resistant()</code> functions can be vectorised over arguments <code>x</code> (input for microorganisms) and over <code>ab</code> (input for antibiotics).</p>
<p>The functions <code>mo_family()</code>, <code>mo_genus()</code>, <code>mo_name()</code>, <code>mo_fullname()</code> and <code>mo_shortname()</code> are returned with an additional class <code>taxonomic_name</code>, which allows italic printing in <a href='https://tibble.tidyverse.org/reference/tibble.html'>tibbles</a>.</p>
<p>All output <a href='translate.html'>will be translated</a> where possible.</p>
<p>The function <code>mo_url()</code> will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.</p>
<p>SNOMED codes - <code>mo_snomed()</code> - are from the US Edition of SNOMED CT from 1 September 2020. See <em>Source</em> and the <a href='microorganisms.html'>microorganisms</a> data set for more info.</p>

View File

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

View File

@ -110,30 +110,33 @@ It will be downloaded and installed automatically. For RStudio, click on the men
#### Latest development version
![R-code-check][https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master](https://github.com/msberends/AMR/actions)
![CodeFactor][https://www.codefactor.io/repository/github/msberends/amr/badge](https://www.codefactor.io/repository/github/msberends/amr)
![Codecov][https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg](https://codecov.io/gh/msberends/AMR?branch=master)
[![R-code-check](https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=master)](https://codecov.io/gh/msberends/AMR?branch=master)
[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
[![Codecov](https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=master)
The latest and unpublished development version can be installed from GitHub in two ways:
1. Directly, using:
1. Manually, using:
```r
install.packages("remotes") # if you haven't already
remotes::install_github("msberends/AMR")
```
2. From the [rOpenSci R-universe platform](https://ropensci.org/r-universe/), by adding [our R-universe address](https://msberends.r-universe.dev) to your list of repositories ('repos'):
2. Automatically, using the [rOpenSci R-universe platform](https://ropensci.org/r-universe/), by adding [our R-universe address](https://msberends.r-universe.dev) to your list of repositories ('repos'):
```r
options(repos = c(getOption("repos"),
msberends = "https://msberends.r-universe.dev"))
```
After this, you can install and update this `AMR` package like any official release (e.g., using `install.packages("AMR")` or in RStudio via *Tools* > *Check for Package Updates...*).
You can also download the latest build from our repository: <https://github.com/msberends/AMR/raw/master/data-raw/AMR_latest.tar.gz>
### Get started
To find out how to conduct AMR data analysis, please [continue reading here to get started](./articles/AMR.html) or click the links in the 'How to' menu.
To find out how to conduct AMR data analysis, please [continue reading here to get started](./articles/AMR.html) or click a link in the ['How to' menu](https://msberends.github.io/AMR/articles/).
### Short introduction

View File

@ -25,7 +25,7 @@
expect_identical(ab_name("AMX", language = NULL), "Amoxicillin")
expect_identical(ab_name("AMX", language = NULL, snake_case = TRUE), "amoxicillin")
expect_identical(as.character(ab_atc("AMX")), "J01CA04")
expect_identical(ab_atc("AMX"), "J01CA04")
expect_identical(ab_cid("AMX"), as.integer(33613))
expect_inherits(ab_tradenames("AMX"), "character")

View File

@ -23,12 +23,10 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
expect_identical(as.character(mo_genus("B_GRAMP", language = "pt")),
"(Gram positivos desconhecidos)")
expect_identical(as.character(mo_fullname("CoNS", "en")), "Coagulase-negative Staphylococcus (CoNS)")
expect_identical(as.character(mo_fullname("CoNS", "de")), "Koagulase-negative Staphylococcus (KNS)")
expect_identical(as.character(mo_fullname("CoNS", "nl")), "Coagulase-negatieve Staphylococcus (CNS)")
expect_identical(as.character(mo_fullname("CoNS", "es")), "Staphylococcus coagulasa negativo (SCN)")
expect_identical(as.character(mo_fullname("CoNS", "it")), "Staphylococcus negativo coagulasi (CoNS)")
expect_identical(as.character(mo_fullname("CoNS", "pt")), "Staphylococcus coagulase negativo (CoNS)")
expect_identical(mo_genus("B_GRAMP", language = "pt"), "(Gram positivos desconhecidos)")
expect_identical(mo_fullname("CoNS", "en"), "Coagulase-negative Staphylococcus (CoNS)")
expect_identical(mo_fullname("CoNS", "de"), "Koagulase-negative Staphylococcus (KNS)")
expect_identical(mo_fullname("CoNS", "nl"), "Coagulase-negatieve Staphylococcus (CNS)")
expect_identical(mo_fullname("CoNS", "es"), "Staphylococcus coagulasa negativo (SCN)")
expect_identical(mo_fullname("CoNS", "it"), "Staphylococcus negativo coagulasi (CoNS)")
expect_identical(mo_fullname("CoNS", "pt"), "Staphylococcus coagulase negativo (CoNS)")

View File

@ -28,20 +28,17 @@ expect_equal(mo_kingdom("Escherichia coli"), mo_domain("Escherichia coli"))
expect_equal(mo_phylum("Escherichia coli"), "Proteobacteria")
expect_equal(mo_class("Escherichia coli"), "Gammaproteobacteria")
expect_equal(mo_order("Escherichia coli"), "Enterobacterales")
# S3 class for taxonomic names
expect_inherits(mo_family("Escherichia coli"), "taxonomic_name")
expect_equal(as.character(mo_family("Escherichia coli")), "Enterobacteriaceae")
expect_equal(as.character(mo_fullname("Escherichia coli")), "Escherichia coli")
expect_equal(as.character(mo_genus("Escherichia coli")), "Escherichia")
expect_equal(as.character(mo_name("Escherichia coli")), "Escherichia coli")
expect_equal(as.character(mo_shortname("Escherichia coli")), "E. coli")
expect_equal(as.character(mo_shortname("Escherichia")), "Escherichia")
expect_equal(as.character(mo_shortname("Staphylococcus aureus")), "S. aureus")
expect_equal(as.character(mo_shortname("Staphylococcus aureus", Becker = TRUE)), "S. aureus")
expect_equal(as.character(mo_shortname("Staphylococcus aureus", Becker = "all", language = "en")), "CoPS")
expect_equal(as.character(mo_shortname("Streptococcus agalactiae")), "S. agalactiae")
expect_equal(as.character(mo_shortname("Streptococcus agalactiae", Lancefield = TRUE)), "GBS")
expect_equal(mo_family("Escherichia coli"), "Enterobacteriaceae")
expect_equal(mo_fullname("Escherichia coli"), "Escherichia coli")
expect_equal(mo_genus("Escherichia coli"), "Escherichia")
expect_equal(mo_name("Escherichia coli"), "Escherichia coli")
expect_equal(mo_shortname("Escherichia coli"), "E. coli")
expect_equal(mo_shortname("Escherichia"), "Escherichia")
expect_equal(mo_shortname("Staphylococcus aureus"), "S. aureus")
expect_equal(mo_shortname("Staphylococcus aureus", Becker = TRUE), "S. aureus")
expect_equal(mo_shortname("Staphylococcus aureus", Becker = "all", language = "en"), "CoPS")
expect_equal(mo_shortname("Streptococcus agalactiae"), "S. agalactiae")
expect_equal(mo_shortname("Streptococcus agalactiae", Lancefield = TRUE), "GBS")
expect_equal(mo_species("Escherichia coli"), "coli")
expect_equal(mo_subspecies("Escherichia coli"), "")
@ -68,7 +65,7 @@ expect_true(mo_url("Escherichia coli") %like% "lpsn.dsmz.de")
# test integrity
MOs <- microorganisms
expect_identical(MOs$fullname, as.character(mo_fullname(MOs$fullname, language = "en")))
expect_identical(MOs$fullname, mo_fullname(MOs$fullname, language = "en"))
# check languages
expect_equal(mo_type("Escherichia coli", language = "de"), "Bakterien")
@ -84,7 +81,7 @@ expect_stdout(print(mo_gramstain("Escherichia coli", language = "fr")))
expect_error(mo_gramstain("Escherichia coli", language = "UNKNOWN"))
dutch <- mo_name(microorganisms$fullname, language = "nl") # should be transformable to English again
expect_identical(as.character(mo_name(dutch, language = NULL)), microorganisms$fullname) # gigantic test - will run ALL names
expect_identical(mo_name(dutch, language = NULL), microorganisms$fullname) # gigantic test - will run ALL names
# manual property function
expect_error(mo_property("Escherichia coli", property = c("tsn", "fullname")))
@ -120,7 +117,7 @@ expect_equal(mo_is_intrinsic_resistant(c("Escherichia coli", "Staphylococcus aur
"vanco"),
c(TRUE, FALSE, FALSE))
# with reference data
expect_equal(as.character(mo_name("test", reference_df = data.frame(col1 = "test", mo = "B_ESCHR_COLI"))),
expect_equal(mo_name("test", reference_df = data.frame(col1 = "test", mo = "B_ESCHR_COLI")),
"Escherichia coli")
if (AMR:::pkg_is_available("dplyr")) {
expect_equal(example_isolates %>% filter(mo_is_gram_negative()) %>% nrow(),

View File

@ -27,15 +27,15 @@
\alias{ureidopenicillins}
\title{Antibiotic Class Selectors}
\usage{
ab_class(ab_class, only_rsi_columns = FALSE)
ab_class(ab_class, only_rsi_columns = FALSE, only_treatable = TRUE)
aminoglycosides(only_rsi_columns = FALSE)
aminoglycosides(only_rsi_columns = FALSE, only_treatable = TRUE)
aminopenicillins(only_rsi_columns = FALSE)
betalactams(only_rsi_columns = FALSE)
betalactams(only_rsi_columns = FALSE, only_treatable = TRUE)
carbapenems(only_rsi_columns = FALSE)
carbapenems(only_rsi_columns = FALSE, only_treatable = TRUE)
cephalosporins(only_rsi_columns = FALSE)
@ -63,7 +63,7 @@ oxazolidinones(only_rsi_columns = FALSE)
penicillins(only_rsi_columns = FALSE)
polymyxins(only_rsi_columns = FALSE)
polymyxins(only_rsi_columns = FALSE, only_treatable = TRUE)
streptogramins(only_rsi_columns = FALSE)
@ -77,6 +77,8 @@ ureidopenicillins(only_rsi_columns = FALSE)
\item{ab_class}{an antimicrobial class, such as \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antibiotics} data set will be searched (case-insensitive) for this value.}
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns of class \verb{<rsi>} must be selected (defaults to \code{FALSE}), see \code{\link[=as.rsi]{as.rsi()}}}
\item{only_treatable}{a \link{logical} to indicate whether agents that are only for laboratory tests should be excluded (defaults to \code{TRUE}), such as gentamicin-high (\code{GEH}) and imipenem/EDTA (\code{IPE})}
}
\description{
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.

View File

@ -106,7 +106,6 @@ mo_property(x, property = "fullname", language = get_locale(), ...)
\item A \link{list} in case of \code{\link[=mo_taxonomy]{mo_taxonomy()}} and \code{\link[=mo_info]{mo_info()}}
\item A named \link{character} in case of \code{\link[=mo_url]{mo_url()}}
\item A \link{numeric} in case of \code{\link[=mo_snomed]{mo_snomed()}}
\item A \link{character} with additional class \code{taxonomic_name} in case of \code{\link[=mo_family]{mo_family()}}, \code{\link[=mo_genus]{mo_genus()}}, \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_fullname]{mo_fullname()}} and \code{\link[=mo_shortname]{mo_shortname()}}
\item A \link{character} in all other cases
}
}
@ -131,8 +130,6 @@ Determination of yeasts - \code{\link[=mo_is_yeast]{mo_is_yeast()}} - will be ba
Intrinsic resistance - \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} - will be determined based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/expert_rules_and_intrinsic_resistance/}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2} (2020). The \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} functions can be vectorised over arguments \code{x} (input for microorganisms) and over \code{ab} (input for antibiotics).
The functions \code{\link[=mo_family]{mo_family()}}, \code{\link[=mo_genus]{mo_genus()}}, \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_fullname]{mo_fullname()}} and \code{\link[=mo_shortname]{mo_shortname()}} are returned with an additional class \code{taxonomic_name}, which allows italic printing in \link[tibble:tibble]{tibbles}.
All output \link[=translate]{will be translated} where possible.
The function \code{\link[=mo_url]{mo_url()}} will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.