Learn R Programming

psborrow2 (version 0.0.4.0)

set_transformations,BaselineObject-method: Set Transformations in Baseline Objects

Description

Set Transformations in Baseline Objects

Usage

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

Value

An updated BaselineObject

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().

Examples

Run this code
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))

Run the code above in your browser using DataLab