2019-05-10 16:44:59 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/disk.R
2021-11-28 23:01:26 +01:00
\docType{data}
2019-05-10 16:44:59 +02:00
\name{as.disk}
\alias{as.disk}
2019-11-06 14:43:23 +01:00
\alias{disk}
2021-11-28 23:01:26 +01:00
\alias{NA_disk_}
2019-05-10 16:44:59 +02:00
\alias{is.disk}
2021-01-18 16:57:56 +01:00
\title{Transform Input to Disk Diffusion Diameters}
2021-11-28 23:01:26 +01:00
\format{
An object of class \code{disk} (inherits from \code{integer}) of length 1.
}
2019-05-10 16:44:59 +02:00
\usage{
as.disk(x, na.rm = FALSE)
2021-11-28 23:01:26 +01:00
NA_disk_
2019-05-10 16:44:59 +02:00
is.disk(x)
}
\arguments{
\item{x}{vector}
2021-05-12 18:15:03 +02:00
\item{na.rm}{a \link{logical} indicating whether missing values should be removed}
2019-05-10 16:44:59 +02:00
}
\value{
2020-09-18 16:05:53 +02:00
An \link{integer} with additional class \code{\link{disk}}
2019-05-10 16:44:59 +02:00
}
\description{
2020-09-03 12:31:48 +02:00
This transforms a vector to a new class \code{\link{disk}}, which is a disk diffusion growth zone size (around an antibiotic disk) in millimetres between 6 and 50.
2019-05-10 16:44:59 +02:00
}
\details{
2019-11-28 22:32:17 +01:00
Interpret disk values as RSI values with \code{\link[=as.rsi]{as.rsi()}}. It supports guidelines from EUCAST and CLSI.
2021-11-28 23:01:26 +01:00
\code{NA_disk_} is a missing value of the new \verb{<disk>} class.
2019-05-10 16:44:59 +02:00
}
\examples{
2022-08-21 16:37:20 +02:00
# transform existing disk zones to the `disk` class (using base R)
df <- data.frame(microorganism = "Escherichia coli",
2020-02-17 14:38:01 +01:00
AMP = 20,
CIP = 14,
GEN = 18,
TOB = 16)
2020-09-29 23:35:46 +02:00
df[, 2:5] <- lapply(df[, 2:5], as.disk)
2022-08-21 16:37:20 +02:00
str(df)
2022-08-21 16:52:09 +02:00
\donttest{
2022-08-21 16:37:20 +02:00
# transforming is easier with dplyr:
if (require("dplyr")) {
df \%>\% mutate(across(AMP:TOB, as.disk))
}
}
2020-02-17 14:38:01 +01:00
# interpret disk values, see ?as.rsi
as.rsi(x = as.disk(18),
mo = "Strep pneu", # `mo` will be coerced with as.mo()
ab = "ampicillin", # and `ab` with as.ab()
2019-05-10 16:44:59 +02:00
guideline = "EUCAST")
2022-08-21 16:37:20 +02:00
# interpret whole data set, pretend to be all from urinary tract infections:
as.rsi(df, uti = TRUE)
2020-05-16 21:40:50 +02:00
}
2019-05-10 16:44:59 +02:00
\seealso{
2019-11-28 22:32:17 +01:00
\code{\link[=as.rsi]{as.rsi()}}
2019-05-10 16:44:59 +02:00
}
2021-11-28 23:01:26 +01:00
\keyword{datasets}