AMR/man/as.disk.Rd

70 lines
1.6 KiB
Plaintext
Raw Normal View History

2019-05-10 16:44:59 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/disk.R
\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}
\alias{NA_disk_}
2019-05-10 16:44:59 +02:00
\alias{is.disk}
\title{Transform Input to Disk Diffusion Diameters}
\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)
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{
An \link{integer} with additional class \code{\link{disk}}
2019-05-10 16:44:59 +02:00
}
\description{
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{
Interpret disk values as RSI values with \code{\link[=as.rsi]{as.rsi()}}. It supports guidelines from EUCAST and CLSI.
2022-10-19 11:47:57 +02:00
\code{NA_disk_} is a missing value of the new \code{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)
2022-08-28 10:31:50 +02:00
df <- data.frame(
microorganism = "Escherichia coli",
AMP = 20,
CIP = 14,
GEN = 18,
TOB = 16
)
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
2022-08-28 10:31:50 +02:00
as.rsi(
x = as.disk(18),
mo = "Strep pneu", # `mo` will be coerced with as.mo()
ab = "ampicillin", # and `ab` with as.ab()
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{
\code{\link[=as.rsi]{as.rsi()}}
2019-05-10 16:44:59 +02:00
}
\keyword{datasets}