Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cal.window

Calendar time cut of survival data


Description

For a given time interval, each spell is cut so that it fully lies in the given time interval

Usage

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

Arguments

dat

Input data frame. Must contain survival data and a birth date.

window

Vector of length two; the time interval

surv

Vector of length four 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

Author(s)

Göran Broström

See Also

Examples

dat <- data.frame(enter = 0, exit = 5.731, event = 1,
birthdate = 1962.505, x = 2)
window <- c(1963, 1965)
dat.trim <- cal.window(dat, window)

eha

Event History Analysis

v2.10.0
GPL (>= 2)
Authors
Göran Broström [aut, cre], Jianming Jin [ctb]
Initial release
2022-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.