Surv-methods {survival} | R Documentation |

## Methods for Surv objects

### Description

The list of methods that apply to `Surv`

objects

### Usage

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

### Arguments

`x` |
a |

`probs` |
a vector of probabilities |

`na.rm` |
remove missing values from the calculation |

`value` |
a character vector of up to the same length as |

`...` |
other arguments to the method |

### Details

These functions extend the standard methods to `Surv`

objects.
(There is no central index of R methods, so there may well be useful
candidates that the author has missed.)
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

`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:8, 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

`xtfrm`

method, which underlies sort and order, sorts by time, with censored after uncensored within a tied time. For an interval censored observation the midpoint is used. For (time1, time2) counting process data, sorting is by time2, censoring, and then time1.The

`unique`

method treats censored and uncensored observations at the same time as distinct, it returns a Surv object.The concatonation method

`c()`

is asymmetric, its first argument determines the execution path. For instance`c(Surv(1:4), Surv(5:6))`

will return a Surv object of length 6,`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)))`

which is a numeric of length 10.

### See Also

*survival*version 3.7-0 Index]