tdc_stat: stats for tdc

Description Usage Arguments Value

View source: R/tdc_functions.R

Description

Attempt to describe a time dependent covariate (tdc). survival::tmerge creates time periods (per patient) starting at 'tstart' and ending at 'tstop'. This function calculates a statistic at each time point of interest (set of all distinct time points starting or ending an interval). For each such point, the values of a tdc is gathered to calculate a statistic (determined by argument 'stat').

Usage

1
tdc_stat(x, var, stat, stat.names = NULL, tstart = "tstart", tstop = "tstop")

Arguments

x

data frame with time periods starting at tstart, ending at tstop.

var

name of variable of interest

stat

function to calculate stat. Note: can return a vector

stat.names

names of columns created, if set to NULL, the function will provide them

tstart

name of variable acting as tstart

tstop

name of variable acting as tstop

Value

a data frame


renlund/dm documentation built on Jan. 18, 2022, 9:50 a.m.