Creates a new formula object to be used anywhere formulas are used (i.e, glm).

make_formula(..., lhs = TRUE, op = "+", group = NULL)

Arguments

...

any number of arguments to compose the formula

lhs

a boolean indicating if the formula has a left hand side of the argument

op

the operand acting upon the arguments of the right side of the formula.

group

an argument to use as a grouping variable to facet by

Value

a formula

Details

If lhs is TRUE, the first argument provided is used as the left hand side of the formula. The group paramenter will add | group to the end of the formula. This is useful for packages that support faceting by grouping variables for the purposes of tables or graphs.

Examples

make_formula(var1, var2, var3)
#> var1 ~ var2 + var3 #> <environment: 0x560864fd1950>
make_formula(var1, var2, var3, lhs = FALSE)
#> ~var1 + var2 + var3 #> <environment: 0x560864fd1950>
make_formula(var1, var2, var3, lhs = FALSE, group = var4)
#> ~var1 + var2 + var3 | var4 #> <environment: 0x560864fd1950>