Skip to contents

Cut a Dataset for Analysis at a Specified Date

Usage

cutData(x, cut_date)

Arguments

x

a time-to-event dataset, e.g., generated by simPWSurv

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
library(dplyr)
simPWSurv(n = 20) %>% cutData(5)
#> # A tibble: 20 × 4
#> # Groups:   Stratum, Treatment [2]
#>      tte event Stratum Treatment   
#>    <dbl> <dbl> <chr>   <chr>       
#>  1  4.94     0 All     Experimental
#>  2  4.87     0 All     Control     
#>  3  4.71     0 All     Experimental
#>  4  4.65     0 All     Control     
#>  5  1.19     1 All     Control     
#>  6  4.38     0 All     Experimental
#>  7  4.19     0 All     Experimental
#>  8  4.16     0 All     Control     
#>  9  1.71     1 All     Control     
#> 10  3.85     0 All     Control     
#> 11  3.80     0 All     Experimental
#> 12  3.75     0 All     Experimental
#> 13  3.75     0 All     Control     
#> 14  3.72     0 All     Experimental
#> 15  3.45     0 All     Control     
#> 16  3.39     0 All     Experimental
#> 17  3.18     0 All     Experimental
#> 18  2.95     0 All     Control     
#> 19  2.94     0 All     Control     
#> 20  2.08     1 All     Experimental