mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 20:21:55 +02:00
remove warnings from unit tests
This commit is contained in:
@ -102,7 +102,7 @@ not_intrinsic_resistant(
|
||||
\arguments{
|
||||
\item{ab_class}{an antimicrobial class or a part of it, such as \code{"carba"} and \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_rsi_columns}{a \link{logical} to indicate whether only columns of class \code{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})}
|
||||
|
||||
|
@ -89,12 +89,13 @@ ab_atc("seephthriaaksone") # and even this works
|
||||
# they use as.ab() internally:
|
||||
ab_name("J01FA01") # "Erythromycin"
|
||||
ab_name("eryt") # "Erythromycin"
|
||||
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
|
||||
# you can quickly rename <rsi> columns using dplyr >= 1.0.0:
|
||||
# you can quickly rename 'rsi' columns using set_ab_names() with dplyr:
|
||||
example_isolates \%>\%
|
||||
rename_with(as.ab, where(is.rsi))
|
||||
set_ab_names(where(is.rsi), property = "atc")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ This transforms a vector to a new class \code{\link{disk}}, which is a disk diff
|
||||
\details{
|
||||
Interpret disk values as RSI values with \code{\link[=as.rsi]{as.rsi()}}. It supports guidelines from EUCAST and CLSI.
|
||||
|
||||
\code{NA_disk_} is a missing value of the new \verb{<disk>} class.
|
||||
\code{NA_disk_} is a missing value of the new \code{disk} class.
|
||||
}
|
||||
\examples{
|
||||
# transform existing disk zones to the `disk` class (using base R)
|
||||
|
@ -22,7 +22,7 @@ is.mic(x)
|
||||
|
||||
\item{na.rm}{a \link{logical} indicating whether missing values should be removed}
|
||||
|
||||
\item{as.mic}{a \link{logical} to indicate whether the \verb{<mic>} class should be kept, defaults to \code{FALSE}}
|
||||
\item{as.mic}{a \link{logical} to indicate whether the \code{mic} class should be kept, defaults to \code{FALSE}}
|
||||
|
||||
\item{...}{arguments passed on to methods}
|
||||
}
|
||||
@ -39,7 +39,7 @@ This class for MIC values is a quite a special data type: formally it is an orde
|
||||
|
||||
\if{html}{\out{<div class="sourceCode">}}\preformatted{x <- random_mic(10)
|
||||
x
|
||||
#> Class <mic>
|
||||
#> Class 'mic'
|
||||
#> [1] 16 1 8 8 64 >=128 0.0625 32 32 16
|
||||
|
||||
is.factor(x)
|
||||
@ -55,7 +55,7 @@ median(x)
|
||||
This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using \link{numeric} values in data analysis, e.g.:
|
||||
|
||||
\if{html}{\out{<div class="sourceCode">}}\preformatted{x[x > 4]
|
||||
#> Class <mic>
|
||||
#> Class 'mic'
|
||||
#> [1] 16 8 8 64 >=128 32 32 16
|
||||
|
||||
df <- data.frame(x, hospital = "A")
|
||||
@ -73,9 +73,9 @@ The following \link[=groupGeneric]{generic functions} are implemented for the MI
|
||||
|
||||
Using \code{\link[=as.double]{as.double()}} or \code{\link[=as.numeric]{as.numeric()}} on MIC values will remove the operators and return a numeric vector. Do \strong{not} use \code{\link[=as.integer]{as.integer()}} on MIC values as by the \R convention on \link{factor}s, it will return the index of the factor levels (which is often useless for regular users).
|
||||
|
||||
Use \code{\link[=droplevels]{droplevels()}} to drop unused levels. At default, it will return a plain factor. Use \code{droplevels(..., as.mic = TRUE)} to maintain the \verb{<mic>} class.
|
||||
Use \code{\link[=droplevels]{droplevels()}} to drop unused levels. At default, it will return a plain factor. Use \code{droplevels(..., as.mic = TRUE)} to maintain the \code{mic} class.
|
||||
|
||||
\code{NA_mic_} is a missing value of the new \verb{<mic>} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
|
||||
\code{NA_mic_} is a missing value of the new \code{mic} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
|
||||
}
|
||||
\examples{
|
||||
mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
|
||||
|
@ -86,7 +86,7 @@ rsi_interpretation_history(clean = FALSE)
|
||||
\item{clean}{a \link{logical} to indicate whether previously stored results should be forgotten after returning the 'logbook' with results}
|
||||
}
|
||||
\value{
|
||||
Ordered \link{factor} with new class \verb{<rsi>}
|
||||
Ordered \link{factor} with new class \code{rsi}
|
||||
}
|
||||
\description{
|
||||
Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing R/SI values. This transforms the input to a new class \code{\link{rsi}}, which is an ordered \link{factor} with levels \verb{S < I < R}.
|
||||
@ -139,12 +139,12 @@ The repository of this package \href{https://github.com/msberends/AMR/blob/main/
|
||||
|
||||
\subsection{Other}{
|
||||
|
||||
The function \code{\link[=is.rsi]{is.rsi()}} detects if the input contains class \verb{<rsi>}. If the input is a \link{data.frame}, it iterates over all columns and returns a \link{logical} vector.
|
||||
The function \code{\link[=is.rsi]{is.rsi()}} detects if the input contains class \code{rsi}. If the input is a \link{data.frame}, it iterates over all columns and returns a \link{logical} vector.
|
||||
|
||||
The function \code{\link[=is.rsi.eligible]{is.rsi.eligible()}} returns \code{TRUE} when a columns contains at most 5\% invalid antimicrobial interpretations (not S and/or I and/or R), and \code{FALSE} otherwise. The threshold of 5\% can be set with the \code{threshold} argument. If the input is a \link{data.frame}, it iterates over all columns and returns a \link{logical} vector.
|
||||
}
|
||||
|
||||
\code{NA_rsi_} is a missing value of the new \verb{<rsi>} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
|
||||
\code{NA_rsi_} is a missing value of the new \code{rsi} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
|
||||
}
|
||||
\section{Interpretation of R and S/I}{
|
||||
|
||||
|
@ -52,7 +52,7 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 11)
|
||||
|
||||
\item{ampc_cephalosporin_resistance}{a \link{character} value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2} and higher; these version of '\emph{EUCAST Expert Rules on Enterobacterales}' state that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of \code{NA} (the default) for this argument will remove results for these three agents, while e.g. a value of \code{"R"} will make the results for these agents resistant. Use \code{NULL} or \code{FALSE} to not alter results for these three agents of AmpC de-repressed cephalosporin-resistant mutants. Using \code{TRUE} is equal to using \code{"R"}. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia} and \emph{Serratia}.}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \verb{<rsi>} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{rsi} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
|
||||
\item{custom_rules}{custom rules to apply, created with \code{\link[=custom_eucast_rules]{custom_eucast_rules()}}}
|
||||
|
||||
|
@ -82,7 +82,7 @@ filter_first_isolate(
|
||||
|
||||
\item{include_unknown}{a \link{logical} to indicate whether 'unknown' microorganisms should be included too, i.e. microbial code \code{"UNKNOWN"}, which defaults to \code{FALSE}. For WHONET users, this means that all records with organism code \code{"con"} (\emph{contamination}) will be excluded at default. Isolates with a microbial ID of \code{NA} will always be excluded as first isolate.}
|
||||
|
||||
\item{include_untested_rsi}{a \link{logical} to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use \code{include_untested_rsi = FALSE} to always return \code{FALSE} for such rows. This checks the data set for columns of class \verb{<rsi>} and consequently requires transforming columns with antibiotic results using \code{\link[=as.rsi]{as.rsi()}} first.}
|
||||
\item{include_untested_rsi}{a \link{logical} to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use \code{include_untested_rsi = FALSE} to always return \code{FALSE} for such rows. This checks the data set for columns of class \code{rsi} and consequently requires transforming columns with antibiotic results using \code{\link[=as.rsi]{as.rsi()}} first.}
|
||||
|
||||
\item{...}{arguments passed on to \code{\link[=first_isolate]{first_isolate()}} when using \code{\link[=filter_first_isolate]{filter_first_isolate()}}, otherwise arguments passed on to \code{\link[=key_antimicrobials]{key_antimicrobials()}} (such as \code{universal}, \code{gram_negative}, \code{gram_positive})}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ guess_ab_col(
|
||||
|
||||
\item{verbose}{a \link{logical} to indicate whether additional info should be printed}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \verb{<rsi>} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{rsi} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
}
|
||||
\value{
|
||||
A column name of \code{x}, or \code{NULL} when no result is found.
|
||||
|
@ -45,7 +45,7 @@ antimicrobials_equal(
|
||||
|
||||
\item{antifungal}{names of antifungal agents for \strong{fungi}, case-insensitive. Set to \code{NULL} to ignore. See \emph{Details} for the default agents.}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns must be included that were transformed to class \verb{<rsi>} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns must be included that were transformed to class \code{rsi} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
|
||||
\item{...}{ignored, only in place to allow future extensions}
|
||||
|
||||
|
@ -58,7 +58,7 @@ eucast_exceptional_phenotypes(x = NULL, only_rsi_columns = FALSE, ...)
|
||||
|
||||
\item{verbose}{a \link{logical} to turn Verbose mode on and off (default is off). In Verbose mode, the function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \verb{<rsi>} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{rsi} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
|
||||
\item{...}{in case of \code{\link[=custom_mdro_guideline]{custom_mdro_guideline()}}: a set of rules, see section \emph{Using Custom Guidelines} below. Otherwise: column name of an antibiotic, see section \emph{Antibiotics} below.}
|
||||
|
||||
|
@ -60,7 +60,7 @@ It has now created a file \code{"~/mo_source.rds"} with the contents of our Exce
|
||||
And now we can use it in our functions:
|
||||
|
||||
\if{html}{\out{<div class="sourceCode">}}\preformatted{as.mo("lab_mo_ecoli")
|
||||
#> Class <mo>
|
||||
#> Class 'mo'
|
||||
#> [1] B_ESCHR_COLI
|
||||
|
||||
mo_genus("lab_mo_kpneumoniae")
|
||||
@ -70,7 +70,7 @@ mo_genus("lab_mo_kpneumoniae")
|
||||
as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
|
||||
#> NOTE: Translation to one microorganism was guessed with uncertainty.
|
||||
#> Use mo_uncertainties() to review it.
|
||||
#> Class <mo>
|
||||
#> Class 'mo'
|
||||
#> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
|
||||
}\if{html}{\out{</div>}}
|
||||
|
||||
@ -91,7 +91,7 @@ If we edit the Excel file by, let's say, adding row 4 like this:
|
||||
#> NOTE: Updated mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
|
||||
#> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
|
||||
#> "Organisation XYZ" and "mo"
|
||||
#> Class <mo>
|
||||
#> Class 'mo'
|
||||
#> [1] B_ESCHR_COLI
|
||||
|
||||
mo_genus("lab_Staph_aureus")
|
||||
|
@ -25,7 +25,7 @@ random_rsi(size = NULL, prob_RSI = c(0.33, 0.33, 0.33), ...)
|
||||
\item{prob_RSI}{a vector of length 3: the probabilities for "R" (1st value), "S" (2nd value) and "I" (3rd value)}
|
||||
}
|
||||
\value{
|
||||
class \verb{<mic>} for \code{\link[=random_mic]{random_mic()}} (see \code{\link[=as.mic]{as.mic()}}) and class \verb{<disk>} for \code{\link[=random_disk]{random_disk()}} (see \code{\link[=as.disk]{as.disk()}})
|
||||
class \code{mic} for \code{\link[=random_mic]{random_mic()}} (see \code{\link[=as.mic]{as.mic()}}) and class \code{disk} for \code{\link[=random_disk]{random_disk()}} (see \code{\link[=as.disk]{as.disk()}})
|
||||
}
|
||||
\description{
|
||||
These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice. By providing a microorganism and antimicrobial agent, the generated results will reflect reality as much as possible.
|
||||
|
Reference in New Issue
Block a user