
Convert event data to trial duration data A helper function to create a custom event table. The observation time will start from the first event time (baseline) and end at trial duration. The interval is the spacing between each observation.
Source:R/CTS.R
toTrialDuration.RdConvert event data to trial duration data A helper function to create a custom event table. The observation time will start from the first event time (baseline) and end at trial duration. The interval is the spacing between each observation.
Examples
# Create event table with unique time for each ID
ev = et(data.frame(id = rep(1:10, 3), time = runif(min = 10, max = 20, n = 30)))
# select the duration and spacing interval (assuming time is in years)
toTrialDuration(ev, trialEnd = 1.5, interval = 0.2)
#> ── EventTable with 80 records ──
#> 0 dosing records (see value$get.dosing(); add with add.dosing or et)
#> 80 observation times (see value$get.sampling(); add with add.sampling or et)
#> ── First part of value: ──
#> # A tibble: 80 × 3
#> id time evid
#> <int> <dbl> <evid>
#> 1 1 13.9 0:Observation
#> 2 1 14.1 0:Observation
#> 3 1 14.3 0:Observation
#> 4 1 14.5 0:Observation
#> 5 1 14.7 0:Observation
#> 6 1 14.9 0:Observation
#> 7 1 15.1 0:Observation
#> 8 1 15.3 0:Observation
#> 9 2 11.7 0:Observation
#> 10 2 11.9 0:Observation
#> # ℹ 70 more rows