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_replicate()
Create a Replicate Weights Survey Design
as_survey_twophase()
Create a Two-Phase Survey Design
as_survey_nonprob() 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
get_diffs()
Treatment Effect Estimation for Survey Designs

Regression

Survey-weighted generalised linear models with Binder (1983) sandwich variance estimation.

survey_glm()
Fit a Survey-Weighted Generalised Linear Model
survey_glm_fit()
Survey-Weighted GLM Fit Object
clean()
Tidy a Survey GLM Fit

Metadata — setters

Assign variable labels, value labels, question prefaces, notes, universe strings, and missing codes. All setters accept the three-convention API: named ..., a single named vector/list, or variable + content argument.

set_var_label()
Set Variable Label(s)
set_val_labels()
Set Value Labels
set_question_preface()
Set Question Preface(s)
set_var_note()
Set Analyst Note(s)
set_universe()
Set Universe Description(s)
set_missing_codes()
Set Missing Code(s)
infer_question_prefaces()
Infer Question Prefaces from Variable Labels

Metadata — extractors

Retrieve metadata for one or more variables.

extract_var_label()
Extract Variable Labels
extract_val_labels()
Extract Value Labels
extract_question_preface()
Extract Question Prefaces
extract_var_note()
Extract Analyst Notes
extract_universe()
Extract Universe Descriptions
extract_missing_codes()
Extract Missing Value Codes
extract_metadata()
Extract All Metadata for Variables
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_taylor()
Taylor Series Linearization Survey Design
survey_replicate()
Replicate Weights Survey Design
survey_twophase()
Two-Phase Survey Design
survey_nonprob()
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
.get_design_vars_flat()
Get design variable column names

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