Learn R Programming

surveycore (version 0.8.3)

extract_sata: Extract SATA (Select-All-That-Apply) Flags

Description

Returns the SATA status for one or more variables in a survey design object or a data frame.

Usage

extract_sata(x, ..., format = "named_vector", fill = FALSE)

Value

  • "named_vector" (default): named logical vector. Empty: logical(0).

  • "list": named list of logical scalars. Empty: list().

  • "data_frame": tibble with columns variable (character) and sata (logical). Empty: zero-row tibble.

Arguments

x

A survey design object or data.frame.

...

<tidy-select> Variables to query. Supports selection helpers: tidyselect::starts_with(), tidyselect::all_of(), tidyselect::any_of(), etc. If empty, returns SATA status for all columns of x.

format

character(1). Output format: "named_vector" (default), "list", or "data_frame".

fill

FALSE (default) or NULL. Controls how unmarked variables are reported. FALSE includes them in the result with value FALSE (dense view); NULL omits them (sparse view). TRUE and other values are rejected.

See Also

set_sata() to set SATA flags

Other metadata: classify_question_type(), extract_metadata(), extract_missing_codes(), extract_question_preface(), extract_universe(), extract_val_labels(), extract_var_label(), extract_var_note(), infer_question_prefaces(), set_missing_codes(), set_question_preface(), set_sata(), set_universe(), set_val_labels(), set_var_label(), set_var_note(), survey_metadata(), survey_weighting_history()

Examples

Run this code
d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
               strata = sdmvstra, nest = TRUE)
d <- set_sata(d, riagendr)
extract_sata(d, riagendr)
extract_sata(d, fill = NULL)

Run the code above in your browser using DataLab