Learn R Programming

greport (version 0.5-3)

survReport: Survival Report

Description

Generate a Survival Report with Kaplan-Meier Estimates

Usage

survReport(formula, data = NULL, subset = NULL, na.action = na.retain,
  ylab = NULL, what = c("S", "1-S"), conf = c("diffbands", "bands",
  "bars", "none"), panel = "surv", subpanel = NULL, head = NULL,
  tail = NULL, h = 3, w = 4.5, multi = FALSE, mfrow = NULL,
  y.n.risk = 0, bot = 2, aehaz = TRUE, times = NULL, append = FALSE,
  ...)

Arguments

formula
a formula with survival (Srv) objects on the left hand side and an optional stratification factor on the right (or 1 if none). The survival object component variables should be labeled; these labels are used for graph annotation
data
data.frame
subset
optional subsetting criteria
na.action
function for handling NAs while creating a data frame
ylab
character. Passed to survplot.npsurv as the ylab argument. Constructed by default.
what
"S" (the default) to plot survival functions or "1-S" to plot cumulative incidence functions.
conf
character. See survplot.npsurv.
panel
character string. Name of panel, which goes into file base names and figure labels for cross-referencing.
subpanel
character string. If calling dReport more than once for the same type of chart (categorical or continuous), specify subpanel to distinguish the multiple calls. In that case, -subpanel will be appended to pane
head
character string. Specifies initial text in the figure caption, otherwise a default is used.
tail
optional character string. Specifies final text in the figure caption, e.g., what might have been put in a footnote in an ordinary text page. This appears just before any needles.
h
numeric. Height of plots.
w
numeric. Width of plots in inches.
multi
logical. If TRUE, multiple figures are produced, othewise a single figure with a matrix of survival plots is made.
mfrow
numeric 2-vector, used if multi=FALSE. If not specified, default plot matrix layout will be figured.
y.n.risk
used if what="1-S", to specify y coordinate for putting numbers at risk, typically below the x-axis label
bot
number of spaces to reserve at bottom of plot for numbers at risk, if what="1-S"
aehaz
logical. Set to FALSE to not print number of events and hazard rate on plots.
times
numeric vector. If specified, prints cumulative incidence probabilities at those times on the plots.
append
logical. If TRUE output will be appended instead of overwritten.
...
ignored

Examples

Run this code
## See tests directory test.Rnw for a live example
set.seed(1)
  n <- 400
  dat <- data.frame(t1=runif(n, 2, 5), t2=runif(n, 2, 5),
                    e1=rbinom(n, 1, .5), e2=rbinom(n, 1, .5),
                    treat=sample(c('a','b','c'), n, TRUE))
  dat <- upData(dat,
                labels=c(t1='Time to operation',
                         t2='Time to rehospitalization',
                         e1='Operation', e2='Hospitalization',
                         treat='Treatment')
                units=c(t1='year', t2='year'))
  survReport(Srv(t1, e1) + Srv(t2, e2) ~ treat, data=dat)

Run the code above in your browser using DataLab