cast_covariate: Casts the character EAV values to their R-native defined...

View source: R/entity-attribute-value.R

cast_covariateR Documentation

Casts the character EAV values to their R-native defined types.

Description

For most things, a single value will be returned from each cast, but in the case of "time_to_event" data, the value is expended to a two column data.frame with a ⁠tte_<covariate>⁠ column for time to event, and an ⁠event_<covariate>⁠ column to indicate event (1) or right censored (2).

Usage

cast_covariate(covariate, values, cov.def, .fds)

Arguments

covariate

the name of the covariate

values

the covariate values (which is a character) as it is pulled from the database.

cov.def

the un-yamled covariate definitions, if missing we rely on pulling this out from the FacileDataSet object .fds

.fds

If missing(cov.def), this is the FacileDataSet to get the covariate definitions from.

Details

The mechanics of how values in the sample_covariate table are converted into R objects are handled by the information stored in the FacileDataSets's meta.yaml file.

Value

values cast to appropriate type if a valid definition was found for covariate, otherwise values is returned "as is". Most of the time this is a single vector, but others it can be a data.frame (for right_censored data, for instance)

See Also

covariate_meta_info(), covariate_definitions()


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