|
a |
|
b/man/addNrisk.Rd |
|
|
1 |
\name{addNrisk} |
|
|
2 |
\alias{addNrisk} |
|
|
3 |
\title{Add number-at-risk annotations to a plot} |
|
|
4 |
\description{ |
|
|
5 |
Add number-at-risk (NAR) annotations to an existing survival plot, underneath the X-axis. |
|
|
6 |
} |
|
|
7 |
\usage{ |
|
|
8 |
addNrisk(x, at = axTicks(1), |
|
|
9 |
line = 4, hadj = 0.5, |
|
|
10 |
title = "Number at risk", title.adj = 0, |
|
|
11 |
labels, hoff = 5, col = 1) |
|
|
12 |
} |
|
|
13 |
\arguments{ |
|
|
14 |
\item{x}{A list as returned by \code{\link{survfit}}.} |
|
|
15 |
\item{at}{Time points at which the NAR values are calculated and placed.} |
|
|
16 |
\item{line}{Number of lines into the margin to start displaying the NAR. } |
|
|
17 |
\item{hadj}{Horizontal adjustment for the NAR values.} |
|
|
18 |
\item{title}{Optional title above the NAR.} |
|
|
19 |
\item{title.adj}{Text adjustment for the title} |
|
|
20 |
\item{labels}{Labels for each stratum.} |
|
|
21 |
\item{hoff}{Horizontal offset for the labels} |
|
|
22 |
\item{col}{Color for each stratum.} |
|
|
23 |
} |
|
|
24 |
\details{ |
|
|
25 |
This function was written and documented by Aron Charles Eklund in his package |
|
|
26 |
survplot version 0.0.7. |
|
|
27 |
} |
|
|
28 |
\value{Invisibly, a matrix containing the number-at-risk values} |
|
|
29 |
\author{Aron Charles Eklund (survplot version 0.0.7)} |
|
|
30 |
\seealso{ |
|
|
31 |
See \code{\link{nrisk}} to retrieve number-at-risk values without plotting them. |
|
|
32 |
See also \code{\link{survplot}}. |
|
|
33 |
} |
|
|
34 |
\examples{ |
|
|
35 |
library(survival) |
|
|
36 |
s <- Surv(colon$time / 365, colon$status) |
|
|
37 |
|
|
|
38 |
## Need to increase margins a bit |
|
|
39 |
par(mar = c(10,6,2,1)) |
|
|
40 |
|
|
|
41 |
## no stratification |
|
|
42 |
fit1 <- survfit(s ~ 1) |
|
|
43 |
plot(fit1) |
|
|
44 |
addNrisk(fit1) |
|
|
45 |
|
|
|
46 |
## with stratification |
|
|
47 |
fit2 <- survfit(s ~ rx, data = colon) |
|
|
48 |
plot(fit2, xlab = 'Time (years)', ylab = 'Survival') |
|
|
49 |
addNrisk(fit2) |
|
|
50 |
|
|
|
51 |
} |
|
|
52 |
\keyword{ survival } |
|
|
53 |
\keyword{ aplot } |