View source: R/S3_definitions.R
| lines.survtab | R Documentation | 
lines method for survtab objectsPlot lines from a survtab object
## S3 method for class 'survtab'
lines(x, y = NULL, subset = NULL, conf.int = TRUE, col = NULL, lty = NULL, ...)
| x | a  | 
| y | a variable to plot; a quoted name of a variable
in  | 
| subset | a logical condition;  | 
| conf.int | logical; if  | 
| col | line colour passed to  | 
| lty | line type passed to  | 
| ... | additional arguments passed on to to a  | 
Always returns NULL invisibly.
This function is called for its side effects.
Joonas Miettinen
Other survtab functions: 
Surv(),
plot.survtab(),
print.survtab(),
summary.survtab(),
survtab(),
survtab_ag()
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.