Learn R Programming

glmmTMB (version 0.1.1)

addForm: Combine right-hand sides of an arbitrary number of formulas

Description

Combine right-hand sides of an arbitrary number of formulas Parse a formula into fixed formula and random effect terms, treating 'special' terms (of the form foo(x|g[,m])) appropriately

Usage

addForm(...)

splitForm(formula, defaultTerm = "us", allowFixedOnly = TRUE, allowNoSpecials = TRUE, debug = FALSE)

noSpecials(term, delete = TRUE)

Arguments

...
arguments to pass through to addForm0
formula
a formula containing special random effect terms
defaultTerm
default type for non-special RE terms
allowFixedOnly
(logical) are formulas with no RE terms OK?
allowNoSpecials
(logical) are formulas with only standard RE terms OK?
term
language object

Value

a list containing elements fixedFormula; reTrmFormulas list of x | g formulas for each term; reTrmAddArgs list of function+additional arguments, i.e. list() (non-special), foo() (no additional arguments), foo(addArgs) (additional arguments); reTrmClasses (vector of special functions/classes, as character)

Details

Taken from Steve Walker's lme4ord, ultimately from the flexLambda branch of lme4 <https://github.com/stevencarlislewalker/lme4ord/blob/master/R/formulaParsing.R>. Mostly for internal use.

Examples

Run this code
splitForm(~x+y)                     ## no specials or RE
splitForm(~x+y+(f|g))               ## no specials
splitForm(~x+y+diag(f|g))           ## one special
splitForm(~x+y+(diag(f|g)))         ## 'hidden' special
splitForm(~x+y+(f|g)+cs(1|g))       ## combination
splitForm(~x+y+(1|f/g))             ## 'slash'; term
splitForm(~x+y+(1|f/g/h))             ## 'slash'; term
splitForm(~x+y+(1|(f/g)/h))             ## 'slash'; term
splitForm(~x+y+(f|g)+cs(1|g)+cs(a|b,stuff))  ## complex special
splitForm(~(((x+y))))               ## lots of parentheses

noSpecials(y~1+us(1|f))
noSpecials(y~1+us(1|f),delete=FALSE)
noSpecials(y~us(1|f))

Run the code above in your browser using DataLab