R script to generate a survival plot

By bradyo on 02 April 2010
tags: survival, R, plot

This script generates a survival plot png image from a vector of lifespans.

Open up R and source the script, then call the makeSurvivalPlot function.

Example usage:

source("/pathToScript/makeSurvivalPlot.R");
lifespans = c(22,33,21,15,27,17,23,27,18,18,44,35,27,26,
    31,21,32,24,16,23,28,9,14,44,26,23,26,23,6,37,
    14,40,24,28,25,21,33,31,20,39);
makeSurvivalPlot("output.png", "BY4742", lifespans, "days", 500, 300);

This will generate the output.png file: