R/entity-attribute-value.R
eav-right-censor.RdEntity-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, ... )
| time |
|
|---|---|
| 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 |
| x | the time to event |
| def | the covariate definition for this variable |
| suffix | adds |
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.
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.