Function to deal with NAs, right truncated data, and datatype (i.e. cumulative survival or incremental mortality).
dataPrep(time, sdata, datatype, rc.data,
returnMatrix = FALSE)
A vector of observation dates
A vector of survival data of the same length
as time
either "CUM"
for cumulative or
"INC"
for incremental
Boolean. Is data right-censored?
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
Returns a data.frame or matrix with columns time, sfract, x1, x2, Ni (incremental survival fraction), rc.data.
This function is designed for use in the primary vitality model fitting functions in this package. See package documentation.