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.
dataPreprocess(long, surv, id.col, long.time.col, surv.time.col, surv.event.col,
surv.event.indicator = list(censored = 0, event = 1), suffix = ".join")
a data frame for the longitudinal data, one row per measurment, with subject identification, time of measurement, and longitudinal measurements, etc.
a data frame for the survival data, one row per subject, with subject identification (column name should match that in long
), possibly censored time-to-event, and event indicator (normally 0=censored, 1=event), etc.
a character
string specifying the subject identification column in both long
and surv
.
a character
string specifying the time of measurement column in long
.
a character
string specifying the possibly censored time-to-event column in surv
.
a character
string specifying the event status column in surv
.
a list
specifying the values in column surv.event.col
corresponding to censored and event status.
a optional character
string specifying the suffix to be added to the start
, stop
, event
columns in case long
or surv
already have columns with these names.
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
and stop
.
# NOT RUN {
liver.join <- dataPreprocess(liver.long, liver.surv, 'ID', 'obstime', 'Time', 'death')
# }
Run the code above in your browser using DataLab