Description Usage Arguments Author(s) Examples
Creates a Kaplan-Meier plot with at risk tables below
1 2 3 4 5 6 | ggkm(sfit, table = FALSE, xlabs = "Time-to-event",
ylabs = "Survival (%)", xlims = c(0, max(sfit$time)), ylims = c(0, 1),
ystratalabs = names(sfit$strata), ystrataname = "Strata",
timeby = signif(max(sfit$time)/7, 1), main = "", pval = FALSE,
marks = TRUE, shape = 3, legend = TRUE, legendposition = c(0.85, 0.8),
ci = FALSE, subs = NULL, linecols = "Set1", dashed = FALSE, ...)
|
timeby |
numeric: control the granularity along the time-axis; defaults to 7 time-points. Default = signif(max(sfit$time)/7, 1) |
main |
plot title |
pval |
logical: add the pvalue to the plot? |
marks |
logical: should censoring marks be added? |
subs |
= NULL, |
sfit: |
a survfit object |
table: |
logical: Create a table graphic below the K-M plot, indicating at-risk numbers? |
xlabs: |
x-axis label |
ylabs: |
y-axis label |
xlims: |
numeric: list of min and max for x-axis. Default = c(0,max(sfit$time)) |
ylims: |
numeric: list of min and max for y-axis. Default = c(0,1) |
ystratalabs: |
character list. A list of names for each strata. Default = names(sfit$strata) |
ystrataname: |
The legend name. Default = "Strata" |
shape: |
what shape should the censoring marks be, default is a vertical line |
legend: |
logical. should a legend be added to the plot? |
legendposition: |
numeric. x, y position of the legend if plotted. Default=c(0.85,0.8) |
ci: |
logical. Should confidence intervals be plotted. Default = FALSE |
linecols: |
Character. Colour brewer pallettes too colour lines. Default ="Set1", |
dashed: |
logical. Should a variety of linetypes be used to identify lines. Default = FALSE |
Michael Way, but heavily modified version of a script created by Abhijit Dasgupta with contributions by Gil Tomas. http://statbandit.wordpress.com/2011/03/08/an-enhanced-kaplan-meier-plot/ I have packaged this function, added functions to namespace and included a range of new parameters.
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.