mirror of
https://github.com/msberends/AMR.git
synced 2025-07-12 05:42:18 +02:00
(v1.5.0.9008) Internal data sets to pkg, speed for auto col determination
This commit is contained in:
@ -87,15 +87,15 @@ The \code{\link[=as.rsi]{as.rsi()}} function works in four ways:
|
||||
\item For \strong{cleaning raw / untransformed data}. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with R/SI interpretations and MIC values such as \code{"<0.25; S"} will be coerced to \code{"S"}. Combined interpretations for multiple test methods (as seen in laboratory records) such as \code{"S; S"} will be coerced to \code{"S"}, but a value like \code{"S; I"} will return \code{NA} with a warning that the input is unclear.
|
||||
\item For \strong{interpreting minimum inhibitory concentration (MIC) values} according to EUCAST or CLSI. You must clean your MIC values first using \code{\link[=as.mic]{as.mic()}}, that also gives your columns the new data class \code{\link{mic}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
||||
\itemize{
|
||||
\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:\preformatted{your_data \%>\% mutate_if(is.mic, as.rsi) # until dplyr 1.0.0
|
||||
your_data \%>\% mutate(across(where(is.mic), as.rsi)) # since dplyr 1.0.0
|
||||
\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:\preformatted{your_data \%>\% mutate_if(is.mic, as.rsi) # until dplyr 1.0.0
|
||||
your_data \%>\% mutate(across((is.mic), as.rsi)) # since dplyr 1.0.0
|
||||
}
|
||||
\item Operators like "<=" will be stripped before interpretation. When using \code{conserve_capped_values = TRUE}, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (\code{conserve_capped_values = FALSE}) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
||||
}
|
||||
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
||||
\itemize{
|
||||
\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:\preformatted{your_data \%>\% mutate_if(is.disk, as.rsi) # until dplyr 1.0.0
|
||||
your_data \%>\% mutate(across(where(is.disk), as.rsi)) # since dplyr 1.0.0
|
||||
\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:\preformatted{your_data \%>\% mutate_if(is.disk, as.rsi) # until dplyr 1.0.0
|
||||
your_data \%>\% mutate(across((is.disk), as.rsi)) # since dplyr 1.0.0
|
||||
}
|
||||
}
|
||||
\item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.rsi(data)}.
|
||||
@ -193,7 +193,7 @@ as.rsi(x = as.disk(18),
|
||||
if (require("dplyr")) {
|
||||
df \%>\% mutate_if(is.mic, as.rsi)
|
||||
df \%>\% mutate_if(function(x) is.mic(x) | is.disk(x), as.rsi)
|
||||
df \%>\% mutate(across(where(is.mic), as.rsi))
|
||||
df \%>\% mutate(across((is.mic), as.rsi))
|
||||
df \%>\% mutate_at(vars(AMP:TOB), as.rsi)
|
||||
df \%>\% mutate(across(AMP:TOB, as.rsi))
|
||||
|
||||
@ -238,7 +238,7 @@ if (require("dplyr")) {
|
||||
|
||||
# note: from dplyr 1.0.0 on, this will be:
|
||||
# example_isolates \%>\%
|
||||
# mutate(across(where(is.rsi.eligible), as.rsi))
|
||||
# mutate(across((is.rsi.eligible), as.rsi))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,12 @@
|
||||
% Please edit documentation in R/isolate_identifier.R
|
||||
\name{isolate_identifier}
|
||||
\alias{isolate_identifier}
|
||||
\alias{all.equal.isolate_identifier}
|
||||
\title{Create Identifier of an Isolate}
|
||||
\usage{
|
||||
isolate_identifier(x, col_mo = NULL, cols_ab = NULL)
|
||||
|
||||
\method{all.equal}{isolate_identifier}(target, current, ignore_empty_results = TRUE, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{data with antibiotic columns, such as \code{amox}, \code{AMX} and \code{AMC}}
|
||||
@ -12,14 +15,16 @@ isolate_identifier(x, col_mo = NULL, cols_ab = NULL)
|
||||
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||
|
||||
\item{cols_ab}{a character vector of column names of \code{x}, or (a combination with) an \href{[ab_class()]}{antibiotic selector function}, such as \code{\link[=carbapenems]{carbapenems()}} and \code{\link[=aminoglycosides]{aminoglycosides()}}}
|
||||
|
||||
\item{...}{column name of an antibiotic, see section \emph{Antibiotics} below}
|
||||
}
|
||||
\description{
|
||||
This function will paste the microorganism code with all antimicrobial results into one string for each row in a data set. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.
|
||||
}
|
||||
\section{Maturing Lifecycle}{
|
||||
\section{Experimental Lifecycle}{
|
||||
|
||||
\if{html}{\figure{lifecycle_maturing.svg}{options: style=margin-bottom:5px} \cr}
|
||||
The \link[=lifecycle]{lifecycle} of this function is \strong{maturing}. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome \href{https://github.com/msberends/AMR/issues}{to suggest changes at our repository} or \link[=AMR]{write us an email (see section 'Contact Us')}.
|
||||
\if{html}{\figure{lifecycle_experimental.svg}{options: style=margin-bottom:5px} \cr}
|
||||
The \link[=lifecycle]{lifecycle} of this function is \strong{experimental}. An experimental function is in early stages of development. The unlying code might be changing frequently. Experimental functions might be removed without deprecation, so you are generally best off waiting until a function is more mature before you use it in production code. Experimental functions are only available in development versions of this \code{AMR} package and will thus not be included in releases that are submitted to CRAN, since such functions have not yet matured enough.
|
||||
}
|
||||
|
||||
\section{Read more on Our Website!}{
|
||||
|
Reference in New Issue
Block a user