surv2df: Convert a survival object to a data frame with censored...

View source: R/utils.R

surv2dfR Documentation

Convert a survival object to a data frame with censored survival data.

Description

Converts a survival object (class 'Surv') to a data frame with unique time points and event indicators. The function accounts for censoring, i.e. observations censored at a particular time point i do not appear at the time point i + 1.

Usage

surv2df(surv_object)

Arguments

surv_object

and instance of the 'Surv' class.

Value

a data frame with the following columns:

  • 'time': unique time point inferred from the survival object.

  • '.observation': index of the observation in the input survival object.

  • 'status': event index as indicated in the survival object


PiotrTymoszuk/coxExtensions documentation built on Feb. 6, 2024, 10:58 p.m.