formula_merge {switchSelection} | R Documentation |
Merge formulas
Description
This function merges all variables of several formulas into a single formula.
Usage
formula_merge(..., type = "all")
Arguments
... |
formulas to be merged such that there is a single element on the left hand side and various elements on the right hand side. |
type |
string representing the type of merge to be used.
If |
Details
Merged formulas should have a single element on the left hand side and voluntary number of elements on the right hand side.
Value
This function returns a formula which form depends on
type
input argument value. See 'Details' for additional information.
Examples
# Consider three formulas
f1 <- as.formula("y1 ~ x1 + x2")
f2 <- as.formula("y2 ~ x2 + x3")
f3 <- as.formula("y3 ~ y2 + x6")
# Merge these formulas in a various ways
formula_merge(f1, f2, f3, type = "all")
formula_merge(f1, f2, f3, type = "terms")
formula_merge(f1, f2, f3, type = "var-terms")