AMR/man/bug_drug_combinations.Rd

85 lines
3.9 KiB
Plaintext
Raw Permalink Normal View History

2019-08-25 22:53:22 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bug_drug_combinations.R
\name{bug_drug_combinations}
\alias{bug_drug_combinations}
2019-08-27 22:41:09 +02:00
\alias{format.bug_drug_combinations}
\title{Determine Bug-Drug Combinations}
2019-08-25 22:53:22 +02:00
\usage{
bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname, ...)
2019-08-27 22:41:09 +02:00
\method{format}{bug_drug_combinations}(
x,
translate_ab = "name (ab, atc)",
language = get_AMR_locale(),
minimum = 30,
combine_SI = TRUE,
add_ab_group = TRUE,
remove_intrinsic_resistant = FALSE,
decimal.mark = getOption("OutDec"),
2023-02-09 13:07:39 +01:00
big.mark = ifelse(decimal.mark == ",", ".", ","),
...
)
2019-08-25 22:53:22 +02:00
}
\arguments{
2022-08-27 20:49:37 +02:00
\item{x}{a data set with antibiotic columns, such as \code{amox}, \code{AMX} and \code{AMC}}
2019-08-25 22:53:22 +02:00
\item{col_mo}{column name of the names or codes of the microorganisms (see \code{\link[=as.mo]{as.mo()}}) - the default is the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
2019-08-25 22:53:22 +02:00
\item{FUN}{the function to call on the \code{mo} column to transform the microorganism codes - the default is \code{\link[=mo_shortname]{mo_shortname()}}}
2019-09-23 13:53:50 +02:00
2019-09-25 15:43:22 +02:00
\item{...}{arguments passed on to \code{FUN}}
2021-05-12 18:15:03 +02:00
\item{translate_ab}{a \link{character} of length 1 containing column names of the \link{antibiotics} data set}
2019-09-25 15:43:22 +02:00
\item{language}{language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the \link[=AMR-options]{package option} \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
2019-09-25 15:43:22 +02:00
\item{minimum}{the minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see \emph{Source}.}
\item{combine_SI}{a \link{logical} to indicate whether values S and I should be summed, so resistance will be based on only R - the default is \code{TRUE}}
2019-08-27 22:41:09 +02:00
2021-05-12 18:15:03 +02:00
\item{add_ab_group}{a \link{logical} to indicate where the group of the antimicrobials must be included as a first column}
2019-08-27 23:00:00 +02:00
2021-05-12 18:15:03 +02:00
\item{remove_intrinsic_resistant}{\link{logical} to indicate that rows and columns with 100\% resistance for all tested antimicrobials must be removed from the table}
2019-09-25 15:43:22 +02:00
2019-09-23 13:53:50 +02:00
\item{decimal.mark}{the character to be used to indicate the numeric
decimal point.}
\item{big.mark}{character; if not empty used as mark between every
\code{big.interval} decimals \emph{before} (hence \code{big}) the
decimal point.}
2019-08-25 22:53:22 +02:00
}
\value{
2024-05-20 15:27:04 +02:00
The function \code{\link[=bug_drug_combinations]{bug_drug_combinations()}} returns a \link{data.frame} with columns "mo", "ab", "S", "SDD", "I", "R", and "total".
}
2019-08-25 22:53:22 +02:00
\description{
2021-07-04 15:26:50 +02:00
Determine antimicrobial resistance (AMR) of all bug-drug combinations in your data set where at least 30 (default) isolates are available per species. Use \code{\link[=format]{format()}} on the result to prettify it to a publishable/printable format, see \emph{Examples}.
2019-08-25 22:53:22 +02:00
}
\details{
2023-02-24 09:43:10 +01:00
The function \code{\link[=format]{format()}} calculates the resistance per bug-drug combination and returns a table ready for reporting/publishing. Use \code{combine_SI = TRUE} (default) to test R vs. S+I and \code{combine_SI = FALSE} to test R+I vs. S. This table can also directly be used in R Markdown / Quarto without the need for e.g. \code{\link[knitr:kable]{knitr::kable()}}.
}
2019-08-25 22:53:22 +02:00
\examples{
# example_isolates is a data set available in the AMR package.
# run ?example_isolates for more info.
example_isolates
2019-08-25 22:53:22 +02:00
\donttest{
x <- bug_drug_combinations(example_isolates)
2023-02-09 13:07:39 +01:00
head(x)
2019-10-11 17:21:02 +02:00
format(x, translate_ab = "name (atc)")
2019-09-23 13:53:50 +02:00
# Use FUN to change to transformation of microorganism codes
bug_drug_combinations(example_isolates,
2022-08-28 10:31:50 +02:00
FUN = mo_gramstain
)
bug_drug_combinations(example_isolates,
FUN = function(x) {
ifelse(x == as.mo("Escherichia coli"),
"E. coli",
"Others"
)
}
)
2019-08-25 22:53:22 +02:00
}
}