prep_data: Prepare a data frame to work with sdid() function

View source: R/prep_data.R

prep_dataR Documentation

Prepare a data frame to work with sdid() function

Description

Prepare a data frame to work with sdid() function

Usage

prep_data(df, cohort_var, cohort_ref = NULL, time_var, time_ref = NULL)

Arguments

df

A data frame containing the variables in the model.

cohort_var

String specifying the name of the column in df that defines the intervention cohorts.

cohort_ref

An optional string specifying the value of cohort_var to be used as the referent in the model. If not specified, the value is taken from the first observed value in cohort_var.

time_var

String specifying the name of the column in df that defines time periods over the study.

time_ref

An optional string specifying the value of time_var to be used as the referent in the model.

Value

data.frame

Examples

dta_prepped <- prep_data(hosp,
                         cohort_var = "cohort",
                         cohort_ref = "0",
                         time_var = "yr",
                         time_ref = "2010")
head(dta_prepped)

staggR documentation built on April 2, 2026, 5:08 p.m.