Skip to contents

Cut a dataset for analysis at a specified date

Usage

cut_data_by_date(x, cut_date)

Arguments

x

A time-to-event dataset, for example, generated by sim_pw_surv().

cut_date

Date relative to start of randomization (cte from input dataset) at which dataset is to be cut off for analysis.

Value

A data frame ready for survival analysis, including columns time to event (tte), event, the stratum, and the treatment. The class of the data frame is tte_data, and the attribute ratio generated by sim_pw_surv() is also attached.

Examples

# Use default enrollment and event rates and
# cut at calendar time 5 after start of randomization
sim_pw_surv(n = 20) |> cut_data_by_date(5)
#>          tte event stratum    treatment
#> 1  4.8763169     0     All experimental
#> 2  4.8703586     0     All experimental
#> 3  2.2070735     1     All      control
#> 4  0.1173257     1     All      control
#> 5  4.6605109     0     All experimental
#> 6  4.5461906     0     All      control
#> 7  4.5116372     0     All      control
#> 8  4.0148199     0     All experimental
#> 9  3.8905856     0     All experimental
#> 10 3.7668601     0     All      control
#> 11 3.6986976     0     All experimental
#> 12 3.6716565     0     All      control
#> 13 3.5130873     0     All experimental
#> 14 3.2754677     0     All      control
#> 15 1.1770995     1     All      control
#> 16 3.2343190     0     All experimental
#> 17 3.1307312     0     All experimental
#> 18 2.9814824     0     All experimental
#> 19 2.9608820     0     All      control
#> 20 0.3731280     1     All      control