Skip to contents

Sets the survey_name dataset-level metadata key — the full formal name of the survey — on a survey design object or a data frame.

Usage

set_survey_name(x, name)

Arguments

x

A survey design object or data.frame.

name

character(1), non-NA, or NULL to delete the key. Omitting it is an error, not a deletion.

Value

The modified object, invisibly.

Details

A convenience wrapper for set_dataset_metadata(x, survey_name = name).

survey_name and data_name are independent keys. This function writes survey_name and nothing else: it never reads, fills, or checks data_name. Use set_data_name() for the display label. The two values may drift, and no function in the package reconciles them.

Examples

df <- data.frame(id = 1:5, y = c(2, 4, 3, 5, 1), w = rep(1, 5))
df <- set_survey_name(df, "Example Attitudes Survey 2026")
extract_survey_name(df)
#> [1] "Example Attitudes Survey 2026"

# The display label is a separate key and stays unset.
extract_data_name(df)
#> [1] NA

d <- as_survey(df, weights = w)
d <- set_survey_name(d, "Example Attitudes Survey, Wave 2")
extract_survey_name(d)
#> [1] "Example Attitudes Survey, Wave 2"