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

495,281

Version

0.4.3

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Ben Bolker

Last Published

December 17th, 2025

Functions in reformulas (0.4.3)

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"
isNested

Is f1 nested within f2?
findReTrmClasses

list of specials -- taken from enum.R
format_sdvar

Format columns corresponding to std. dev. and/or variance.
anySpecial

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

extract right-hand side of a formula
mkReTrms

Create list of structures needed for models with random effects
expandDoubleVerts

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

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

Format the 'VarCorr' Matrix of Random Effects
no_specials

Drop 'specials' from a formula
randint

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

expand double-bar RE notation by splitting
splitForm

Split formula containing special random effect terms