Learn R Programming

Epi (version 0.7.0)

fcut1: Cut follow-up time at a failure time.

Description

This function cuts the follow-up time at a failure allowing a person to stay at risk after the failure. It is aimed at processing of recurrent events. Failure times outside the interval (enter,exit) are ignored.

Usage

fcut1( enter, exit, fail, dof, fail.value = 1, 
         data = data.frame(enter, exit, fail, dof),
       Expand = 1:nrow(data) )

Arguments

enter
Date of entry into the study. Numerical vector.
exit
Date of exit from the study. Numerical vector.
fail
Failure indicator for the exit date.
dof
Date of failure. Numerical vector. Missing for persons who do not have an event.
fail.value
Value for failure indicator Fail at the date dof.
data
Dataframe of variables to be carried unchanged to the output.
Expand
Variable identifying original records.

Value

  • A dataframe with the same columns as in data, preceded by the columns:
  • ExpandIdentification of the rows from the input dataframe.
  • EnterEntry date for the interval.
  • ExitExit date for the interval.
  • FailFailure indicator for the interval.

See Also

Lexis, isec, fcut1, fcut, 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 and failure times
fail <- sample( 0:1, 15, replace=TRUE, prob=c(0.7,0.3) )
dof <- sample( c(one,two), 15 )
# So what have we got
data.frame( doe, dox, fail, dof )
# Cut follow-up at dof
fcut1( doe, dox, fail, dof )

Run the code above in your browser using DataLab