[R] Plotting individual survival plots

Thomas Lumley tlumley at u.washington.edu
Mon Dec 18 23:43:43 CET 2006


On Mon, 18 Dec 2006, Farrel Buchinsky wrote:

> Using the survival library, it is possible to get a plot of all the subjects
> in a sample and it is possible to get a plot of all subgroups in the same
> plot. How does one get a separate plot for each subgroup?

There is an example in ?survfit of how to plot a single subgroup, and you 
can just wrap it in a loop to plot all the subgroups.

 	-thomas


> plot(survfit(Surv(time,death==1)~group),col=1:10)
>
> The above results in a hideous graphic representation.
>
> I would prefer to specify
>
> par(mfrow = c(2, 5))
>
> and have each plot separately
>
>
> -- 
> Farrel
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle



More information about the R-help mailing list