R Under development (unstable) (2025-09-08 r88798 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Other tests which don't work within the testthat framework. > library(RobinCar2) Attaching package: 'RobinCar2' The following object is masked from 'package:base': table > > # test: "h_prep_survival_input works with survival::Surv objects" > surv_obj <- with(surv_data, survival::Surv(time, status)) > # This works with coxph e.g.: > example <- survival::coxph(surv_obj ~ sex, data = surv_data) > result <- RobinCar2:::h_prep_survival_input( + formula = surv_obj ~ 1, + # We have another restriction here to avoid ambiguity, therefore + # need to remove the time and status columns from the data. + data = subset(surv_data, select = -c(time, status)), + treatment = sex ~ 1 + ) > expected <- list( + data = cbind( + subset(surv_data, select = -c(time, status)), + subset(surv_data, select = c(time, status)) + ), # The two removed columns have been added back. + time = "time", + status = "status", + treatment = "sex", + strata = character(), + schema = "sp", + covariates = character(), + model = ~1, + n_levels = 2L, + levels = c("Female", "Male") + ) > testthat::expect_equal(result, expected, ignore_formula_env = TRUE) > > proc.time() user system elapsed 1.85 0.21 2.03