Creating a grouping matrix

create_grouping_matrix(formula, data, include_overall)

Arguments

formula

a RHS formula

data

list where each element corresponds to a term in the formula

include_overall

an indicator of whether to include an "overall" grouping (i.e. a row in the matrix with no 1s).