Transform a "survival data frame" to tabular form aggregating number of events and exposure time by time intervals and covariates.
toTpch(formula, data, cuts, enter = "enter", exit = "exit",
event = "event", episode = "age")
A data frame with exposure time and number of events aggregated by time intervals and covariates. If all covariates are factors,this usually results in a huge reduction of the size of thedata frame, but otherwise the size of the output may be larger than the size of the input data frame
A model formula.
A data frame with survival data.
An ordered, non-negative vector of time points at which a hazard function changes value. Note that data are left truncated at cuts[1] (the smallest value) and right censored at c[n], where n is the length of cuts and cuts[n] == max(cuts).
Character string with the name of the variable representing left truncation values.
Character string with the name of the event/censoring time variable.
Character string with the name of the event indicator variable.
Character string with the name of the output variable of the grouped time (a factor variable).
Göran Broström
If cuts
is missing, nothing is done. Internally, this function first calls
survival::survSplit
and then stats::aggregate
.