Skip to contents

This function creates summary tables for a panel study, including unique IDs by wave, participant wave summary, and grouped participant wave summary.

Usage

margot_summary_panel(
  data,
  output_format = "html",
  group_waves_at = 3,
  id_col = "id",
  wave_col = "wave",
  year_measured_col = "year_measured"
)

Arguments

data

A data frame containing the panel study data.

output_format

Character string specifying the output format: "html" (default) or "markdown".

group_waves_at

Numeric value specifying at which number of waves to start grouping (default is 3).

id_col

Character string specifying the name of the ID column (default is "id").

wave_col

Character string specifying the name of the wave column (default is "wave").

year_measured_col

Character string specifying the name of the year measured column (default is "year_measured").

Value

A list containing three elements: unique_ids_by_wave, participant_wave_summary, and participant_wave_summary_grouped.

Examples

if (FALSE) { # \dontrun{
# Assuming 'dat' is your dataset
results <- margot_summary_panel(dat)

# Custom settings
custom_results <- margot_summary_panel(
  data = dat,
  output_format = "markdown",
  group_waves_at = 4,
  id_col = "participant_id",
  wave_col = "survey_wave",
  year_measured_col = "measurement_year"
)

# View results
results$unique_ids_by_wave
results$participant_wave_summary
results$participant_wave_summary_grouped

# For markdown output
cat(custom_results$unique_ids_by_wave)
cat(custom_results$participant_wave_summary)
cat(custom_results$participant_wave_summary_grouped)
} # }