Processes a time–concentration dataset to derive analysis-ready variables and structured output for pharmacokinetic evaluation.
processData(dat, verbose = TRUE)A list with two elements:
dat: A data frame containing the processed time–concentration dataset with standardized and derived pharmacokinetic variables, including resetflag, SSflag, route, dose_number, DVstd, indiv_lambda_z_eligible, and others.
Datainfo: A data frame summarizing the dataset structure, including subject counts and observation counts for first-dose and multiple-dose conditions, with contextual notes.
A data frame containing raw time–concentration data in the standard nlmixr2 format. The following columns are required (case-insensitive) and must be present:
Subject identifier (required)
Nominal or actual time after dose (required)
Observed concentration (dependent variable) (required)
Event ID indicating observation (0) or dosing event (1) (required)
Dose amount for dosing records (required)
Infusion rate (optional)
Infusion duration (optional)
Missing dependent variable flag (optional)
Compartment number (optional)
Number of additional doses (optional)
Interdose interval (optional)
Steady-state indicator (optional)
Censoring indicator (optional)
Logical (default = TRUE). When TRUE, the function prints detailed processing messages and summary tables to the console, including notes on data cleaning and event handling. When FALSE, these messages are suppressed and only the returned list is produced.
Zhonghui Huang
This function standardizes and preprocesses time–concentration data to ensure compatibility with pharmacokinetic modeling workflows in nlmixr2. The operations follow these steps:
Standardize data
convert column names to uppercase
coerce key columns (TIME, DV, EVID, AMT, RATE, etc.) to numeric
Process events and observations
impute EVID from MDV if missing
handle censored data (CENS) by converting them to excluded records
remove or recode invalid EVID values (e.g., DV = 0 observations)
Expand dose events
expand dosing records using nmpkconvert() when ADDL and II are present
assign dose occasions using mark_dose_number()
Determine administration route and infusion logic
derive RATE and DUR when needed
identify route (bolus, infusion, oral) based on compartment and rate
Generate derived variables
calculate time after dose using calculate_tad()
compute dose-normalized concentration (DVstd)
flag eligible records for terminal elimination phase
Summarize dataset
classify dataset as first-dose, repeated-dose, or mixed
generate summary metrics for nlmixr2 analysis
Classification of dosing context is based on pharmacokinetic observation records (EVID equal to 0), determining whether observed concentrations occur after the first dose, during repeated dosing, or across both contexts. The categories are:
first_dose: observations occur only after the initial administration, without repeated-dose or steady-state intervals.
repeated_doses: observations occur only after multiple administrations or under steady-state conditions.
combined_doses: observations include both first-dose and repeated-dose intervals and are analyzed together.
nmpkconvert, mark_dose_number, calculate_tad
dat <- Bolus_1CPT
processData(dat)
Run the code above in your browser using DataLab