This function supports parsing
parseFormula(form, require.groups = FALSE, require.two.sided = FALSE)
form | the formula to extract into its parts |
---|---|
require.groups | is it an error not to have groups? |
require.two.sided | is it an error to have a one-sided formula? |
A parseFormula class list with elements of
The left~right side of the model (excluding groups)
The call for the left hand side
The call for the right hand side (excluding groups)
The call for the groups
A formula form of the groups
The original formula's environment
This function extracts the left hand side (lhs
), right hand
side (rhs
), groups (groups
and as a formula,
grpFormula
), the environment (env
, and the original
left/right hand side of the model (model
).
This function borrows heavily from the parseGroupFormula
function in the doBy package.
Other Formula parsing:
findOperator()
,
formula.parseFormula()
parseFormula("a~b", require.groups=FALSE) #> $model #> a ~ b #> <environment: 0x563b59b5da50> #> #> $lhs #> a #> #> $rhs #> b #> #> $groups #> NULL #> #> $groupFormula #> NULL #> #> $env #> <environment: 0x563b59b5da50> #> #> attr(,"class") #> [1] "parseFormula" "list" ## parseFormula("a~b", require.groups=TRUE) # This is an error parseFormula("a~b|c") #> $model #> a ~ b #> <environment: 0x563b59bc67e0> #> #> $lhs #> a #> #> $rhs #> b #> #> $groups #> c #> #> $groupFormula #> ~c #> <environment: 0x563b59bc67e0> #> #> $env #> <environment: 0x563b59bc67e0> #> #> attr(,"class") #> [1] "parseFormula" "list" parseFormula("a~b|c")$groups #> c