survReport: Survival Report

Description Usage Arguments References Examples

View source: R/todo/survReport.R View source: R/survReport.r

Description

Generate a Survival Report with Kaplan-Meier Estimates

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
survReport(
  formula,
  data = NULL,
  subset = NULL,
  na.action = na.retain,
  study = " ",
  ylab = NULL,
  what = c("1-S", "S"),
  conf = c("bands", "none"),
  cause = NULL,
  head = NULL,
  tail = NULL,
  h = 425,
  w = 675,
  mylim = NULL,
  aehaz = TRUE,
  times = NULL,
  opts = NULL,
  ...
)

Arguments

formula

a formula with survival (Surv) 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. If any of the Surv objects are competing risk objects (see Surv), event labels come from the factor levels in the variable that was the second argument to Surv, and the first factor level must correspond to right-censored observations.

data

data.frame

subset

optional subsetting criteria

na.action

function for handling NAs while creating a data frame

study

character string identifying the study; used in multi-study reports or where distinct patient strata are analyzed separately. Used to fetch the study-specific metadata stored by sethreportOption. Single study reports just use study=' '.

ylab

character. Passed to survplotp.npsurv as the ylab argument. Constructed by default.

what

"1-S" (the default) to plot cumulative incidence functions or "S" to plot cumulative survival functions. If any of the survival time objects on the left hand side are competing risk objects, "S" may not be used.

conf

character. See survplotp.npsurv.

cause

character vector or list. If a vector, every Surv term on the left hand side of formula will have cumulative incidence plotted for all causes that appear in cause. If a list, the list elements must correspond to the Surv terms in order, and specify which causes to display from the corresponding Surv object. When cause is a list and one of its elements contains more than one character string, or when cause is a vector and for one Surv object it matches multiple causes, survReport produces more plots than there are Surv objects.

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 in pixels.

w

numeric. Width of plots in pixels.

mylim

numeric 2-vector. Used to force expansion of computed y-axis limits. See survplotp.

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.

opts

list. A list specifying arguments to survReport that override any other arguments. This is useful when making a long series of survReport calls with the same options, as the options can be defined up front in a list.

...

ignored

References

Boers M (2004): Null bar and null zone are better than the error bar to compare group means in graphs. J Clin Epi 57:712-715.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# See tests directory test.Rnw for a live example
## Not run: 
  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'), 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(Surv(t1, e1) + Surv(t2, e2) ~ treat, data=dat)

  dat <- upData(dat, labels=c(t1='Follow-up Time', t2='Time'),
                cause=factor(sample(c('death','MI','censor'), n, TRUE),
                             c('censor', 'MI', 'death')))
  survReport(Surv(t1, cause) ~ treat, cause='death', data=dat)
  survReport(Surv(t1, cause) + Surv(t2, cause) ~ treat,
             cause=list(c('death', 'MI'), 'death'), data=dat)
  # Two plots for t1, one plot for t2

## End(Not run)

harrelfe/hreport documentation built on July 26, 2021, 9:09 a.m.