event.split: EventSplit (SurvSplit).

Description Usage Arguments Author(s) Examples

View source: R/event.split.r

Description

contstructs start stop formulation of event time data after a variable in the data.set. Similar to SurvSplit of the survival package but can also split after random time given in data frame.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
event.split(
  data,
  time = "time",
  status = "status",
  cuts = "cuts",
  name.id = "id",
  name.start = "start",
  cens.code = 0,
  order.id = TRUE,
  time.group = FALSE
)

Arguments

data

data to be split

time

time variable.

status

status variable.

cuts

cuts variable or numeric cut (only one value)

name.id

name of id variable.

name.start

name of start variable in data, start can also be numeric "0"

cens.code

code for the censoring.

order.id

order data after id and start.

time.group

make variable "before"."cut" that keeps track of wether start,stop is before (1) or after cut (0).

Author(s)

Thomas Scheike

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(1)
d <- data.frame(event=round(5*runif(5),2),start=1:5,time=2*1:5,
		status=rbinom(5,1,0.5),x=1:5)
d

d0 <- event.split(d,cuts="event",name.start=0)
d0

dd <- event.split(d,cuts="event")
dd
ddd <- event.split(dd,cuts=3.5)
ddd
event.split(ddd,cuts=5.5)

### successive cutting for many values 
dd <- d
for  (cuts in seq(2,3,by=0.3)) dd <- event.split(dd,cuts=cuts)
dd

timereg documentation built on Oct. 13, 2021, 5:06 p.m.

Related to event.split in timereg...