Given a data frame and a set of discrete (or factor) variables, returns all combinations of their observed levels and the list of levels.
expected_groups(data, vars)
A named list with two elements:
A data.frame where each row is one combination of the variable levels
(equivalent to what expand.grid
would produce).
A named list; for each variable in vars
it gives the sorted
unique values (or factor levels) observed in data
.
A data frame whose columns you want to examine.
Character vector of column names in data
to use.