Every surveyframe class returns its primary table, and each class has its
own columns. Where an object holds more than one table, the others are
reachable through the named accessors in sf_accessors, or, for a full
tabular record of an instrument, through codebook_report().
What each class gives
sframe: one row per item, withid,label,type,choice_set,scale_id,reverseandrequired.sframe_codebook: one row per item, the codebook's item table.sframe_validation: one row per problem, withcheckandproblem.sframe_analysis_results: one row per block, withblock,research_question,methodandapa.sframe_reliability_report: one row per scale, withscale_id,label,n_items,n,alphaandomega.sframe_item_report: one row per item, withscale_idand the item diagnostics.sframe_quality_report: one row per check, the flattened quality checks.sframe_efa_report: one row per measure, the readiness measures.sframe_sensitivity: one row per perturbation, withcriterion,direction,weight,rho,rank_changedandtop_changed.
A summary, and where the full record is
These tables are a summary of the columns a reader scans first. The item
table leaves out help text, placeholder, matrix rows, comparison items and
scale, slider and rating settings, date bounds, section introduction and
page; the scale table leaves out min_valid, the reverse key and the
weights. Read the stored declaration in full through sf_items(),
sf_scales() and the rest of sf_accessors, each of which returns the
component objects themselves, or through write_sframe() for the
interchange record.
A class holding one table returns it directly, so it keeps that table's own
row names and row.names has no effect. Pass row.names to
base::as.data.frame() on the returned frame where you need to set them.
The coercion gives one view of an object. An instrument, for example,
returns its items, and its choice sets and scales come from
sf_choice_sets(), sf_scales() or codebook_report().
Examples
cs <- sf_choices("ag5", 1:5,
c("Strongly disagree", "Disagree", "Neutral",
"Agree", "Strongly agree"))
item <- sf_item("sat_1", "The service met my expectations.",
type = "likert", choice_set = "ag5", scale_id = "sat")
scale <- sf_scale("sat", "Satisfaction", items = "sat_1")
instr <- sf_instrument("Demo Survey", components = list(cs, item, scale))
as.data.frame(instr)
#> id label type choice_set scale_id reverse
#> 1 sat_1 The service met my expectations. likert ag5 sat FALSE
#> required
#> 1 FALSE
as.data.frame(cs)
#> value label
#> 1 1 Strongly disagree
#> 2 2 Disagree
#> 3 3 Neutral
#> 4 4 Agree
#> 5 5 Strongly agree