Learn R Programming

nlmixr2autoinit (version 1.0.0)

processData: Process time–concentration dataset for pharmacokinetic analysis

Description

Processes a time–concentration dataset to derive analysis-ready variables and structured output for pharmacokinetic evaluation.

Usage

processData(dat, verbose = TRUE)

Value

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.

Arguments

dat

A data frame containing raw time–concentration data in the standard nlmixr2 format. The following columns are required (case-insensitive) and must be present:

ID

Subject identifier (required)

TIME

Nominal or actual time after dose (required)

DV

Observed concentration (dependent variable) (required)

EVID

Event ID indicating observation (0) or dosing event (1) (required)

AMT

Dose amount for dosing records (required)

RATE

Infusion rate (optional)

DUR

Infusion duration (optional)

MDV

Missing dependent variable flag (optional)

CMT

Compartment number (optional)

ADDL

Number of additional doses (optional)

II

Interdose interval (optional)

SS

Steady-state indicator (optional)

CENS

Censoring indicator (optional)

verbose

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.

Author

Zhonghui Huang

Details

This function standardizes and preprocesses time–concentration data to ensure compatibility with pharmacokinetic modeling workflows in nlmixr2. The operations follow these steps:

  1. Standardize data

    • convert column names to uppercase

    • coerce key columns (TIME, DV, EVID, AMT, RATE, etc.) to numeric

  2. 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)

  3. Expand dose events

    • expand dosing records using nmpkconvert() when ADDL and II are present

    • assign dose occasions using mark_dose_number()

  4. Determine administration route and infusion logic

    • derive RATE and DUR when needed

    • identify route (bolus, infusion, oral) based on compartment and rate

  5. Generate derived variables

    • calculate time after dose using calculate_tad()

    • compute dose-normalized concentration (DVstd)

    • flag eligible records for terminal elimination phase

  6. 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.

See Also

nmpkconvert, mark_dose_number, calculate_tad

Examples

Run this code
dat <- Bolus_1CPT
processData(dat)

Run the code above in your browser using DataLab