surveyframe: Survey Instrument Workflows for R
Source:R/surveyframe-package.R
surveyframe-package.Rdsurveyframe defines a survey instrument as a first-class R object and supports a complete workflow from questionnaire design through data collection, quality checking, scoring, psychometric diagnostics, and reproducible reporting. The package covers static HTML survey export, an embeddable Shiny survey module, an interactive response dashboard, a role-based analysis planner with pre-declared research questions, common survey statistics with small-sample alternatives (Hodges-Lehmann, pseudomedian, exact odds-ratio, and Firth logistic regression), multi- criteria decision analysis (AHP, ANP, DEMATEL, VIKOR, MOORA, SMART, WASPAS, PROMETHEE, ELECTRE, and TOPSIS), and model syntax planning for EFA, CFA, CB-SEM, and PLS-SEM.
Core workflow
Design an instrument with
launch_builder()orsf_instrument()and its component constructors:sf_item(),sf_choices(),sf_scale(),sf_branch(),sf_check().Validate and save with
validate_sframe()andwrite_sframe().validate_sframe()returns ansframe_validationdiagnostic rather than the instrument itself. Recover a validated instrument withas_sframe().Deploy a Shiny survey with
render_survey().Load responses with
read_responses()orread_sheet_responses().Check quality with
quality_report().Score and analyse with
score_scales(),descriptives_report(),missing_data_report(),reliability_report(),item_report(),efa_report(),cfa_syntax(), andrun_analysis_plan(), which also runs any decision-analysis blocks in the plan.Report with
codebook_report(),render_report(), andrender_results().
The instrument object
The workflow runs on an sframe object. It is the single source of truth
for item definitions, scale structure, reverse-coding keys, branching
rules, check specifications, analysis plans, and optional model
specifications. Accessors such as sf_meta(), sf_items(), sf_scales(),
sf_plan(), and sf_models() read its parts without reaching into the
object directly.
Some helpers work on plain vectors, for use beside that workflow or on
their own: the text helpers such as term_frequency(), and the interval
helpers bootstrap_ci(), cohens_d_ci(), cramers_v_ci() and
eta_sq_ci().
A first session
sframe_demos() lists 22 worked demos, each one instrument, its responses
and the results surveyframe produced. sframe_demo("two_group") loads one,
and sframe_demo_qmd("two_group") writes a notebook to edit.
vignette("learn-by-example") teaches from the same library.
How functions are named
Three families, which the prefix tells apart.
sf_builds or reads the instrument object model: the constructorssf_item()andsf_scale(), the accessorssf_items()andsf_plan(), and the replacement forms such assf_plan<-.sframe_covers everything the package adds around that object: the plots such assframe_plot_reliability(), the demo library throughsframe_demos(), the decision helpers, and the builder's own state.The workflow verbs carry no prefix, because they name the step a researcher is taking:
validate_sframe(),score_scales(),run_analysis_plan(),render_report(), and the_report()family.
The prefixes group functions; they do not pair them. No name stem appears
under both, so there is no sframe_ twin of an sf_ function to look for.
Author
Maintainer: Mohammed Ali Sharafuddin mohammedali.page@gmail.com (ORCID)
Authors:
Mohammed Ali Sharafuddin mohammedali.page@gmail.com (ORCID)