plot method for survtab objects

Share:

Description

Plotting for survtab objects

Usage

1
2
3
## S3 method for class 'survtab'
plot(x, y = NULL, subset = NULL, conf.int = TRUE,
  col = NULL, lty = NULL, ylab = NULL, xlab = NULL, ...)

Arguments

x

a survtab output object

y

survival a character vector of a variable names to plot; e.g. y = "r.e2"

subset

a logical condition; obj is subset accordingly before plotting; use this for limiting to specific strata, e.g. subset = sex == "male"

conf.int

logical; if TRUE, also plots any confidence intervals present in obj for variables in y

col

line colour; one value for each stratum; will be recycled

lty

line type; one value for each stratum; will be recycled

ylab

label for Y-axis

xlab

label for X-axis

...

additional arguments passed on to plot and lines.survtab; e.g. ylim can be defined this way

Author(s)

Joonas Miettinen

See Also

Other survtab_related: lines.survtab, print.survtab, summary.survtab, survtab_ag, survtab

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(sire)
data(sibr)
si <- rbind(sire, sibr)
si$period <- cut(si$dg_date, as.Date(c("1993-01-01", "2004-01-01", "2013-01-01")), right = FALSE)
si$cancer <- c(rep("rectal", nrow(sire)), rep("breast", nrow(sibr)))
x <- lexpand(si, birth = bi_date, entry = dg_date, exit = ex_date, 
             status = status %in% 1:2, 
             fot = 0:5, aggre = list(cancer, period, fot))
st <- survtab_ag(fot ~ cancer + period, data = x, 
                 surv.method = "lifetable", surv.type = "surv.obs")

plot(st, "surv.obs", subset = cancer == "breast", ylim = c(0.5, 1), col = "blue")
lines(st, "surv.obs", subset = cancer == "rectal", col = "red")

## or
plot(st, "surv.obs", col = c(2,2,4,4), lty = c(1, 2, 1, 2))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.