expected_groups {MAPCtools} | R 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 |
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 indata
.
[Package MAPCtools version 0.1.0 Index]