Estimates and C.I. of percentiles for a survival function In S-plus estimates of percentiles for a survival function can be obtained using the qkaplanMeier function (on the results of a call to kaplanMeier) like that:
kfit <-kaplanMeier(censor(TIME,STATUS)~1)
qkaplanMeier(kfit, c(.25, .5, .75))

How can I do this in R?. Those functions do not exist anymore. What if I also want the (asymptotic) confidence intervals for the percentiles? How can I get the mean for the survival time?
 A: The CRAN task view on survival analysis says:
Kaplan-Meier:
          The
    survfit
          function from the
survival
         package 
    computes the Kaplan-Meier estimator for truncated and/or censored data.
rms
          (replacement of the
Design
          package) 
    proposes a modified version of the
survfit
          function.
    The
prodlim
          package implements a fast algorithm and some features
    not included in
survival.
    Various confidence intervals and confidence bands for the Kaplan-Meier estimator 
    are implemented in the
km.ci
          package.
plot.Surv          of package
eha
          plots
    the Kaplan-Meier estimator.
svykm
          in
survey
          provides a weighted Kaplan-Meier 
    estimator.
nested.km
          in
NestedCohort
          estimates the 
    survival curve for each level of categorical variables with missing data.
    The
kaplan-meier
          function in
spatstat
          computes the Kaplan-Meier estimator from histogram data.
    The
MAMSE
          package permits to compute a weighted Kaplan-Meier estimate.
    The
KM
          function in package
rhosp
          plots the survival 
    function using a variant of the Kaplan-Meier estimator in a hospitalisation 
    risk context.
    The
survPresmooth
          package computes presmoothed estimates of the main quantities used 
    for right-censored data, i.e., survival, hazard and density functions.
A: The bootkm() function in Hmisc provides bootstraped estimate of the probability of survival, as well as the estimate of the quantile of the survival distribution (through either describe or quantile applied onto the result of bootkm).
A: The other answers are correct, but needlessly complicated, IMHO. It’s actually very easy to do this in R:
# We need the ‘survival’ package
library(survival)

# Estimate some sample data
n = 1000
x = rexp(n)
status = rep(1,n)

# Fit model
kfit = survfit(Surv(x, status) ~ 1)
kfit

The output is:
Call: survfit(formula = Surv(x, status) ~ 1)

       n   events   median  0.95LCL  0.95UCL 
1000.000 1000.000    0.720    0.670    0.777 

So the estimate of the median is 0.72, with a 95% confidence interval of 0.67–0.77. (The theoretical value for these data is qexp(.5) ≈ 0.69). If you want to extract the numbers for later use, or estimate other percentiles, you can use:
# Estimate and CI for the median
quantile(kfit, 0.5)

Change the 0.5 to calculate point estimates and CIs for other percentiles (e.g. to 0.75 for the upper quartile).
To estimate the mean, you can use print(kfit, print.rmean=TRUE), but do read ?print.survfit beforehand. What you’re asking for may not make sense if you have censored observation times.
