Andrew Yee
2012-Sep-05 21:05 UTC
[R] showing ticks for censored data in survfit() in the rms package
The answer to this may be obvious, but I was wondering in the rms package and the survfit(), how you can plot the censored time points as ticks. Take for example, library(survival) library(rms) foo <- data.frame(Time=c(1,2,3,4,5,6,10), Status=c(1,1,0,0,1,1,1)) answer <- survfit(Surv(foo$Time, foo$Status==1) ~1) # this shows the censored time points as ticks at Time = 3 and 4 plot(answer) # how do you achieve something similar with survplot() survplot(answer) Thanks, Andrew
David Winsemius
2012-Sep-06 00:23 UTC
[R] showing ticks for censored data in survfit() in the rms package
On Sep 5, 2012, at 2:05 PM, Andrew Yee wrote:> The answer to this may be obvious, but I was wondering in the rms > package and the survfit(), how you can plot the censored time points > as ticks.survfit() is not in rms.> > Take for example, > > library(survival) > library(rms) > > foo <- data.frame(Time=c(1,2,3,4,5,6,10), Status=c(1,1,0,0,1,1,1)) > answer <- survfit(Surv(foo$Time, foo$Status==1) ~1) > > # this shows the censored time points as ticks at Time = 3 and 4 > plot(answer) > > # how do you achieve something similar with survplot() > survplot(answer) >You should read more widely in the survival help pages. Since rms is in many cases built on top of the survival package. That 'answer'-object is of class "survfit" and there is a lines() method for survfit-objects. help(survfit) # follow links to lines lines(answer) # ticks appear. -- David Winsemius, MD Alameda, CA, USA