Learn R Programming

clinpubr (version 1.1.1)

calc_cindex: Calculate C-index for survival data

Description

Calculate C-index for survival data. It's a wrapper function for Hmisc::rcorr.cens().

Usage

calc_cindex(data, time_var, event_var, marker_var)

Value

The C-index value.

Arguments

data

A data frame containing the survival time, event indicator, and marker variable.

time_var

A string specifying the name of the survival time variable in the data frame.

event_var

A string specifying the name of the event indicator variable in the data frame.

marker_var

A string specifying the name of the marker variable in the data frame.

Examples

Run this code
# Calculate C-index using lung dataset from survival package
data(cancer, package = "survival")
# Use age as the marker variable
calc_cindex(lung, "time", "status", "age")

Run the code above in your browser using DataLab