Skip to contents

Returns TRUE if the design has one or more grouping columns set via group_by(). Returns FALSE for ungrouped or rowwise (but not grouped) designs.

Usage

is_grouped(design)

Arguments

design

A survey_base object.

Value

A scalar logical.

See also

Other grouping: group_by, is_rowwise(), rowwise

Examples

# create a survey object from the bundled NPORS dataset
d <- surveycore::as_survey(
  surveycore::pew_npors_2025,
  weights = weight,
  strata = stratum
)

# only group_by() makes is_grouped() TRUE; rowwise() does not count
is_grouped(d)
#> [1] FALSE
is_grouped(group_by(d, gender))
#> [1] TRUE
is_grouped(rowwise(d))
#> [1] FALSE