Learn R Programming

pammtools (version 0.8.1)

reconstruct_cutpoints: Ensure all breakpoints are present in newdata for cumulative calculations

Description

Checks whether all cut points up to the maximum observed time are present in newdata. If not, expands the data frame to include the missing breakpoints via expand_df. In either case the function guarantees that an interval-length column (default intlen) exists on return. Existing grouping is preserved after expansion.

Usage

reconstruct_cutpoints(newdata, object, time_var, interval_length)

Value

A data frame with all required breakpoints present and an interval_length column guaranteed to exist.

Arguments

newdata

A data frame with a time column and, optionally, grouping. Must carry the trafo_args and intvars attributes set by as_ped.

object

A fitted PAM/PAMM model object, passed to expand_df.

time_var

Character name of the time variable (e.g. "tend").

interval_length

Character name of the interval-length column. If absent from newdata it is created via reconstruct_intlen.