removeafter: Code to remove longitudinal information recorded after...

Description Usage Arguments Details Value See Also Examples

View source: R/removeafter.R

Description

This function is designed to remove any longitudinal information recorded after the survival time for each individual. If the survival event is not terminal, it is possible that longitudinal information is available in the data after the survival time, but it should not contribute to the joint analysis. This function takes and returns a jointdata object.

Usage

1
removeafter(data, longitudinal, survival, id, time)

Arguments

data

a jointdata object (see jointdata)

longitudinal

a character string denoting name of the variable holding the longitudinal outcome of interest.

survival

a character string denoting the name of the variable holding the survival time for the event of interest.

id

a character string denoting the name of the variable holding the id variable for the data.

time

a character string denoting the name of the variable holding the longitudinal time variable.

Details

This function removes any longitudinal information recorded for an individual after their survival time. A joint data object should have the id column as the first column in each of the survival, longitudinal and baseline datasets. In the survival dataset the second column should be the survival time and the third should be the censoring variable. In the longitudinal dataset, the second column should be longitudinal outcome, the third the longitudinal time variable and the remaining columns any other time varying covariates. The baseline dataset should have columns 2 and onwards containing time stationary covariates such as treatment group assignment or study membership.

This function does not need to be run on the results of the multi-study data simulation function simjointmeta, because the longitudinal data simulated under this function is already capped at the individual's survival time.

Value

a jointdata object, see jointdata

See Also

jointdata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 ## Not run: 
 #the dataset simdat3 in this package contains joint data where longitudinal
 #data exists after individual's survival times.
 str(simdat3)

 #first this data needs to be changed to a jointdata object
 jointdat3<-tojointdata(longitudinal = simdat3$longitudinal,
                  survival = simdat3$survival, id = 'id', longoutcome = 'Y',
                  timevarying = c('time','ltime'), survtime = 'survtime',
                  cens = 'cens',time = 'time')

 #then additional data recorded after the survival time can be removed
 jointdat3.1<-removeafter(data = jointdat3, longitudinal = 'Y',
                  survival = 'survtime', id = 'id', time = 'time')

 #we can compare the two datasets to see the removed data
 str(jointdat3)
 str(jointdat3.1)
 
## End(Not run)

mesudell/joineRmeta documentation built on Jan. 24, 2020, 6:06 p.m.