Learn R Programming

staggR (version 0.1.1)

pick_time_refs: Identify time period referents within each cohort.

Description

Identify time period referents within each cohort.

Usage

pick_time_refs(
  df,
  cohort_var,
  cohort_ref,
  time_var,
  intervention_var = NULL,
  time_offset = -1
)

Value

list

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.

intervention_var

String specifying the name of the column in df that defines the intervention period. If values of cohort_var are named to match values of time_var, this parameter is not necessary.

time_offset

Integer specifying which time period relative to the intervention time period should be used as the referent for each cohort. Defaults to -1, which corresponds to the time period immediately preceding intervention.

Examples

Run this code
pick_time_refs(hosp, "cohort", "0", "yr", "intervention_yr")

Run the code above in your browser using DataLab