set_transformations,BaselineObject-method {psborrow2}R Documentation

Set Transformations in Baseline Objects

Description

Set Transformations in Baseline Objects

Usage

## S4 method for signature 'BaselineObject'
set_transformations(object, ..., overwrite = FALSE)

Arguments

object

BaselineObject created by create_baseline_object.

...

named transformation functions. See details for more information.

overwrite

If TRUE overwrite existing transformation list and only include newly specified transformations.

Details

Transformation functions are evaluated in order and create or overwrite a column in the data.frame with that name. The function should have signature ⁠function(data)⁠, taking a data.frame (specifically a BaselineDataFrame object from generate(BaselineObject)) and return a vector with length identical to the total number of patients. The ⁠@BaselineObject⁠ slot of the BaselineDataFrame may be accessed directly or with get_quantiles() to create transformations. See binary_cutoff().

Value

An updated BaselineObject

Examples

baseline <- create_baseline_object(
  100, 50, 100,
  covariates = baseline_covariates(
    names = "age", means_int = 55,
    covariance_int = covariance_matrix(5)
  )
)
set_transformations(baseline, age_scaled = function(data) scale(data$age))

[Package psborrow2 version 0.0.3.4 Index]