Surv-methods

0th

Percentile

Methods for Surv objects

The list of methods that apply to Surv objects

Keywords
survival
Usage
# S3 method for Surv
anyDuplicated(x, ...)
    # S3 method for Surv
as.character(x, ...)
    # S3 method for Surv
as.data.frame(x, ...)
    # S3 method for Surv
as.integer(x, ...)
    # S3 method for Surv
as.matrix(x, ...)
    # S3 method for Surv
as.numeric(x, ...)
    # S3 method for Surv
c(...)
    # S3 method for Surv
duplicated(x, ...)
    # S3 method for Surv
format(x, ...)
    # S3 method for Surv
head(x, ...)
    # S3 method for Surv
is.na(x)
    # S3 method for Surv
length(x)
    # S3 method for Surv
mean(x, ...)
    # S3 method for Surv
median(x, ...)
    # S3 method for Surv
names(x)
    # S3 method for Surv
names(x) <- value
    # S3 method for Surv
quantile(x, probs, na.rm=FALSE, ...)
    # S3 method for Surv
plot(x, ...)
    # S3 method for Surv
rep(x, ...)
    # S3 method for Surv
rep.int(x, ...)
    # S3 method for Surv
rep_len(x, ...)
    # S3 method for Surv
rev(x)
    # S3 method for Surv
t(x)
    # S3 method for Surv
tail(x, ...)
    # S3 method for Surv
unique(x, ...)
Arguments
x

a Surv object

probs

a vector of probabilities

na.rm

remove missing values from the calculation

value

a character vector of up to the same length as x, or NULL

other arguments to the method

Details

These functions extend the standard methods to Surv objects. The arguments and results from these are mostly as expected, with the following further details:

  • The as.character function uses "5+" for right censored at time 5, "5-" for left censored at time 5, "[2,7]" for an observation that was interval censored between 2 and 7, "(1,6]" for a counting process data denoting an observation which was at risk from time 1 to 6, with an event at time 6, and "(1,6+]" for an observation over the same interval but not ending with and event. For a multi-state survival object the type of event is appended to the event time using ":type".

  • The print and format methods make use of as.character.

  • The as.numeric and as.integer methods perform these actions on the survival times, but do not affect the censoring indicator.

  • The as.matrix and t methods return a matrix

  • The length of a Surv object is the number of survival times it contains, not the number of items required to encode it, e.g., x <- Surv(1:4, 5:9, c(1,0,1,0)); length(x) has a value of 4. Likewise names(x) will be NULL or a vector of length 4. (For technical reasons, any names are actually stored in the rownames attribute of the object.)

  • For a multi-state survival object levels returns the names of the endpoints, otherwise it is NULL.

  • The median, quantile and plot methods first construct a survival curve using survfit, then apply the appropriate method to that curve.

  • The concatonation method c() is asymmetric, its first argument determines the exection path. For instance c(Surv(1:4), Surv(5:6)) will concatonate the two objects, c(Surv(1:4), 5:6) will give an error, and c(5:6, Surv(1:4)) is equivalent to c(5:6, as.vector(Surv(1:4))).

See Also

Surv

Aliases
  • Math.Surv
  • Ops.Surv
  • Summary.Surv
  • anyDuplicated.Surv
  • as.character.Surv
  • as.data.frame.Surv
  • as.integer.Surv
  • as.matrix.Surv
  • as.numeric.Surv
  • c.Surv
  • duplicated.Surv
  • format.Surv
  • head.Surv
  • is.na.Surv
  • length.Surv
  • mean.Surv
  • median.Surv
  • names.Surv
  • names<-.Surv
  • quantile.Surv
  • plot.Surv
  • rep.Surv
  • rep.int.Surv
  • rep_len.Surv
  • rev.Surv
  • t.Surv
  • tail.Surv
  • unique.Surv
Documentation reproduced from package survival, version 3.1-8, License: LGPL (>= 2)

Community examples

Looks like there are no examples yet.