# NOT RUN {
x <- disp ~ am
is_formula(x)
is_formula(~10)
is_formula(10)
is_formula(quo(foo))
is_bare_formula(quo(foo))
# Note that unevaluated formulas are treated as bare formulas even
# though they don't inherit from "formula":
f <- quote(~foo)
is_bare_formula(f)
# However you can specify `scoped` if you need the predicate to
# return FALSE for these unevaluated formulas:
is_bare_formula(f, scoped = TRUE)
is_bare_formula(eval(f), scoped = TRUE)
# There is also a variant that returns TRUE for definitions in
# addition to formulas:
is_formulaish(a ~ b)
is_formulaish(a := b)
# }
Run the code above in your browser using DataLab