R version 4.4.0 beta (2024-04-15 r86425 ucrt) -- "Puppy Cup" Copyright (C) 2024 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. > library(survival) > # > # A test of nesting. It makes sure the model.frame is built correctly > # > tfun <- function(fit, mydata) { + survfit(fit, newdata=mydata) + } > > myfit <- coxph(Surv(time, status) ~ age + factor(sex), lung) > > temp1 <- tfun(myfit, lung[1:5,]) > temp2 <- survfit(myfit, lung[1:5,]) > indx <- match('call', names(temp1)) #the call components won't match > > all.equal(unclass(temp1)[-indx], unclass(temp2)[-indx]) [1] TRUE > > > proc.time() user system elapsed 1.10 0.03 1.12