nrisk: Get number-at-risk from a survfit object

Description Usage Arguments Value See Also Examples

Description

Retrieve the number-at-risk from a survfit object for the specified times, for each strata.

Usage

1
nrisk(x, times = pretty(x$time))

Arguments

x

An object of type survfit.

times

The timepoints of interest.

Value

A matrix indicating the number-at-risk for each timepoint (columns) and stratum (rows).

See Also

surviplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  

data(colon)
surv <- Surv(colon$time, colon$status)

## example with stratification
nrisk(survfit(surv ~ colon$rx))

## example without stratification
nrisk(survfit(surv ~ 1))

aroneklund/surviplot documentation built on May 10, 2019, 1:47 p.m.