formulae: Decompose formula objects

formulaeR Documentation

Decompose formula objects

Description

Decompose formula objects to treatment, response, covariate, and grouping variables using standardized names TRTP, AVAL, COVAR, and GROUP respectively.

Usage

as_formulae(x, ...)

## S3 method for class 'formula'
as_formulae(x, ...)

Arguments

x

a formula object.

...

further arguments passed to or from other methods.

Value

A list with standardised components named AVAL, TRTP, COVAR, and GROUP where present, containing the original variable names extracted from x, plus a reconstructed formula.

See Also

summaryWO.formula(), stratWO.formula() for use.

Examples

# Example 1: All variables present
as_formulae(x = visit4 ~ treatment + age | sex)
# Example 2: Extra covariates, no grouping variable will drop the extra variable
as_formulae(x = visit4 ~ treatment + age + sex)
# Example 3: When more than two grouping variables, the last one will be used.
 as_formulae(x = visit4 ~ treatment + age | sex |site)

hce documentation built on June 27, 2026, 1:06 a.m.