lme4 (version 1.0-6)

findbars: Determine random-effects expressions from a formula

Description

From the right hand side of a formula for a mixed-effects model, determine the pairs of expressions that are separated by the vertical bar operator. Also expand the slash operator in grouping factor expressions.

Usage

findbars(term)

Arguments

term
a mixed-model formula

Value

  • pairs of expressions that were separated by vertical bars

Note

This function is called recursively on individual terms in the model, which is why the argument is called term and not a name like form, indicating a formula.

See Also

formula, model.frame, model.matrix.

Other utilities: mkRespMod, mkReTrms, nlformula, nobars, subbars

Examples

Run this code
findbars(f1 <- Reaction ~ Days + (Days|Subject))
## => list( Days | Subject )
findbars(y ~ Days + (1|Subject) + (0+Days|Subject))
## => list of length 2:  list ( 1 | Subject ,  0+Days|Subject)
findbars(~ 1 + (1|batch/cask))
## => list of length 2:  list ( 1 | cask:batch ,  1 | batch)
stopifnot(identical(findbars(f1),
                    list(expression(Days | Subject)[[1]])))

Run the code above in your browser using DataCamp Workspace