1
0
mirror of https://github.com/msberends/AMR.git synced 2025-01-16 12:01:49 +01:00

Compare commits

..

No commits in common. "faca6d608a1b6f0c1846072aeaebd033bf473856" and "4bebba361022ec46e07ef47eb8d0895fc121fac4" have entirely different histories.

5 changed files with 17 additions and 17 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 1.8.2.9029 Version: 1.8.2.9027
Date: 2022-10-21 Date: 2022-10-21
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -189,7 +189,6 @@ export(age_groups)
export(all_antimicrobials) export(all_antimicrobials)
export(aminoglycosides) export(aminoglycosides)
export(aminopenicillins) export(aminopenicillins)
export(amr_distance_from_row)
export(anti_join_microorganisms) export(anti_join_microorganisms)
export(antifungals) export(antifungals)
export(antimicrobials_equal) export(antimicrobials_equal)
@ -226,6 +225,7 @@ export(count_resistant)
export(count_susceptible) export(count_susceptible)
export(custom_eucast_rules) export(custom_eucast_rules)
export(custom_mdro_guideline) export(custom_mdro_guideline)
export(distance_from_row)
export(eucast_dosage) export(eucast_dosage)
export(eucast_exceptional_phenotypes) export(eucast_exceptional_phenotypes)
export(eucast_rules) export(eucast_rules)

View File

