This small helper function allows to combine multiple formula()
objects
into one. In the case of duplicate variable entries, only the unique ones
are used.
Usage
combine_formulas(..., combine = "both", env = parent.frame())
Value
A formula as cbind(lhs_1, lhs_2, ...) ~ rhs_1 + rhs_2 + ...
or
lhs ~ rhs_1 + rhs_2
in case of identical LHS (see examples).
Examples
# Combine everything (default)
combine_formulas(observed ~ rainfall + temp, observed ~ rainfall + forest.cover)
#> observed ~ rainfall + temp
#> <environment: 0x557dc67b9d78>
# Combine only LHS
combine_formulas(observed ~ rainfall + temp, observed ~ rainfall + forest.cover, combine = "lhs")
#> observed ~ rainfall + temp + rainfall + forest.cover
#> <environment: 0x557dc67b9d78>