Skip to contents

Survey design constructors

Create survey design objects from a data frame. All use a tidy-select interface — bare column names, no formula syntax.

as_survey()
Create a Taylor Series Linearization Survey Design
as_survey_srs()
Create a Simple Random Sample Survey Design
as_survey_rep()
Create a Replicate Weights Survey Design
as_survey_twophase()
Create a Two-Phase Survey Design
as_survey_calibrated() experimental
Create a Calibrated / Non-Probability Survey Design
update_design()
Update Design Variables on an Existing Survey Object

Estimation

Compute weighted estimates with design-correct standard errors.

meta()
Extract Metadata from a Survey Result
get_freqs()
Weighted Frequency Tables for Categorical Survey Variables
get_means()
Weighted Mean for a Survey Design
get_totals()
Weighted Total for a Survey Design
get_corr()
Survey-Weighted Pearson Correlation
get_quantiles()
Survey-Weighted Quantiles
get_ratios()
Survey-Weighted Ratio Estimation

Metadata — setters

Assign variable labels, value labels, question prefaces, and notes. Single-variable setters accept bare names; plural setters accept named lists.

set_var_label()
Set a Variable Label
set_variable_labels()
Set Variable Labels for Multiple Variables
set_val_labels()
Set Value Labels for a Variable
set_value_labels()
Set Value Labels for Multiple Variables
set_question_preface()
Set a Question Preface
set_question_prefaces()
Set Question Prefaces for Multiple Variables
set_var_note()
Set an Analyst Note
set_variable_notes()
Set Analyst Notes for Multiple Variables
infer_question_prefaces()
Infer Question Prefaces from Variable Labels

Metadata — extractors

Retrieve metadata for a single variable.

extract_var_label()
Extract a Variable Label
extract_val_labels()
Extract Value Labels for a Variable
extract_question_preface()
Extract a Question Preface
extract_var_note()
Extract an Analyst Note
survey_weighting_history()
Extract the Weighting History from a Survey Object

Conversion

Convert between surveycore objects, survey::svydesign, and srvyr::tbl_svy.

as_svydesign()
Convert a surveycore Design Object to a survey Package Design
from_svydesign()
Convert a survey Package Design to a surveycore Design Object
as_tbl_svy()
Convert a surveycore Design Object to an srvyr tbl_svy
from_tbl_svy()
Convert an srvyr tbl_svy to a surveycore Design Object

S7 class objects

S7 classes exported for use in downstream packages and extension code. Use S7::S7_inherits(x, survey_taylor) for class testing.

survey_base()
Abstract Base Survey Design Class
survey_srs()
Simple Random Sample Survey Design
survey_taylor()
Taylor Series Linearization Survey Design
survey_replicate()
Replicate Weights Survey Design
survey_twophase()
Two-Phase Survey Design
survey_calibrated()
Calibrated / Non-Probability Survey Design
survey_metadata()
Survey Metadata Container

Utilities

Internal helpers exported for use in extension packages.

survey_data()
Access the Data Component of a Survey Design Object
SURVEYCORE_DOMAIN_COL
Internal Domain Column Name Constant

Example datasets

Real-world survey datasets included for testing and illustration.

nhanes_2017
NHANES 2017-2018: Demographics and Blood Pressure
acs_pums_wy
ACS PUMS 2022 1-Year: Wyoming Persons
anes_2024
ANES 2024: American National Election Studies Time Series
gss_2024
GSS 2024: General Social Survey
pew_jewish_2020
Pew Jewish Americans 2020
pew_npors_2025
Pew NPORS 2025: National Public Opinion Reference Survey
ns_wave1
Nationscape Wave 1: July 18, 2019