eav-right-censor: Entity-attribute-value encodings for survival data.

eav_encode_right_censoredR Documentation

Entity-attribute-value encodings for survival data.

Description

Entity-attribute-value encodings for survival data.

Usage

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

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.

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.

See Also

eav_metadata_create()


facilebio/FacileData documentation built on Feb. 23, 2024, 9:14 a.m.