Reads a CEnTR*IMPACT survey CSV file, detects the export format (Google Forms or Qualtrics), applies the appropriate header translation and cleaning, and returns analysis-ready data frames.
Usage
load_survey_data(file, survey = c("main", "alignment"))Value
For survey = "main": a named list with elements:
indicators: long-format indicators data frame forvisualize_indicators().dynamics: long-format dynamics data frame foranalyze_dynamics().cascade: wide-format cascade parameters data frame foranalyze_cascade().source: the detected source format,"google"or"qualtrics".
For survey = "alignment": a long-format data frame for
analyze_alignment().
Details
Survey types:
survey = "main" reads the primary CEnTR*IMPACT survey
containing indicators, project dynamics, and cascade network parameters.
The function detects the export format automatically:
Google Forms: identified by the presence of a
Timestampcolumn. Verbose question-text headers are translated to compact variable names,dynamics_selection(absent from the form) is inserted asNA, and cascade probability fields are rescaled from the 1–10 integer scale to \([0, 1]\).Qualtrics: identified by the presence of Qualtrics system columns (
StartDate,ResponseId, etc.). System meta columns, descriptor rows, and_selectioncolumns are removed. The" Applicability"suffix is stripped from rating values and the"Not Applicabie"typo is corrected.
Returns a named list with three analysis-ready data frames:
indicators, dynamics, and cascade.
survey = "alignment" reads the alignment survey containing
researcher and community partner ratings across eight partnership factors.
Qualtrics system columns and descriptor rows are removed when present.
Returns a single long-format data frame ready for analyze_alignment().
Multiple rows: For both survey types and both formats, if more than one data row is present after cleaning, only the last row is kept. This handles Qualtrics exports that include preview or test responses before the final submission.
Examples
if (FALSE) { # \dontrun{
# Load the main survey (auto-detects Google Forms or Qualtrics format)
survey <- load_survey_data("data/mhfa_main.csv", survey = "main")
# Access the ready-to-use sub-frames
indicators_data <- survey$indicators
dynamics_data <- survey$dynamics
cascade_data <- survey$cascade
# Load the alignment survey
alignment_data <- load_survey_data("data/mhfa_alignment.csv", survey = "alignment")
} # }
