mirror of https://github.com/msberends/AMR.git
fixes
This commit is contained in:
parent
9e99e66f01
commit
f7dd890b79
|
@ -1,5 +1,5 @@
|
|||
Package: AMR
|
||||
Version: 1.8.2.9106
|
||||
Version: 1.8.2.9107
|
||||
Date: 2023-02-06
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
|
2
NEWS.md
2
NEWS.md
|
@ -1,4 +1,4 @@
|
|||
# AMR 1.8.2.9106
|
||||
# AMR 1.8.2.9107
|
||||
|
||||
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*
|
||||
|
||||
|
|
|
@ -94,7 +94,9 @@ TAXONOMY_VERSION <- list(
|
|||
)
|
||||
|
||||
globalVariables(c(
|
||||
".mo",
|
||||
".rowid",
|
||||
".syndromic_group",
|
||||
"ab",
|
||||
"ab_txt",
|
||||
"affect_ab_name",
|
||||
|
@ -105,8 +107,9 @@ globalVariables(c(
|
|||
"atc_group1",
|
||||
"atc_group2",
|
||||
"base_ab",
|
||||
"ci_min",
|
||||
"ci_max",
|
||||
"ci_min",
|
||||
"clinical_breakpoints",
|
||||
"code",
|
||||
"cols",
|
||||
"count",
|
||||
|
@ -130,14 +133,15 @@ globalVariables(c(
|
|||
"language",
|
||||
"lookup",
|
||||
"method",
|
||||
"mic",
|
||||
"mic ",
|
||||
"mic",
|
||||
"microorganism",
|
||||
"microorganisms",
|
||||
"microorganisms.codes",
|
||||
"mo",
|
||||
"name",
|
||||
"new",
|
||||
"numerator",
|
||||
"observations",
|
||||
"old",
|
||||
"old_name",
|
||||
|
@ -149,13 +153,15 @@ globalVariables(c(
|
|||
"reference.rule_group",
|
||||
"reference.version",
|
||||
"rowid",
|
||||
"sir",
|
||||
"clinical_breakpoints",
|
||||
"rule_group",
|
||||
"rule_name",
|
||||
"S",
|
||||
"se_max",
|
||||
"se_min",
|
||||
"SI",
|
||||
"sir",
|
||||
"species",
|
||||
"syndromic_group",
|
||||
"total",
|
||||
"txt",
|
||||
"type",
|
||||
|
|
|
@ -363,7 +363,7 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
|
|||
|
||||
if (is.data.frame(data)) {
|
||||
if (tryCatch(length(list(...)) > 0, error = function(e) TRUE)) {
|
||||
out <- tryCatch(suppressWarnings(c(...)), error = function(e) NULL)
|
||||
out <- tryCatch(suppressWarnings(unlist(list(...))), error = function(e) NULL)
|
||||
if (!is.null(out)) {
|
||||
df <- data[, out, drop = FALSE]
|
||||
} else {
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#' @param minimum the minimum allowed number of available (tested) isolates. Any isolate count lower than `minimum` will return `NA` with a warning. The default number of `30` isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see *Source*.
|
||||
#' @param combine_SI a [logical] to indicate whether all susceptibility should be determined by results of either S or I, instead of only S (defaults to `TRUE`)
|
||||
#' @param sep a separating character for antibiotic columns in combination antibiograms
|
||||
#' @param object an [antibiogram()] object
|
||||
#' @param ... method extensions
|
||||
#' @details This function returns a table with values between 0 and 100 for *susceptibility*, not resistance.
|
||||
#'
|
||||
#' **Remember that you should filter your data to let it contain only first isolates!** This is needed to exclude duplicates and to reduce selection bias. Use [first_isolate()] to determine them in your data set with one of the four available algorithms.
|
||||
|
@ -314,7 +316,7 @@ antibiogram <- function(x,
|
|||
if (identical(select, import_fn("select", "dplyr", error_on_fail = FALSE))) {
|
||||
antibiotics <- suppressWarnings(x %>% select({{ antibiotics }}) %>% colnames())
|
||||
} else {
|
||||
antibiotics <- x %>% select(antibiotics) %>% colnames()
|
||||
antibiotics <- colnames(x[, antibiotics, drop = FALSE])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,9 +449,9 @@ plot.antibiogram <- function(x, ...) {
|
|||
df <- df[order(df$mo), , drop = FALSE]
|
||||
}
|
||||
mo_levels = unique(df$mo)
|
||||
mfrow_old <- par()$mfrow
|
||||
mfrow_old <- graphics::par()$mfrow
|
||||
sqrt_levels <- sqrt(length(mo_levels))
|
||||
par(mfrow = c(ceiling(sqrt_levels), floor(sqrt_levels)))
|
||||
graphics::par(mfrow = c(ceiling(sqrt_levels), floor(sqrt_levels)))
|
||||
for (i in seq_along(mo_levels)) {
|
||||
mo <- mo_levels[i]
|
||||
df_sub <- df[df$mo == mo, , drop = FALSE]
|
||||
|
@ -463,12 +465,14 @@ plot.antibiogram <- function(x, ...) {
|
|||
main = mo,
|
||||
legend = NULL)
|
||||
}
|
||||
par(mfrow = mfrow_old)
|
||||
graphics::par(mfrow = mfrow_old)
|
||||
}
|
||||
|
||||
#' @export
|
||||
#' @noRd
|
||||
barplot.antibiogram <- plot.antibiogram
|
||||
barplot.antibiogram <- function(height, ...) {
|
||||
plot(height, ...)
|
||||
}
|
||||
|
||||
#' @method autoplot antibiogram
|
||||
#' @rdname antibiogram
|
||||
|
|
|
@ -63,6 +63,10 @@ antibiogram(
|
|||
|
||||
\item{sep}{a separating character for antibiotic columns in combination antibiograms}
|
||||
|
||||
\item{...}{method extensions}
|
||||
|
||||
\item{object}{an \code{\link[=antibiogram]{antibiogram()}} object}
|
||||
|
||||
\item{as_kable}{a \link{logical} to indicate whether the printing should be done using \code{\link[knitr:kable]{knitr::kable()}} (which is the default in non-interactive sessions)}
|
||||
}
|
||||
\description{
|
||||
|
|
Loading…
Reference in New Issue