Pass a one-row-per-patient data.frame and get back a data.frame with one row per clone.

create_clones(
  df,
  id,
  event,
  time_to_event,
  exposure,
  time_to_exposure,
  ced_window = NULL
)

Arguments

df

A data.frame with one row per patient.

id

The name of the column in df that contains the patient identifier.

event

The name of the column in df that contains the event of interest.

time_to_event

The name of the column in df that contains the time to event.

exposure

The name of the column in df that contains the exposure.

time_to_exposure

The name of the column in df that contains the time to exposure.

ced_window

The date at which the clinical eligibility window closes. Can be left empty, in which case the clinical eligibility window is assumed to be part of exposure and time_to_exposure

Value

A data.frame with one row per clone.

Examples


# Load the toy dataset
data(dummy_data)

# Create clones
clones <- create_clones(dummy_data, 
                        id = "id", 
                        event = "event", 
                        time_to_event = "timetoevent", 
                        exposure = "exposure", 
                        time_to_exposure = "timetoexposure", 
                        ced_window = 100)
#> Updating 4 patients' exposure and time-to-exposure based on CED window