Learn R Programming

MIC (version 1.2.0)

force_mic: 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",
  leq = TRUE,
  geq = NULL
)

Value

AMR::as.mic compatible character

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"

leq

whether to force <= for lower censored values (i.e., <). If TRUE, then all values below the limit of detection are converted to <=. If FALSE, then they are converted to <. If NULL, they are not changed.

geq

whether to force >= for higher censored values (i.e., >). If TRUE, then all values above the limit of detection are converted to >=. If FALSE, then they are converted to >. If NULL, they are not changed.

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.

Please note that this function will not make any changes to censored values (beyond some simple cleaning, e.g., <==2 is converted to <=2). This is because it is not possible to make assumptions about censored data.

The leq and geq arguments convert censored values to <= or >=. When MIC is measured using a an inhibitory dilution method, the lower limit should be reported as <= (since the lowest dilution could be inhibitory itself), and the upper limit should be reported as > (growth in the highest dilution means that it is not an inhibitory concentration). The default values for leq and geq enforce this.

Examples

Run this code
force_mic(c("2.32", "<4.12", ">1.01"))

Run the code above in your browser using DataLab