age.window: Age cut of survival data

View source: R/age.window.R

age.windowR Documentation

Age cut of survival data

Description

For a given age interval, each spell is cut to fit into the given age interval.

Usage

age.window(dat, window, surv = c("enter", "exit", "event"))

Arguments

dat

Input data frame. Must contain survival data.

window

Vector of length two; the age interval.

surv

Vector of length three giving the names of the central variables in 'dat'.

Details

The window must be in the order (begin, end)

Value

A data frame of the same form as the input data frame, but 'cut' as desired. Intervals exceeding window[2] will be given event = 0. If the selection gives an empty result, NULL is returned, with no warning.

Author(s)

Göran Broström

See Also

cal.window, coxreg, aftreg

Examples


dat <- data.frame(enter = 0, exit = 5.731, event = 1, x = 2)
window <- c(2, 5.3)
dat.trim <- age.window(dat, window)  


eha documentation built on Oct. 7, 2024, 1:17 a.m.