File: nested.R

package info (click to toggle)
survival 3.8-6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,496 kB
  • sloc: ansic: 8,088; makefile: 77
file content (16 lines) | stat: -rw-r--r-- 424 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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])