De-identified data and R code for a food safety KAP survey among urban consumers in El Salvador
Description
This dataset contains the de-identified analytical data, codebook, and R code supporting a cross-sectional study of food safety knowledge, attitudes, and self-reported practices among 431 urban consumers in El Salvador. Data were collected through an anonymous online survey between October 31, 2025 and January 31, 2026. The public dataset contains the final analytical variables used to reproduce the descriptive analyses, reliability estimates, Spearman correlations, multivariable logistic regression models, model diagnostics, and figures reported in the associated manuscript. Direct personal identifiers were not collected, and exact birth year, residence information, timestamps, free-text responses, and variables not required for the final analyses were excluded from the public dataset.
Files
Steps to reproduce
Place KAP_ElSalvador_deidentified.csv and KAP_Master_Analysis.R in the same directory. Open R or RStudio and set this directory as the working directory. Install the required R packages if they are not already available, and then run source("KAP_Master_Analysis.R"). The script performs data-integrity checks, calculates KAP dimension scores and median-based classifications, estimates Cronbach's alpha for the attitude subscales and practices, generates sociodemographic and descriptive summaries, calculates Spearman correlations with 1,000-replication bootstrap 95% confidence intervals, fits the multivariable binomial logistic regression models, evaluates multicollinearity using GVIF and adjusted GVIF, performs Hosmer–Lemeshow goodness-of-fit tests, and reproduces Figures 1–5. Generated outputs are saved automatically in the outputs directory. Variable definitions and coding are provided in KAP_Codebook.xlsx.
Institutions
- University of El SalvadorSan Salvador Department, San Salvador