Skip to contents

Count Dyads in Longitudinal Data

Usage

margot_count_dyads(
  dat,
  start_wave = 2009,
  end_wave = 2022,
  year_measured_val = 1,
  rel_id_var = "rel_num_l",
  complete_var = "rel_complete",
  prev_wave_counts = c(1, 2, 3, 4)
)

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).

year_measured_val

Integer. The value of 'year_measured' to filter on (default: 1).

rel_id_var

Character. The name of the variable indicating relationship dyad (default: "rel_num_l").

complete_var

Character. The name of the variable indicating complete dyad status (default: "rel_complete").

prev_wave_counts

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

Value

A tibble with columns for: - wave: Survey wave number - n_total: Total number of dyads (complete + singleton) - n_single: Number of singleton dyads - n_complete: Number of complete dyads - n_wave_1plus: Dyads in 1+ previous waves - n_wave_2plus: Dyads in 2+ previous waves - n_wave_3plus: Dyads in 3+ previous waves - n_wave_4plus: Dyads in 4+ previous waves