This paper shows how to use R language and environment for statistical computing and graphics to analyze survival data. R was chosen for this purpose because it is a powerful statistical tool, has functions that other commercial statistical software does not have, and it is also free to use. The paper presents how to organize data for survival analysis; how to import it in R; how to describe survival data; how to estimate and plot the distribution of lifetimes; how to test for differences in survival between groups; how to do semi parametric Cox proportional hazard regression; parametric exponential or Weibull regressions; and accelerated failure time regressions; how to diagnose Cox regression to check for proportional hazard assumption, to identify influential observations, and to identify nonlinearity; how to use interaction, stratification and time dependent covariates in Cox regression models in R. The paper also presents the assumptions for the methods described and some important theoretical or more practical issues linked to analysis of survival data such as censoring, or truncation.


R language and environment, Survival analysis.