ipw_data: IPW Data Accessor and Setter

ipw_dataR Documentation

IPW Data Accessor and Setter

Description

[Experimental]

Usage

ipw_data(object)

ipw_data(object) <- value

## S4 method for signature 'trial_sequence'
ipw_data(object)

## S4 replacement method for signature 'trial_sequence'
ipw_data(object) <- value

Arguments

object

trial_sequence object

value

data.table to replace and update in ⁠@data⁠

Details

Generic function to access and update the data used for inverse probability weighting.

The setter method ipw_data(object) <- value does not perform the same checks and manipulations as set_data(). To completely replace the data please use set_data(). This ⁠ipw_data<-⁠ method allows small changes such as adding a new column.

Value

The data from the ⁠@data⁠ slot of object used for inverse probability weighting.

Examples

ts <- trial_sequence("ITT")
ts <- set_data(ts, data_censored)
ipw_data(ts)
data.table::set(ipw_data(ts), j = "dummy", value = TRUE)

# or with the setter method:
new_data <- ipw_data(ts)
new_data$x2sq <- new_data$x2^2
ipw_data(ts) <- new_data

CAM-Roche/RandomisedTrialsEmulation documentation built on April 14, 2025, 7:44 a.m.