[R] survival curve for only certain values of a factor

From: Chang Liu <changisme_at_hotmail.com>
Date: Wed, 12 Mar 2008 17:13:04 -0700

Hello:  

Using the built-in dataset aml as an example:  

data(aml)
If I use instead dummy variables:  

aml$x1 = (aml$x=="maintained")aml$x2 = (aml$x=="unmaintained") and I want to plot the survival curve using x1, x2, and I just want the 2 levels, rather than 4 curves from:  

fit <- survfit(Surv(time, status) ~ x1+x2, data=aml) plot(fit)  

I guess because there are 2 levels for each variable?  

Thanks!  

p.s. I need to do this more because my dummies are not good to combine and I want to be able to work with them separately also, not becuase I'm crazy!  



Create a handy button so your friends can add U to their buddy list. Try it now!

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 13 Mar 2008 - 00:19:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 13 Mar 2008 - 08:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive