Skip to contents

Count Individual Participants in Longitudinal Data

Usage

margot_count_ids(
  dat,
  start_wave = 2009,
  end_wave = 2022,
  prev_wave_counts = c(1, 2, 3, 4),
  opt_in_var = "sample_frame_opt_in",
  opt_in_true = 1,
  opt_in_false = 0
)

Arguments

dat

A data frame containing the longitudinal data

start_wave

Integer. The first wave to process (default: 2009)

end_wave

Integer. The last wave to process (default: 2022)

prev_wave_counts

Integer vector. Previous wave thresholds to count (default: c(1,2,3,4))

opt_in_var

Character. Name of the opt-in variable to track (default: "sample_frame_opt_in")

opt_in_true

Value indicating opted-in status (default: 1)

opt_in_false

Value indicating not opted-in status (default: 0)

Value

A tibble with columns for: - wave: Survey wave number - n_total: Cumulative unique participants through current wave - n_active: Active participants in current wave - n_deceased: Newly deceased in current wave - n_deceased_total: Total deceased through current wave - n_returned: Participants absent in previous wave but present in earlier waves - n_returned_total: Total returnees through current wave - n_opt_in: Newly opted-in participants in current wave - n_opt_in_total: Total opted-in participants through current wave - n_wave_1plus: Participants in 1+ previous waves - n_wave_2plus: Participants in 2+ previous waves - n_wave_3plus: Participants in 3+ previous waves - n_wave_4plus: Participants in 4+ previous waves