HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Program Files/R/R-4.4.0/library/survival/tests/nested.Rout.save
R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)

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)
Loading required package: splines
> #
> # 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 
  0.196   0.032   0.225