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, which is why it followed 0.4.0 so 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 without raising an error. Data that is quietly wrong is worse than data that fails loudly, so the release was not held back. It was accepted the same day it was submitted.
A library of 22 demos
The most common question about a survey package is not how a function works. It is which approach fits the data you actually 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 rather than taking them on trust.
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, instead of as bare numeric codes that someone has to map by hand. 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 with no error raised. The collector now matches columns by name.
Branching rules using %in% with more than one value never worked 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 could not fit, because indirect effects referred to path labels that were never written.- Straight-lining no longer flags scales shorter than 4 items, where identical answers are normal rather than careless.
quality_report()gainsstraightline_min_items. When no scale is long enough to check, the report says so instead of dropping the chart silently. - Reading a response file with
read.csv()no longer mangles matrix columns whose labels contain spaces. 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
If you have not read them yet, the 0.4.0 release notes cover the decision-analysis, text-analysis, and provenance work this release builds on.