Skip to contents

Extracts numeric time values (in hours) from time point text descriptions. This function handles various formats including pre-dose notations, hour and minute specifications, time ranges, and day information.

Usage

make_ntime_from_tpt(obj, domain = "PC")

Arguments

obj

A data frame containing time point text descriptions.

domain

The domain code as character (default: "PC" for pharmacokinetic). Used to determine the column name containing time point descriptions.

Value

A numeric vector of time values in hours.

Details

The function recognizes and processes the following patterns:

  • Pre-dose notations (e.g., "PRE-DOSE", "PREDOSE") are converted to 0

  • Hour specifications (e.g., "1H POST-DOSE", "2.5 HOURS POST DOSE")

  • Minute specifications (e.g., "30 MIN POST DOSE") are converted to hours

  • Time ranges (e.g., "0.5H TO 2H POST-DOSE") - the later time is used

  • Day information (e.g., "DAY1 - 2 HOURS POST ADMINISTRATION")

Examples

df <- data.frame(PCTPT = c("PRE-DOSE", "1H POST-DOSE", "2.5 HRS POST-DOSE"))
make_ntime_from_tpt(df)  # Returns c(0, 1, 2.5)
#>               PCTPT NTIME
#> 1          PRE-DOSE   0.0
#> 2      1H POST-DOSE   1.0
#> 3 2.5 HRS POST-DOSE   2.5