Question: Displaying multiple survival curves on one graph
0
gravatar for Rifat Hamoudi
13.8 years ago by
Rifat Hamoudi30 wrote:
Hello, I am trying to plot 4 survival curve on one graph but this seem hard to do in R. What I am trying to do is to superimpose all 4 survival curves on one graph. I tried the following : datastat<-read.table("survival curve A2.txt", header= TRUE, sep="\t", quote="", comment.char="", na.strings="#N/A") # Plot attach(datastat) names(datastat) a<-survfit(Surv(Weeks, A==1), conf.type="none") a b<-survfit(Surv(Weeks, B==1), conf.type="none") b c<-survfit(Surv(Weeks, C==1), conf.type="none") c d<-survfit(Surv(Weeks, D==1), conf.type="none") d plot(a,b,c,d) But plot function doesn't work. The data is as follows : Weeks A B C D 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 6 0 0 0 0 7 0 0 0 0 8 0 0 0 0 9 0 0 0 0 10 0 0 0 0 11 0 0 0 0 12 1 0 0 0 13 0 0 0 1 14 0 0 0 1 15 0 0 0 1 16 0 0 1 2 17 0 0 1 1 18 0 0 1 2 19 0 1 1 1 20 0 0 2 1 21 0 0 1 2 22 0 0 1 1 23 0 0 0 2 24 0 0 1 2 25 0 0 1 1 26 0 0 1 1 27 0 0 2 1 28 0 0 0 1 29 0 0 1 2 30 0 0 1 1 31 0 0 1 0 32 0 0 1 1 33 0 0 1 0 34 0 0 1 0 35 0 0 1 0 36 0 0 0 0 37 0 0 1 0 38 0 0 0 0 39 0 1 1 0 40 0 0 1 0 41 0 0 1 0 42 0 0 0 0 43 0 0 1 0 Any help with this is appreciated. It seems easy to do but I played with par() and other things but couldn't get all 4 curves to plot on one graph. Many thanks rifat
survival graph • 1.8k views
ADD COMMENTlink modified 13.8 years ago by Seth Falcon7.4k • written 13.8 years ago by Rifat Hamoudi30
Answer: Displaying multiple survival curves on one graph
0
gravatar for Seth Falcon
13.8 years ago by
Seth Falcon7.4k
Seth Falcon7.4k wrote:
Hi Rifat, I think this question might be more appropriate for R-help. I would recommend trying RSiteSearch() to look for possible solutions to your question. Conceptually, I suspect what you will need to do is: - plot one survfit result - use lines() or points() and the relevant data extracted from the other fits to add to the existing plot. HTH, + seth
ADD COMMENTlink written 13.8 years ago by Seth Falcon7.4k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 193 users visited in the last hour