formulas {lme4} | R Documentation

## Utilities for formulas

### Description

These generic functions extract sub-formulas or values of components from a formula/data pair.

### Usage

    getCovariate(object, form, data)
    getCovariateFormula(object)
    getGroups(object, form, level, data, sep)
    getGroupsFormula(object, asList, sep)
    getResponse(object, form)
    getResponseFormula(object)
    subFormula(form, pos)
    splitFormula(form, sep)

### Arguments

`object` | a formula or an object that can provide a formula
`form` | an optional formula with a conditioning expression on its right hand side (i.e. an expression involving the `|` operator). Defaults to `formula(object)`.
`level` | a positive integer vector with the level(s) of grouping to be used when multiple nested levels of grouping are present. This argument is optional for most methods of this generic function and defaults to all levels of nesting.
`data` | a data frame in which to interpret the variables named in `form`. Optional for most methods.
`asList` | an optional logical value. If `TRUE` the returned value with be a list of formulas; else, if `FALSE` the returned value will be a one-sided formula. Defaults to `FALSE`.
`sep` | character, the separator to use between group levels when multiple levels are collapsed. Defaults to `'/'`.
`pos` | the integer index of the component of the formula to return. Defaults to `2`.

### Value

`getGroupsFormula` returns a one-sided formula, or a list of one-sided formulas, giving the grouping structure associated with `formula(object)`. If no conditioning expression is present in `formula(object)` a `NULL` value is returned.

### Examples

    form = resp ~ cov1 + cov2 | grp1/grp2
    getResponseFormula(form)
    getCovariateFormula(form)
    getGroupsFormula(form)
    getGroupsFormula(form, asList = TRUE)

[Package Contents]