Accessors for the parts of an instrument, a codebook, or a report. They
replace reaching into the object with $, which ties user code to the
internal layout.
Value
A list for sframe_meta() and sframe_plan() on an instrument, an
sf_component_list for the component accessors on an instrument, and a
data frame for any of them on a codebook. See the table above.
Details
What each one gives back depends on what it is asked. Given an instrument,
the component accessors return the component objects as an
sf_component_list, which prints as a list and is subset with [ and
[[. Given a codebook, the same verbs return the table the codebook
already holds, a plain data frame with one row per item, scale, choice set,
model or plan block.
| Accessor | On an sframe | On an sframe_codebook |
sframe_meta() | list of metadata | list of metadata |
sframe_get_items() | sf_component_list of items | data frame of items |
sframe_get_scales() | sf_component_list of scales | data frame of scales |
sframe_get_choice_sets() | sf_component_list of choice sets | data frame of choice sets |
sframe_get_branches() | sf_component_list of branching rules | use the instrument |
sframe_get_attention_checks() | sf_component_list of checks | use the instrument |
sframe_get_models() | sf_component_list of models | data frame of models |
sframe_plan() | list of plan blocks | data frame of plan blocks |
as.data.frame() on an instrument gives its items as a table, which is one
part of it. A component list remains a list. For every
table an instrument can produce, use sframe_codebook().
See also
as_sframe(), sframe_problems(), sframe_validation
Other Inspect functions:
as.data.frame.sf_choices(),
as.data.frame.sframe(),
as.data.frame.sframe_analysis_results(),
as.data.frame.sframe_assumption_report(),
as.data.frame.sframe_codebook(),
as.data.frame.sframe_descriptives_report(),
as.data.frame.sframe_efa_report(),
as.data.frame.sframe_efa_solution(),
as.data.frame.sframe_item_report(),
as.data.frame.sframe_missing_data_report(),
as.data.frame.sframe_quality_report(),
as.data.frame.sframe_reliability_report(),
as.data.frame.sframe_sample_size_plan(),
as.data.frame.sframe_sensitivity(),
as.data.frame.sframe_validation(),
as.data.frame.sframe_validity_report(),
sf_component_list,
sframe_apa(),
sframe_as_data_frame(),
sframe_flagged(),
sframe_get_attention_checks(),
sframe_get_branches(),
sframe_get_choice_sets(),
sframe_get_items(),
sframe_get_models(),
sframe_get_scales(),
sframe_id(),
sframe_identity,
sframe_is_valid(),
sframe_label(),
sframe_meta(),
sframe_missing_columns(),
sframe_notes(),
sframe_object(),
sframe_problems(),
sframe_report_accessors,
sframe_subset,
sframe_validation_accessors
Examples
cs <- sframe_choice_set("ag5", 1:5,
c("Strongly disagree", "Disagree", "Neutral",
"Agree", "Strongly agree"))
item <- sframe_item("sat_1", "The service met my expectations.",
type = "likert", choice_set = "ag5", scale_id = "sat")
scale <- sframe_scale("sat", "Satisfaction", items = "sat_1")
instr <- sframe_instrument("Demo Survey", components = list(cs, item, scale))
sframe_meta(instr)$title
sframe_get_items(instr)
sframe_get_scales(instr)[["sat"]]
as.data.frame(instr)