grab_design_levels {geex}R Documentation

Grab a list of the levels of factor variables in a model.

Description

Useful when splitting data later, used with grab_design_matrix or especially when calling grab_psiFUN from within an eeFun.

Usage

grab_design_levels(model)

Arguments

model

a model object such as lm, glm, merMod

Value

A named list of character vectors that provides the fentire set of levels that each factor predictor in model will take on. This is hopefully identical to what the xlev argument to link[stats]{model.frame} desires. When model has no factors as predictors, then an empty list is returned.

Examples

## Not run: 
  geex::grab_design_matrix(
    data = data,
    rhs_formula = geex::grab_fixed_formula(model),
    xlev = geex::grab_design_levels(model)
  )
  ## Below is helpful within an eeFun.
  geex::grab_psiFUN(
    data = data,## Especially when this is a subset of the data
    rhs_formula = geex::grab_fixed_formula(model),
    xlev = geex::grab_design_levels(model)
  )

## End(Not run)

[Package geex version 1.1.1 Index]