admin_censor_cmprisk: admin_censor_cmprisk

View source: R/fan_util_fun.R

admin_censor_cmpriskR Documentation

admin_censor_cmprisk

Description

admin_censor_cmprisk

Usage

admin_censor_cmprisk(
  df,
  evt_time,
  evt,
  adm_cnr_time = NULL,
  evt_label = NULL,
  overwrite_var = FALSE
)

Arguments

df

input data

evt_time

a numeric vector recording the time points at which the event occurs.

evt

a factor vector indicating right censoring (0= censored; 1= event of interest; other= competing risk(s)).

adm_cnr_time

a numeric vector specifying the time point at which administrative censoring is applied.

evt_label

a numeric vector specifying the time point at which administrative censoring is applied.

overwrite_var

a logical scalar (default= FALSE) indiciates if the existing time-to-event variables should be overwritten.

Details

The function creates time-to-event variables with the application of administrative censoring for a competing risk analysis. The newly created variables are named by the same variables names but with a suffix of '_adm' by default. The original variables can be overwritten by specifying overwrite_var= TRUE. Overwriting the original variables is not recommended, but it can be useful in some situation.

Value

The input data plus censored time-to-event variables.

Examples

cmprisk_df<- read.csv2("http://www.stat.unipg.it/luca/misc/bmt.csv")
admin_censor_cmprisk(cmprisk_df, ftime, status, evt_label = c("0"= "Event free", "1"= "Event", "2"= "Competing event"), adm_cnr_time= 10)

fanstev1/fanetc documentation built on April 17, 2025, 10:58 a.m.