force_mic: Force MIC-like into MIC-compatible format

View source: R/meta_data.R

force_micR Documentation

Force MIC-like into MIC-compatible format

Description

Convert a value that is "almost" an MIC into a valid MIC value.

Usage

force_mic(
  value,
  levels_from_AMR = FALSE,
  max_conc = 512,
  min_conc = 0.002,
  method = "closest",
  prefer = "max"
)

Arguments

value

vector of MIC-like values (numeric or character)

levels_from_AMR

conform to AMR::as.mic levels

max_conc

maximum concentration to force to

min_conc

minimum concentration to force to

method

method to use when forcing MICs (closest or round_up)

prefer

where value is in between MIC (e.g., 24mg/L) chose the higher MIC ("max") or lower MIC ("min"); only applies to method = "closest"

Details

Some experimental or analytical conditions measure MIC (or surrogate) in a way that does not fully conform to traditional MIC levels (i.e., concentrations). This function allows these values to be coerced into an MIC value that is compatible with the AMR::mic class. When using method = "closest", the function will choose the closest MIC value to the input value (e.g., 2.45 will be coerced to 2). When using method = "round up", the function will round up to the next highest MIC value (e.g., 2.45 will be coerced to 4). "Round up" is technically the correct approach if the input value was generated from an experiment that censored between concentrations (e.g., broth or agar dilution). However, "closest" may be more appropriate in some cases.

Value

AMR::as.mic compatible character

Examples

force_mic(c("2.32", "<4.12", ">1.01"))

MIC documentation built on April 12, 2025, 2:26 a.m.