Epi (version 0.7.0)

ex1: Split follow-up time along a timescale

Description

Splits follow-up time at prespecified points of follow-up.

Usage

ex1( enter, exit, fail, origin = 0, scale = 1, breaks,
     data = data.frame(enter, exit, fail),
     Expand = 1:nrow(data) )

Arguments

enter
Date of entry einto the study (start of follow-up). Numeric.
exit
Date of termination of follow-up. Numeric.
fail
Status at exit from the study.
origin
Origin of the timescale to split on. Specified on the input timescale, i.e. that of enter and exit.
scale
Scaling between input and analysis timescale.
breaks
Breakpoints on the analysis timescale. Follow-up before min(breaks) and and ater max(breks) is discarded.
data
Dataframe of variables to carry over to the output.
Expand
Variable identifying original records.

Value

  • A dataframe with one row per follow-up interval, and variables as in data, preceded by the variables:
  • ExpandIdentification of the rows from the input dataframe.
  • EnterEntry date for the interval.
  • ExitExit date for the interval.
  • FailFailure indicator for end of the current interval.

Details

If entry and exit are given in days (for example as Date variables, and we want follow-up cut at 5-year age intervals, the we should choose origin equal to bithdate, scale equal to 365.25 and breaks as seq(0,100,5). Thus the input timescale is calendar tiem measured in days, and output timescale is age measured in years.

See Also

Lexis, isec, icut, fcut1, ex1

Examples

Run this code
one <- round( runif( 15, 0, 10 ), 1 )
two <- round( runif( 15, 0, 10 ), 1 )
doe <- pmin( one, two )
dox <- pmax( one, two )
# Goofy data rows to test possibly odd behaviour
doe[1:3] <- dox[1:3] <- 8
dox[2] <- 6
dox[3] <- 7.5
# Some failure indicators
fail <- sample( 0:1, 15, replace=TRUE, prob=c(0.7,0.3) )
# Split follow-up:
ex1( doe, dox, fail, breaks=0:10 )

Run the code above in your browser using DataLab