build.formula | R Documentation |
Convert a buildmer term list into a proper model formula
build.formula(dep, terms, env = parent.frame())
dep |
The dependent variable. |
terms |
The term list. |
env |
The environment of the formula to return. |
A formula.
library(buildmer) form1 <- Reaction ~ Days + (Days|Subject) terms <- tabulate.formula(form1) form2 <- build.formula(dep='Reaction',terms) # check that the two formulas give the same results library(lme4) check <- function (f) resid(lmer(f,sleepstudy)) all.equal(check(form1),check(form2)) # can also do double bars now form1 <- Reaction ~ Days + (Days||Subject) terms <- tabulate.formula(form1) form2 <- build.formula(dep='Reaction',terms) all.equal(check(form1),check(form2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.