Entering edit mode
Rifat Hamoudi
▴
30
@rifat-hamoudi-1330
Last seen 10.2 years ago
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