Skip to contents

Transform year_measured Variable Based on Clustered Conditions Within Waves

Usage

margot_censor(
  dt,
  cluster_id = "rel_num",
  id_var = "id",
  wave_var = "wave",
  condition_var = "rel_complete",
  condition_value = 0,
  year_measured_var = "year_measured"
)

Arguments

dt

A `data.frame` or `data.table` in long format containing repeated measures.

cluster_id

A string specifying the cluster identifier variable. Default is "rel_num".

id_var

A string specifying the individual identifier variable. Default is "id".

wave_var

A string specifying the variable indicating the wave. Default is "wave".

condition_var

A string specifying the condition variable. Default is "rel_complete".

condition_value

The value of `condition_var` that triggers transformation. Default is 0.

year_measured_var

A string specifying the `year_measured` variable. Default is "year_measured".

Value

A modified `data.table` with updated year_measured values based on the condition.

A modified `data.table` with updated year_measured values based on the condition.