Skip to contents

This transforms a vector to a new class disk, which is a disk diffusion growth zone size (around an antibiotic disk) in millimetres between 6 and 50.

Usage

as.disk(x, na.rm = FALSE)

NA_disk_

is.disk(x)

Format

An object of class disk (inherits from integer) of length 1.

Arguments

x

vector

na.rm

a logical indicating whether missing values should be removed

Value

An integer with additional class disk

Details

Interpret disk values as RSI values with as.rsi(). It supports guidelines from EUCAST and CLSI.

NA_disk_ is a missing value of the new <disk> class.

See also

Examples

# transform existing disk zones to the `disk` class (using base R)
df <- data.frame(
  microorganism = "Escherichia coli",
  AMP = 20,
  CIP = 14,
  GEN = 18,
  TOB = 16
)
df[, 2:5] <- lapply(df[, 2:5], as.disk)
str(df)
#> 'data.frame':	1 obs. of  5 variables:
#>  $ microorganism: chr "Escherichia coli"
#>  $ AMP          : 'disk' int 20
#>  $ CIP          : 'disk' int 14
#>  $ GEN          : 'disk' int 18
#>  $ TOB          : 'disk' int 16

# \donttest{
# transforming is easier with dplyr:
if (require("dplyr")) {
  df %>% mutate(across(AMP:TOB, as.disk))
}
#>      microorganism AMP CIP GEN TOB
#> 1 Escherichia coli  20  14  18  16
# }

# 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()
  guideline = "EUCAST"
)
#> => Interpreting disk diffusion zones of 'ampicillin' (AMP, ampicillin)
#>    according to EUCAST 2022...
#>  OK.
#> Class <rsi>
#> [1] R

# interpret whole data set, pretend to be all from urinary tract infections:
as.rsi(df, uti = TRUE)
#> ℹ Using column 'microorganism' as input for `col_mo`.
#> => Interpreting disk diffusion zones of column 'AMP' (ampicillin) according
#>    to EUCAST 2022...
#>  OK.
#> => Interpreting disk diffusion zones of column 'CIP' (ciprofloxacin)
#>    according to EUCAST 2022...
#>  OK.
#> => Interpreting disk diffusion zones of column 'GEN' (gentamicin) according
#>    to EUCAST 2022...
#>  OK.
#> => Interpreting disk diffusion zones of column 'TOB' (tobramycin) according
#>    to EUCAST 2022...
#>  OK.
#>      microorganism AMP CIP GEN TOB
#> 1 Escherichia coli   S   R   S   S