dataPrep {vitality} | R Documentation |
Function for data preparation
Description
Function to deal with NAs, right truncated data, and datatype (i.e. cumulative survival or incremental mortality).
Usage
dataPrep(time, sdata, datatype, rc.data,
returnMatrix = FALSE)
Arguments
time |
A vector of observation dates |
sdata |
A vector of survival data of the same length
as |
datatype |
either |
rc.data |
Boolean. Is data right-censored? |
returnMatrix |
Boolean. False returns a data frame, true returns a matrix. (as in the original), if "matrix" returns a matrix instead, with the "rc.data" column being 0 for FALSE, 1 for TRUE, or 2 for TF |
Details
This function is designed for use in the primary vitality model fitting functions in this package. See package documentation.
Value
Returns a data.frame or matrix with columns time, sfract, x1, x2, Ni (incremental survival fraction), rc.data.
[Package vitality version 1.3 Index]