Cut a dataset for analysis at a specified event count
Source:R/cut_data_by_event.R
cut_data_by_event.Rd
Takes a time-to-event data set and cuts the data at which an event count is reached.
Arguments
- x
A time-to-event dataset, for example, generated by
sim_pw_surv()
.- event
Event count at which data cutoff is to be made.
Value
A data frame ready for survival analysis, including columns
time to event (tte
), event
, the stratum
, and the treatment
.
Examples
# Use default enrollment and event rates at cut at 100 events
x <- sim_pw_surv(n = 200) |> cut_data_by_event(100)
table(x$event, x$treatment)
#>
#> control experimental
#> 0 48 49
#> 1 50 50