get_nrisk_tbl: Returns a Number At Risk Table from a survfit Object

Description Usage Arguments Value Author(s) Examples

View source: R/get_nrisk_tbl.R

Description

This function generates a number at risk table that typically seen in publications.

Usage

1
get_nrisk_tbl(sfit, timeby)

Arguments

sfit

A survival::survfit object.

timeby

The "step" in which to calculate the risk.

Value

A data.frame with the number of risks at each timeby step.

Author(s)

Abhijit Dasgupta https://gist.github.com/araastat/9927677.

Examples

1
2
fit <- survival::survfit(survival::Surv(time,status) ~ rx, data = survival::colon)
get_nrisk_tbl(fit, timeby = 500)

Example output

       strata time n.risk
1      rx=Obs    0    630
2      rx=Obs  500    470
3      rx=Obs 1000    372
4      rx=Obs 1500    315
5      rx=Obs 2000    256
6      rx=Obs 2500     90
7      rx=Obs 3000     11
8      rx=Lev    0    620
9      rx=Lev  500    464
10     rx=Lev 1000    360
11     rx=Lev 1500    318
12     rx=Lev 2000    266
13     rx=Lev 2500    107
14     rx=Lev 3000      8
15 rx=Lev+5FU    0    608
16 rx=Lev+5FU  500    498
17 rx=Lev+5FU 1000    425
18 rx=Lev+5FU 1500    387
19 rx=Lev+5FU 2000    328
20 rx=Lev+5FU 2500    127
21 rx=Lev+5FU 3000     14

survutils documentation built on July 23, 2018, 1:02 a.m.