Learn R Programming

survMisc (version 0.4.6)

plot.Surv: Plot Survival object

Description

Plots an object of class Surv. Different methods apply to different types of Surv objects.

Usage

## S3 method for class 'Surv':
plot(x, l = 3, ...)

Arguments

x
A Surv object
l
Length of arrow. Length is l/nrow(x)
...
Additional arguments. These are passed to graphics::arrows when drawing right- or left-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") :
  • countingLines with an arrow pointing right if right censored
  • rightLines with an arrow pointing right if right censored
  • leftLines with an arrow pointing left if left censored
  • intervalIf censored:
    • Lines with an arrow pointing right if right censored.
    • Lines with an arrow pointing left if left censored.
    If not censored:
    • Lines if observations of more than one time point
    • Points if observation of one time only (i.e. start and end times are the same)

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