ggkm: Generate Kaplan-Meier plot using ggplot2 and gridExtra

Description Usage Arguments Value Author(s) Source Examples

Description

Given a survfit object produced by the survfit function, ggkm will produce an attractive Kaplan-Meier plot, with an optional table summarizing the number of individuals at risk along the footer of the plot.

Usage

1
2
3
ggkm(sfit, table = FALSE, xlabs = "Time", ylabs = "survival probability", 
ystratalabs = NULL, ystrataname = NULL, timeby = NULL, main = "Kaplan-Meier Plot", 
pval = TRUE)

Arguments

sfit

An object produced by the survfit function.

table

Boolean value; if true, a table with number at risk is appended to the bottom of the plot. Default is FALSE.

xlabs

Character string used to label x-axis.

ylabs

Character string used to label y-axis.

ystrataname

Character string used to name strata legend; if not supplied, "Strata" is used instead.

timeby

Specifies interval used to define breakpoints for at-risk table.

main

Character string used to title finished plot; if not specified, default is "Kaplan-Meier Plot".

pval

Boolean value; if true, the P-value for the chi-square (log-rank) test of equality performed by survdiff is printed on the finished plot. Default is TRUE.

Value

Produces a plot created with ggplot2.

Author(s)

Abhijit Dasgupta, Gary Collins, Gil Tomas, Mark Cowley, Dieter Menne

Source

https://statbandit.wordpress.com/2011/03/08/an-enhanced-kaplan-meier-plot/

https://statbandit.wordpress.com/2014/04/01/kaplan-meier-plots-using-ggplots2-updated/

https://github.com/dmenne/dmisc2/tree/master

Examples

1
2
3
4
5
6
7
8
require(survival)
mfit <- survfit(Surv(futime, death) ~ sex, data=mgus)

# no table of individuals at-risk
ggkm(mfit)

# with table of individuals at-risk
ggkm(mfitm, table = TRUE)

rpkyle/epimisc documentation built on May 31, 2019, 5:43 a.m.