| tulpa_parse_formula | R Documentation |
Decomposes a formula into fixed effects and random effects by walking the formula's abstract syntax tree. This is structural recursion with pattern matching on bar terms – no string manipulation.
tulpa_parse_formula(formula)
## S3 method for class 'tulpa_parsed_formula'
print(x, ...)
formula |
A formula object (e.g., |
x |
A |
... |
Ignored. |
A list with:
response: character, the response variable label (NULL if none)
response_expr: language object, the LHS of ~ (NULL if none)
fixed_formula: formula, the fixed-effects-only formula
random_effects: list of parsed RE specifications
n_re_terms: integer, number of RE terms
latent_blocks: list of evaluated user-defined latent block objects
(typically tgmrf S3 objects), one per latent(...) term in the
original formula. Empty list when no latent(...) terms are present.
n_latent_blocks: integer, number of latent(...) terms
original: the original formula
pf <- tulpa_parse_formula(y ~ x1 + x2 + (1 | group) + (x1 || site))
pf$response # "y"
pf$fixed_formula # y ~ x1 + x2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.