expected_groups: Find expected groups based on distinct values across a set of...

View source: R/internal-expected_vars.R

expected_groupsR Documentation

Find expected groups based on distinct values across a set of variables

Description

Given a data frame and a set of discrete (or factor) variables, returns all combinations of their observed levels and the list of levels.

Usage

expected_groups(data, vars)

Arguments

data

A data frame whose columns you want to examine.

vars

Character vector of column names in data to use.

Value

A named list with two elements:

grid

A data.frame where each row is one combination of the variable levels (equivalent to what expand.grid would produce).

levels

A named list; for each variable in vars it gives the sorted unique values (or factor levels) observed in data.


MAPCtools documentation built on June 25, 2025, 5:09 p.m.