truncate_interval: Truncate survival times

View source: R/utils.R

truncate_intervalR Documentation

Truncate survival times

Description

Function to truncate survival times in a time interval, for investiganting survival probabilities changes in time.

Usage

truncate_interval(data, time_int, startDate, endDate, censor)

Arguments

data

data.frame

time_int

lubridate::interval output, with the time intervel where the survival times will be truncated

startDate

name of the column in data with the birth date of each subject (birth date can be seen as policy begin)

endDate

name of the column in data with the death/censor date of each subject

censor

name of the column with the censoring status. 1 if endDate is a death date, or 0 if endDate is a censor date. if endDate is later than interval end, then the end date will be the interval end and the status will be censor.

Value

a data.table with the extra columns: event, dataInicio, dataFim, tempoInicio, tempoFim


vitorcapdeville/survtools documentation built on Feb. 12, 2023, 12:01 p.m.