[R] showing ticks for censored data in survfit() in the rms package

David Winsemius dwinsemius at comcast.net
Thu Sep 6 02:23:44 CEST 2012


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




More information about the R-help mailing list