process longitudinal data for three waves
Source:R/margot_process_longitudinal_data.R
margot_process_longitudinal_data.Rdthis function processes longitudinal data for exactly three waves (t0, t1, t2). it handles attrition, scales baseline variables, and optionally encodes ordinal variables. note: this function is currently implemented for three waves only.
Usage
margot_process_longitudinal_data(
df_wide,
ordinal_columns = NULL,
continuous_columns_keep = NULL
)Details
the function performs the following steps: 1. creates na conditions for t0 and t1 based on missingness in subsequent waves. 2. handles non-factor and factor columns, applying attrition logic. 3. scales numeric baseline (t0) variables. 4. selects and orders columns. 5. optionally encodes ordinal columns.