[R] save print survfit object to data frame
Thomas Lumley
tlumley at u.washington.edu
Tue Oct 5 16:48:23 CEST 2004
On Tue, 5 Oct 2004, Ruud H. Koning wrote:
> Hello, I have estimated a survival model with six strata:
>
>> model.b <-
> survfit(Surv(time=start.tijd,time2=eind.tijd2,event=va)~strata(product.code)
> ,
> data=wu.wide)
>
> I would like to save the output of
>
>> print(model.b,print.n="records",show.rmean=FALSE)
>
> in a dataframe so that I can export it later. How do I do this? Note that
> summary(model.b) gives an error:
> Error in as.matrix(x) : (subscript) logical subscript too long
>
I believe this bug has been fixed now, but summary() doesn't give the same
information as print().
It's a bit embarassing that the best solution seems to be
tmp<-capture.output(print(model.b,print.n="records",show.rmean=FALSE))
read.table(textConnection(tmp), skip=3, header=TRUE)
-thomas
More information about the R-help
mailing list