Entity-attribute-value encodings for survival data.

eav_encode_right_censored(time, event, sas.encoding = FALSE, ...)

eav_decode_right_censored(
  x,
  attrname = character(),
  def = list(),
  suffix = attrname,
  sas.encoding = FALSE,
  ...
)

Arguments

time

numeric time to event

event

0/1 vector encoded in the "R sense". "1" is an event, "0" is right censored.

sas.encoding

Is the 'event' vector "SAS encoded"? In the SAS world, 1 means censored, and 0 is event. This is FALSE by default.

x

the time to event

def

the covariate definition for this variable

suffix

adds _<suffix> to the tte and event columns of the outgoing data.frame

Value

returns a numeric vector that combines time-to-event and censoring info (sign of the value).

two column data.frame with tte(_SUFFIX)? and event(_SUFFIX)? columns.

Details

Encoding of survival data in R requires two columns, one to store the time-to-event and another to indicate if there was an "event" at stored time, or if it was censored. A FacileDataSet stores these two pData columns into one "value" column in its entity-attribute-value sample_covariate table.

The encode_right_censored function takes the time-to-event and censoring vectors and encodes them into a single signed time-to-event numeric value. Positive values indicate an event, and negative value are censored.

The decode_right_censored function re-instantiates the two-column R-native storage of this data.

See also