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