[Rd] new behavior of model.response
Therneau, Terry M., Ph.D.
therne@u @ending from m@yo@edu
Wed Jun 27 22:54:20 CEST 2018
Charles Berry pointed out an error in my reasoning. In the current survival I forgot the
S3method line for length in the NAMESPACE file, so the behavior is really not new.
Nonetheless it remains surprising and non-intuitive. Why does model.response sometimes
attach spurious names, when the Surv object itself does not have them?
Terry
tmt% R --vanilla
R version 3.4.2 (2017-09-28) -- "Short Summer"
test <- data.frame(time=1:8, status=rep(0:1, 4), age=60:67)
row.names(test) <- letters[1:8]
library(survival)
mf2 <- model.frame(Surv(time, status) ~ age, data=test)
names(mf2[[1]])
# NULL
names(model.response(mf2))
# NULL
length.Surv <- survival:::length.Surv
names(model.response(mf2))
# [1] "a" "b" "c" "d" "e" "f" "g" "h" NA NA NA NA NA NA NA NA
[[alternative HTML version deleted]]
More information about the R-devel
mailing list