dataPreprocess {JSM} | R Documentation |
Preprocess Data to Be Fed into Joint Models
Description
dataPreprocess
is a function to preprocess data to be used in fitting joint models. Suppose the situation is that
the longitudinal measurements are recorded in a data frame with one row per measurment and the survival information
are recorded in another data frame with one row per subject. This function merges the two data frames by subject identification
and generate three new columns: start
, stop
, event
. See Value.
Usage
dataPreprocess(long, surv, id.col, long.time.col, surv.time.col, surv.event.col,
surv.event.indicator = list(censored = 0, event = 1), suffix = ".join")
Arguments
long |
a data frame for the longitudinal data, one row per measurment, with subject identification, time of measurement, and longitudinal measurements, etc. |
surv |
a data frame for the survival data, one row per subject, with subject identification (column name should match that in |
id.col |
a |
long.time.col |
a |
surv.time.col |
a |
surv.event.col |
a |
surv.event.indicator |
a |
suffix |
a optional |
Value
A data frame merging long
and surv
by subject identification, with one row per longitudinal measurment,
and generate three new columns: start
, stop
, event
(column names are added with suffix specified by suffix
:
start
starting time of the interval which contains the time of the longitudinal measurements.
stop
ending time of the interval which contains the time of the longitudinal measurements.
event
event indicator suggesting whether the event-of-interest, e.g. death, happens in the interval given by
start
andstop
.
Note
1. If long
and surv
have columns sharing the same column names, the columns from long
and surv
would be named with suffixes ".long" and ".surv", respectively, in the output data frame.
2. The time of measurement of the longitudinal measurements and possibly censored time-to-event should be recorded consistently for each subject, i.e. time 0 means the same time point for the longitudinal and survival measurements.
Author(s)
Cong Xu helenxu1112@gmail.com
Examples
## Not run:
liver.join <- dataPreprocess(liver.long, liver.surv, 'ID', 'obstime', 'Time', 'death')
## End(Not run)