Skip to contents

Returns the survey_name dataset-level metadata key from a survey design object or a data frame.

Usage

extract_survey_name(x)

Arguments

x

A survey design object or data.frame.

Value

character(1): the stored survey name, or NA_character_ when the key is not set.

Details

Returns the stored survey_name only. When the key is not set this function returns NA_character_ even if data_name is set: the two keys are independent, and no extractor substitutes one for the other. A design object restored from a file written by surveycore 1.1.0 or earlier reports NA_character_ rather than failing.

Examples

df <- data.frame(id = 1:5, y = c(2, 4, 3, 5, 1), w = rep(1, 5))
extract_survey_name(df)
#> [1] NA

df <- set_survey_name(df, "Example Attitudes Survey 2026")
extract_survey_name(df)
#> [1] "Example Attitudes Survey 2026"