[R] position of number at risk in survplot() graphs

From: Osman Al-Radi <osman.al.radi_at_gmail.com>
Date: Wed 31 May 2006 - 02:50:12 EST


Dear R-help

How can one get survplot() to place the number at risk just below the survival curve as opposed to the default which is just above the x-axis? I tried the code bellow but the result is not satisfactory as some numbers are repeated several times at different y coordinates and the position of the n.risk numbers corresponds to the x-axis tick marks not the survival curve time of censoring.

n <- 20
set.seed(731)
cens <- 15*runif(n)
h <- .02*exp(2)
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
S <- Surv(dt,e)
km<-survfit(S~1)
survplot(km,n.risk=T,conf='none', y.n.risk=unique(summary(km)$surv))

Any suggestion on addressing this problem would be apprecited.

Also, is there a way to add a tick mark to the survival curve at times of censoring similar to the mark.time=T argument in plot.survplot()?

Thanks

Osman

-- 
Osman O. Al-Radi, MD, MSc, FRCSC
Fellow, Cardiovascular Surgery
The Hospital for Sick Children
University of Toronto, Canada

	[[alternative HTML version deleted]]

______________________________________________
R-help@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
Received on Wed May 31 02:55:10 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 31 May 2006 - 08:13:49 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.