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

library(surveytidy)
library(surveycore)
library(dplyr)
d <- as_survey(pew_npors_2025, weights = weight, strata = stratum)

is_grouped(d)                   # FALSE
#> [1] FALSE
is_grouped(group_by(d, gender)) # TRUE
#> [1] TRUE
is_grouped(rowwise(d))          # FALSE (rowwise != grouped)
#> [1] FALSE