addCenTime: Add censored time equal to 0

Description Usage Arguments Value Examples

Description

Add a new line to the dataframe with a censored time equal to 0 when the end of follow-up coincides to the last occurrence

Usage

1
addCenTime(datin)

Arguments

datin

Dataframe containing id, time and event variables. Another covariates are allowed

Value

A data frame with an added line (censored time equal to 0) for those subjects where the end of follow-up coincides to the last occurrence

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
data(bladder, package="survival")

# we compute the interocurrence time
bladder2$time<-bladder2$stop-bladder2$start


# If we execute:
#     gcmrec(Survr(id,time,event)~rx+size+number,data=bladder2,s=2060)

# We will obtain the following error message:
#   Error in Survr(id, time, event) : Data doesn't match... 


# This means that we have some patients without right-censoring time. So,
# we understand that the last event coincides with the end of study. 
# Consequently,we need to add a line with time 0 and status value equal 
# to 0, too. To do so, we can use the function "addCenTime" as follows:


# for example:
#   bladder2[bladder2$id==12,]

#     id rx number size start stop event enum time
#  45 12  1      1    1     0    3     1    1    3
#  46 12  1      1    1     3   16     1    2   13
#  47 12  1      1    1    16   23     1    3    7

# there is no censored time for 12th patient. So, if we execute

bladderOK<-addCenTime(bladder2) 


# we would get

#      id rx number size start stop event enum time
#  45  12  1      1    1     0    3     1    1    3
#  46  12  1      1    1     3   16     1    2   13
#  47  12  1      1    1    16   23     1    3    7
#  471 12  1      1    1    16   23     0    3    0

isglobal-brge/gcmrec documentation built on May 18, 2019, 5:50 a.m.