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 dataset ready for survival analysis.

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.9395907     0     All experimental
#> 2  4.9016804     0     All experimental
#> 3  4.8969831     0     All      control
#> 4  1.3334936     1     All      control
#> 5  2.0027721     1     All      control
#> 6  4.5875256     0     All      control
#> 7  4.4638424     0     All experimental
#> 8  4.4578842     0     All experimental
#> 9  4.4278710     0     All experimental
#> 10 4.2711045     0     All experimental
#> 11 4.2480365     0     All      control
#> 12 0.5260723     1     All      control
#> 13 4.0991628     0     All experimental
#> 14 3.6023455     0     All      control
#> 15 3.4781111     0     All      control
#> 16 3.3543856     0     All experimental
#> 17 3.2862231     0     All experimental
#> 18 3.2591821     0     All      control
#> 19 3.1006128     0     All experimental
#> 20 2.2070735     1     All      control