1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/S3_definitions.R
\name{plot.survtab}
\alias{plot.survtab}
\title{\code{plot} method for survtab objects}
\usage{
\method{plot}{survtab}(
x,
y = NULL,
subset = NULL,
conf.int = TRUE,
col = NULL,
lty = NULL,
ylab = NULL,
xlab = NULL,
...
)
}
\arguments{
\item{x}{a \code{survtab} output object}
\item{y}{survival a character vector of a variable names to plot;
e.g. \code{y = "r.e2"}}
\item{subset}{a logical condition; \code{obj} is subset accordingly
before plotting; use this for limiting to specific strata,
e.g. \code{subset = sex == "male"}}
\item{conf.int}{logical; if \code{TRUE}, also plots any confidence intervals
present in \code{obj} for variables in \code{y}}
\item{col}{line colour; one value for each stratum; will be recycled}
\item{lty}{line type; one value for each stratum; will be recycled}
\item{ylab}{label for Y-axis}
\item{xlab}{label for X-axis}
\item{...}{additional arguments passed on to \code{plot} and
\code{lines.survtab}; e.g. \code{ylim} can be defined this way}
}
\value{
Always returns \code{NULL} invisibly.
This function is called for its side effects.
}
\description{
Plotting for \code{survtab} objects
}
\examples{
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))
}
\seealso{
Other survtab functions:
\code{\link{Surv}()},
\code{\link{lines.survtab}()},
\code{\link{print.survtab}()},
\code{\link{summary.survtab}()},
\code{\link{survtab}()},
\code{\link{survtab_ag}()}
}
\author{
Joonas Miettinen
}
\concept{survtab functions}
|