This function merges all variables of several formulas into a single formula.
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 type = "all" then both right hand side and left hand side elements of the formulas will be merged on the right hand side. If type = "terms" then only right hand side elements of the formulas will be merged on the right hand side. If type = "var-terms" then the result is the same as in case when type = "terms" but there will be left hand side element of the first formula on the left hand side of the merged formula.
Returns
This function returns a formula which form depends on type input argument value. See 'Details' for additional information.
Details
Merged formulas should have a single element on the left hand side and voluntary number of elements on the right hand side.
Examples
# Consider three formulasf1 <- as.formula("y1 ~ x1 + x2")f2 <- as.formula("y2 ~ x2 + x3")f3 <- as.formula("y3 ~ y2 + x6")# Merge these formulas in a various waysformula_merge(f1, f2, f3, type ="all")formula_merge(f1, f2, f3, type ="terms")formula_merge(f1, f2, f3, type ="var-terms")