Learn R Programming

reformulas

reformulas (random effects formulas) is a utility package for processing "lme4-style" random effects formulas in R (i.e., formulas where the random effects are included in the form (f|g) as components of an overall model formula, where f represents a sub-formula for the varying effects and g represents a sub-formula for the grouping variable(s).

The package contains functions like findbars (extract terms containing |, i.e. random-effects terms), nobars (drop terms containing bars from a formula), etc.. The goal of reformulas is to be used upstream of lme4 and glmmTMB (and possibly other packages) as a unified toolkit for processing formulas.

Copy Link

Version

Install

install.packages('reformulas')

Monthly Downloads

470,573

Version

0.4.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Ben Bolker

Last Published

October 28th, 2025

Functions in reformulas (0.4.2)

splitForm

Split formula containing special random effect terms
randint

Remove all random slopes from a formula, while retaining random intercepts.
expandDoubleVert

expand double-bar RE notation by splitting
mkReTrms

Create list of structures needed for models with random effects
isNested

Is f1 nested within f2?
RHSForm

extract right-hand side of a formula
expandDoubleVerts

Expand terms with '||' notation into separate '|' terms
no_specials

Drop 'specials' from a formula
findReTrmClasses

list of specials -- taken from enum.R
anySpecial

Detect whether there are any 'specials' in a formula term
expandGrpVar

apply operator expansion (e.g. a/b -> a + a:b) to a formula term
sub_specials

Substitute safe chars (+) for specials (for use in model.frame) (Generalized from lme4's subbars function.)
nobars

Omit terms separated by vertical bars in a formula
subbars

"Substitute bars"