@ -1,4 +1,4 @@
# AMR 1.8.2.9029 # AMR 1.8.2.9027
This version will eventually become v2.0! We're happy to reach a new major milestone soon! This version will eventually become v2.0! We're happy to reach a new major milestone soon!
@ -27,7 +27,7 @@ This version will eventually become v2.0! We're happy to reach a new major miles
* Support for the following languages: Chinese, Greek, Japanese, Polish, Turkish and Ukrainian. We are very grateful for the valuable input by our colleagues from other countries. The `AMR` package is now available in 16 languages. The automatic language determination will give a note at start-up on systems in supported languages. * Support for the following languages: Chinese, Greek, Japanese, Polish, Turkish and Ukrainian. We are very grateful for the valuable input by our colleagues from other countries. The `AMR` package is now available in 16 languages. The automatic language determination will give a note at start-up on systems in supported languages.
* Our data sets are now also continually exported to Apache Feather and Apache Parquet formats. You can find more info [in this article on our website](https://msberends.github.io/AMR/articles/datasets.html). * Our data sets are now also continually exported to Apache Feather and Apache Parquet formats. You can find more info [in this article on our website](https://msberends.github.io/AMR/articles/datasets.html).
* Added confidence intervals in AMR calculation. This is now included in `rsi_df()` and `proportion_df()` and manually available as `rsi_confidence_interval()` * Added confidence intervals in AMR calculation. This is now included in `rsi_df()` and `proportion_df()` and manually available as `rsi_confidence_interval()`
* Support for using antibiotic selectors in scoped `dplyr` verbs (with or without `vars()`), such as in: `... %>% summarise_at(aminoglycosides(), resistance)`, see `resistance()` * Support for using antibiotic selectors in scoped `dplyr` verbs (worh or without `vars()`), such as in: `... %>% summarise_at(aminoglycosides(), resistance)`
### Changed ### Changed
* Fix for using `as.rsi()` on certain EUCAST breakpoints for MIC values * Fix for using `as.rsi()` on certain EUCAST breakpoints for MIC values

View File

@ -41,7 +41,7 @@
#' #'
#' For data sets, the mean AMR distance will be calculated per variable, after which the mean of all columns will returned per row (using [rowMeans()]), see *Examples*. #' For data sets, the mean AMR distance will be calculated per variable, after which the mean of all columns will returned per row (using [rowMeans()]), see *Examples*.
#' #'
#' Use [amr_distance_from_row()] to subtract distances from the distance of one row, see *Examples*. #' Use [distance_from_row()] to subtract distances from the distance of one row, see *Examples*.
#' @section Interpretation: #' @section Interpretation:
#' Isolates with distances less than 0.01 difference from each other should be considered similar. Differences lower than 0.025 should be considered suspicious. #' Isolates with distances less than 0.01 difference from each other should be considered similar. Differences lower than 0.025 should be considered suspicious.
#' @export #' @export
@ -66,7 +66,7 @@
#' y %>% #' y %>%
#' mutate( #' mutate(
#' amr_distance = mean_amr_distance(., where(is.mic)), #' amr_distance = mean_amr_distance(., where(is.mic)),
#' check_id_C = amr_distance_from_row(amr_distance, id == "C") #' check_id_C = distance_from_row(amr_distance, id == "C")
#' ) %>% #' ) %>%
#' arrange(check_id_C) #' arrange(check_id_C)
#' } #' }
@ -104,7 +104,7 @@ mean_amr_distance.disk <- function(x, ...) {
#' @rdname mean_amr_distance #' @rdname mean_amr_distance
#' @export #' @export
mean_amr_distance.rsi <- function(x, ..., combine_SI = TRUE) { mean_amr_distance.rsi <- function(x, combine_SI = TRUE, ...) {
meet_criteria(combine_SI, allow_class = "logical", has_length = 1, .call_depth = -1) meet_criteria(combine_SI, allow_class = "logical", has_length = 1, .call_depth = -1)
if (isTRUE(combine_SI)) { if (isTRUE(combine_SI)) {
x[x == "I"] <- "S" x[x == "I"] <- "S"
@ -154,14 +154,14 @@ mean_amr_distance.data.frame <- function(x, ..., combine_SI = TRUE) {
} }
#' @rdname mean_amr_distance #' @rdname mean_amr_distance
#' @param amr_distance the outcome of [mean_amr_distance()] #' @param mean_distance the outcome of [mean_amr_distance()]
#' @param row an index, such as a row number #' @param row an index, such as a row number
#' @export #' @export
amr_distance_from_row <- function(amr_distance, row) { distance_from_row <- function(mean_distance, row) {
meet_criteria(amr_distance, allow_class = c("double", "numeric"), is_finite = TRUE) meet_criteria(mean_distance, allow_class = c("double", "numeric"), is_finite = TRUE)
meet_criteria(row, allow_class = c("logical", "double", "numeric")) meet_criteria(row, allow_class = c("logical", "double", "numeric"))
if (is.logical(row)) { if (is.logical(row)) {
row <- which(row) row <- which(row)
} }
abs(amr_distance[row] - amr_distance) abs(mean_distance[row] - mean_distance)
} }

View File

@ -7,7 +7,7 @@
\alias{mean_amr_distance.disk} \alias{mean_amr_distance.disk}
\alias{mean_amr_distance.rsi} \alias{mean_amr_distance.rsi}
\alias{mean_amr_distance.data.frame} \alias{mean_amr_distance.data.frame}
\alias{amr_distance_from_row} \alias{distance_from_row}
\title{Mean AMR Distance} \title{Mean AMR Distance}
\usage{ \usage{
mean_amr_distance(x, ...) mean_amr_distance(x, ...)
@ -18,11 +18,11 @@ mean_amr_distance(x, ...)
\method{mean_amr_distance}{disk}(x, ...) \method{mean_amr_distance}{disk}(x, ...)
\method{mean_amr_distance}{rsi}(x, ..., combine_SI = TRUE) \method{mean_amr_distance}{rsi}(x, combine_SI = TRUE, ...)
\method{mean_amr_distance}{data.frame}(x, ..., combine_SI = TRUE) \method{mean_amr_distance}{data.frame}(x, ..., combine_SI = TRUE)
amr_distance_from_row(amr_distance, row) distance_from_row(mean_distance, row)
} }
\arguments{ \arguments{
\item{x}{a vector of class \link[=as.rsi]{rsi}, \link[=as.rsi]{rsi} or \link[=as.rsi]{rsi}, or a \link{data.frame} containing columns of any of these classes} \item{x}{a vector of class \link[=as.rsi]{rsi}, \link[=as.rsi]{rsi} or \link[=as.rsi]{rsi}, or a \link{data.frame} containing columns of any of these classes}
@ -31,7 +31,7 @@ amr_distance_from_row(amr_distance, row)
\item{combine_SI}{a \link{logical} to indicate whether all values of S and I must be merged into one, so the input only consists of S+I vs. R (susceptible vs. resistant), defaults to \code{TRUE}} \item{combine_SI}{a \link{logical} to indicate whether all values of S and I must be merged into one, so the input only consists of S+I vs. R (susceptible vs. resistant), defaults to \code{TRUE}}
\item{amr_distance}{the outcome of \code{\link[=mean_amr_distance]{mean_amr_distance()}}} \item{mean_distance}{the outcome of \code{\link[=mean_amr_distance]{mean_amr_distance()}}}
\item{row}{an index, such as a row number} \item{row}{an index, such as a row number}
} }
@ -47,7 +47,7 @@ R/SI values (see \code{\link[=as.rsi]{as.rsi()}}) are transformed using \code{"S
For data sets, the mean AMR distance will be calculated per variable, after which the mean of all columns will returned per row (using \code{\link[=rowMeans]{rowMeans()}}), see \emph{Examples}. For data sets, the mean AMR distance will be calculated per variable, after which the mean of all columns will returned per row (using \code{\link[=rowMeans]{rowMeans()}}), see \emph{Examples}.
Use \code{\link[=amr_distance_from_row]{amr_distance_from_row()}} to subtract distances from the distance of one row, see \emph{Examples}. Use \code{\link[=distance_from_row]{distance_from_row()}} to subtract distances from the distance of one row, see \emph{Examples}.
} }
\section{Interpretation}{ \section{Interpretation}{
@ -75,7 +75,7 @@ if (require("dplyr")) {
y \%>\% y \%>\%
mutate( mutate(
amr_distance = mean_amr_distance(., where(is.mic)), amr_distance = mean_amr_distance(., where(is.mic)),
check_id_C = amr_distance_from_row(amr_distance, id == "C") check_id_C = distance_from_row(amr_distance, id == "C")
) \%>\% ) \%>\%
arrange(check_id_C) arrange(check_id_C)
} }