create_clones.Rd
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
)
A data.frame with one row per patient.
The name of the column in df
that contains the patient identifier.
The name of the column in df
that contains the event of interest.
The name of the column in df
that contains the time to event.
The name of the column in df
that contains the exposure.
The name of the column in df
that contains the time to exposure.
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
A data.frame with one row per clone.
Maringe, Camille, et al. "Reflection on modern methods: trial emulation in the presence of immortal-time bias. Assessing the benefit of major surgery for elderly lung cancer patients using observational data." International journal of epidemiology 49.5 (2020): 1719-1729.
# Load the toy dataset
data(toy_df)
# Create clones
clones <- create_clones(toy_df,
id = "id",
event = "death",
time_to_event = "fup_obs",
exposure = "surgery",
time_to_exposure = "timetosurgery",
ced_window = 365.25/2)