Learn R Programming

vitality (version 1.0)

dataPrep: Function for data preparation

Description

Function to deal with NAs, right truncated data and datatype cumulative survival or incremental motality.

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 time
datatype
either "CUM" for cumulative or "INC" for incremental
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

Value

  • Returns a data.frame or matrix with columns time, sfract, x1, x2, Ni (incremental survival fraction), rc.data.