ggsurv: KM Curves with ggplot generic function to create a ggplot...

Usage Arguments Examples

View source: R/ggsurv.R

Usage

1
ggsurv(s, ...)

Arguments

s

survival object

CI

include confidence interval (default TRUE)

plot.cens

plot marks to indicate a censored subject (default TRUE)

surv.col

colors to use for survival curves. Should match number of groups.

cens.col

color of censor marks

cens.shape

shape of censor marks

lty.est

line type for survival curve

lty.ci

line type for confidence interval

xlab

label for x axis (default 'Time')

ylab

label for y axis (default ”)

main

title for plot (default ”)

cumProb

plot cumulative probability instead of survival (default FALSE)

yTicks

number of ticks on the y axis

addCounts

add number still at risk above the x axis. This is an attempt to replicate SAS behavior. It does not always give good results (default FALSE)

bw

print in black and white (default FALSE)

legend_title

title to use for the legend

legend_pos

where to position the legend

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
require(survival)
sv1 <- with(ovarian, Surv(futime, fustat))

## fit intercept only survival
sf1 <- survfit(sv1 ~ 1, ovarian)
## basic km curve
ggsurv(sf1)
## cumulative probability instead of survival
ggsurv(sf1, cumProb=T)
## add in survival counts
ggsurv(sf1, cumProb=T, addCounts=T)

## fit model with two strata
sf2 <- survfit(sv1 ~ resid.ds, ovarian)
## basic km curve
ggsurv(sf2, CI=F)
## add in confidence intervals
ggsurv(sf2, CI=T)
## cumulative probability instead of survival
ggsurv(sf2, cumProb=T)
## add in survival counts
ggsurv(sf2, cumProb=T, addCounts=T)

jachan1/repFxns documentation built on May 18, 2018, 6:24 p.m.