
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.
See also
Other Event tables:
add.dosing(),
add.sampling(),
as.et(),
et(),
etExpand(),
etRbind(),
etRep(),
etSeq(),
eventTable(),
is.rxEt(),
rxEventTableFile(),
splitBolus(),
splitBolusInfusion-directive,
splitInfusion(),
splitInfusionBolus-directive
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 16.9 0:Observation
#> 2 1 17.1 0:Observation
#> 3 1 17.3 0:Observation
#> 4 1 17.5 0:Observation
#> 5 1 17.7 0:Observation
#> 6 1 17.9 0:Observation
#> 7 1 18.1 0:Observation
#> 8 1 18.3 0:Observation
#> 9 2 10.0 0:Observation
#> 10 2 10.2 0:Observation
#> # ℹ 70 more rows