survey_df: Create a survey object

View source: R/survey_df.R

is.survey_dfR Documentation

Create a survey object

Description

Construct a survey object from a data frame or tibble by attaching survey-level metadata such as an identifier, source filename, and basic dataset-level descriptive metadata.

Usage

is.survey_df(x)

survey_df(
  x,
  title = NULL,
  creator = person("Unknown", "Creator"),
  dataset_bibentry = NULL,
  dataset_subject = NULL,
  identifier,
  filename
)

is.survey_df(x)

## S3 method for class 'survey_df'
print(x, ...)

Arguments

x

A data frame or tibble containing the survey data.

title

Optional title for the survey. Defaults to '"Untitled Survey"'.

creator

A [utils::person()] object describing the dataset creator. Defaults to 'person("Unknown", "Creator")'.

dataset_bibentry

Optional dataset-level bibliographic metadata. If 'NULL', a minimal DataCite entry is created automatically using 'title', 'creator', and 'dataset_subject'.

dataset_subject

Dataset subject metadata. If 'NULL', defaults to the Library of Congress Subject Heading Surveys.

identifier

A character scalar identifying the survey.

filename

A character scalar giving the source filename, or 'NULL' if unknown.

...

potentially further arguments for methods.

Details

This function is primarily intended for use by import helpers such as [read_rds()], [read_spss()], [read_dta()], and [read_csv()]. Most users will not need to call it directly.

Value

An object of class '"survey_df"', which is a data frame with additional survey-level metadata stored as attributes and dataset-level metadata stored using the 'dataset' package.

See Also

[read_survey()] for importing survey data from external files.

Other importing functions: survey()

Examples

survey_df(
  x = data.frame(
    rowid = 1:6,
    observations = runif(6)
  ),
  identifier = "example",
  filename = "no_file"
)


retroharmonize documentation built on Jan. 14, 2026, 9:08 a.m.