Skip to contents

Data frame verbs

Rows

filter(), filter_out(), and drop_na() use domain estimation — rows are marked in or out of the analysis domain without being removed, so variance estimates stay correct. Physical row removal (subset(), slice_*()) is also available but issues a warning because removing rows can bias variance estimates.

filter_out(<survey_base>) filter()
Keep or drop rows using domain estimation
distinct()
Remove duplicate rows from a survey design object
drop_na()
Mark rows with missing values as out-of-domain
arrange()
Order rows using column values
slice() slice_head(<survey_base>) slice_tail(<survey_base>) slice_min(<survey_base>) slice_max(<survey_base>) slice_sample(<survey_base>) slice_head(<survey_result>) slice_tail(<survey_result>) slice_min(<survey_result>) slice_max(<survey_result>) slice_sample(<survey_result>)
Physically select rows of a survey design object
subset(<survey_base>)
Physically remove rows from a survey design object

Columns

Select, reorder, rename, create, extract, and inspect columns. Design variables (weights, strata, PSU, FPC) are always retained even when not explicitly selected. rename() automatically updates the survey design specification and variable metadata to match the new name.

select()
Keep or drop columns using their names and types
relocate()
Change column order in a survey design object
rename() rename_with(<survey_base>) rename_with(<survey_result>)
Rename columns of a survey design object
mutate()
Create, modify, and delete columns of a survey design object
pull()
Extract a column from a survey design object
glimpse()
Get a glimpse of a survey design object

Groups

group_by() stores grouping columns on the survey object for use by grouped operations like mutate(). rowwise() enables row-by-row computation. Unlike dplyr, the underlying data is not modified — groups are stored on the survey object and applied when needed.

ungroup(<survey_base>) group_by()
Group and ungroup a survey design object
rowwise()
Compute row-wise on a survey design object

Predicates

Test the current grouping and rowwise state of a survey design object. These predicates are designed for use by estimation functions in Phase 1.

is_rowwise()
Test whether a survey design is in rowwise mode
is_grouped()
Test whether a survey design has active grouping