surveyframe 0.4.1 is on CRAN
surveyframe, CRAN, R package, teaching demos, SPSS export, Stata export, reproducibility, seed, bug fixes
TL;DR: surveyframe 0.4.1 reached CRAN on 3 September 2026, 14 days after 0.4.0. Install it with install.packages("surveyframe"). It adds a library of 22 teaching demos, labelled SPSS and Stata export and seeded reports that reproduce exactly. It also fixes 2 defects that could silently corrupt collected data, so it followed 0.4.0 closely. Free and open source under the MIT licence.
Why this release came so fast
CRAN asks for 1 to 2 months between submissions. This one went in 14 days after 0.4.0, and the reason was set out in the submission comments: 2 of the fixes below could corrupt collected data silently. Quietly wrong data does more harm than data that fails loudly, so the release went out at once. It was accepted the same day it was submitted.
A library of 22 demos
The most common question about a survey package is which approach fits the data you have.
0.4.1 answers that with 22 small demos, each showing one thing. List them with sframe_demos(), load one with sframe_demo("two_group") or get an editable Quarto notebook with sframe_demo_qmd("two_group"). Together they cover every analysis method and every question type in the package.
Each demo also ships a codebook of variable and value labels, and the results surveyframe produced for it, so you can check the numbers against other software yourself.
A companion vignette, vignette("learn-by-example"), walks you from picking the demo that matches your data through to the finished report.
Labelled export to SPSS and Stata
sframe_export_labelled() writes SPSS .sav or Stata .dta with the question wording and the response options attached. Variables arrive in the other package already labelled, ready to use. haven is an optional dependency.
Reports that reproduce
run_analysis_plan() gains a seed argument, set by default. Bootstrap confidence intervals and the EFA parallel analysis previously drew from the random stream unseeded, so the same data gave a slightly different interval on every run.
This means confidence intervals will move once when you re-run an older analysis. Test statistics and p values are unaffected. Pass seed = NULL for the previous behaviour.
render_report() now states which engine produced the file, Quarto or the built-in writer, in a message, in an engine attribute and in the report itself beside the instrument hash and the seed.
The 2 data-corruption fixes
The Google Sheets collector could corrupt collected data. Adding a question mid-study left the sheet’s header stale while new rows used the new order, so values landed under the wrong headings, silently. The collector now matches columns by name.
Branching rules using %in% with more than one value failed in an exported survey. The question stayed hidden whatever the respondent answered. This had been present since 0.3.0.
Other fixes
sem_lavaan_syntax()produced a mediation model lavaan failed to fit, because indirect effects referred to path labels missing from the model.- Straight-lining now checks scales of 4 items or more, since identical answers on shorter scales are normal.
quality_report()gainsstraightline_min_items. When every scale is too short to check, the report says so in place of the chart. - Reading a response file with
read.csv()now keeps matrix columns whose labels contain spaces intact. Usecheck.names = FALSE.
Get it
- Install:
install.packages("surveyframe") - Documentation: mohammedalisharafuddin.github.io/surveyframe
- Source: github.com/MohammedAliSharafuddin/surveyframe
- On CRAN: CRAN.R-project.org/package=surveyframe
The 0.4.0 release notes cover the decision-analysis, text-analysis and provenance work this release builds on.