1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 19:26:12 +01:00
AMR/man/as.disk.Rd

72 lines
1.8 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{
2024-10-15 17:12:55 +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 0 and 50.
2019-05-10 16:44:59 +02:00
}
\details{
2023-01-21 23:47:20 +01:00
Interpret disk values as SIR values with \code{\link[=as.sir]{as.sir()}}. It supports guidelines from EUCAST and CLSI.
2024-10-15 17:12:55 +02:00
Disk diffusion growth zone sizes must be between 0 and 50 millimetres. Values higher than 50 but lower than 100 will be maximised to 50. All others input values outside the 0-50 range will return \code{NA}.
2022-10-29 14:15:23 +02:00
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
2023-01-21 23:47:20 +01:00
# interpret disk values, see ?as.sir
as.sir(
2022-08-28 10:31:50 +02:00
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:
2023-01-21 23:47:20 +01:00
as.sir(df, uti = TRUE)
2020-05-16 21:40:50 +02:00
}
2019-05-10 16:44:59 +02:00
\seealso{
2023-01-21 23:47:20 +01:00
\code{\link[=as.sir]{as.sir()}}
2019-05-10 16:44:59 +02:00
}
\keyword{datasets}