Learn R Programming

survMisc (version 0.5.3)

plotSurv: Plot a Surv object.

Description

Plot a Surv object.

Usage

"plot"(x, l = 3, ...)

Arguments

x
A Surv object
l
length of arrow. Length is l / nrow(x)
...
Additional arguments. These are passed to as ... (an ellipsis) to the following functions, respectively:
graphics::arrows
for plotting right- or left-censored observations

graphics::segments
for plotting interval-censored observations

Value

A graph (base graphics). The type of graph depends on the type of the Surv object. This is given by attr(s, which="type") :
counting
Lines with an arrow pointing right if right censored.
right
Lines with an arrow pointing right if right censored.
left
Lines with an arrow pointing left if left censored.
interval
If censored:
arrow points right
right censored
arrow points left
left censored
If not censored:
lines
observations of more than one time point
points
observation of one time only (i.e. start and end times are the same)

See Also

?graphics::arrows

?graphics::segments

Examples

Run this code
df0 <- data.frame(t1=c(0, 2, 4, 6, NA, NA, 12, 14),
                  t2=c(NA, NA, 4, 6, 8, 10, 16, 18))
s5 <- Surv(df0$t1, df0$t2, type="interval2")
plot(s5)

Run the code above in your browser using DataLab