convert_units: Convert concentration and time units as needed

View source: R/convert_units.R

convert_unitsR Documentation

Convert concentration and time units as needed

Description

convert_units converts the units for a data.frame containing concentration-time data as necessary to match some desired set of concentration and time units.

Usage

convert_units(
  DF_to_convert,
  time_units = "hours",
  conc_units = "ng/mL",
  DF_with_good_units = NA,
  MW = NA
)

Arguments

DF_to_convert

the data.frame of concentration-time data with units that may need to be converted. If you're converting concentration units, this must include the columns "Conc" and "Conc_units", and, if you're converting time units, it must include the columns "Time", and "Time_units". (Outputs from extractConcTime, extractConcTime_mult, and extractObsConcTime work here.) If you want to convert between mass per volume and molar concentrations and there are multiple compounds present, this must also include the column "CompoundID".

time_units

time units to use, e.g., "hours". Options for time units are "hours", "days", and "minutes".

conc_units

concentration units to use, e.g. "ng/mL". Options for concentration units are the same as the ones in the Excel form for PE data entry: "mg/L", "mg/mL", "µg/L" (or "ug/L"), "µg/mL" (or "ug/mL"), "ng/L", "ng/mL", "µM" (or "uM"), or "nM".

DF_with_good_units

if you would like to just match another data.frame, supply here a data.frame that has the desired concentration and time units. Options for concentration units are the same as the ones in the Excel form for PE data entry, and options for time units are "hours", "days", and "minutes".

MW

optionally supply a molecular weight for the compound of interest to enable conversions between mass per volume and molar concentrations. If you have more than one compound, list the compoundID and the MW as a named character vector, e.g., MW = c("substrate" = 325.8, "inhibitor 1" = 705.6) for a DDI simulation of midazolam with itraconazole. If you want to make this type of conversion, the data.frame DF_to_convert must also include the column "CompoundID". Acceptable compoundIDs are "substrate", "primary metabolite 1", "primary metabolite 2", "secondary metabolite", "inhibitor 1", "inhibitor 2", or "inhibitor 1 metabolite".

Value

a data.frame with the converted units

Examples

DF_to_convert <- convert_units(DF_to_convert = SimulatedData,
                             DF_with_good_units = ObsData)


shirewoman2/Consultancy documentation built on Feb. 18, 2025, 10 p.m.