# NOT RUN {
# Sometimes you get unscoped formulas because of quotation:
f <- ~~expr
inner_f <- f_rhs(f)
str(inner_f)
is_quosureish(inner_f, scoped = TRUE)
# You can use as_quosure() to provide a default environment:
as_quosure(inner_f, base_env())
# Or convert expressions or any R object to a validly scoped quosure:
as_quosure(quote(expr), base_env())
as_quosure(10L, base_env())
# While as_quosure() always returns a quosure (one-sided formula),
# as_quosureish() returns quosureish objects:
as_quosure(a := b)
as_quosureish(a := b)
as_quosureish(10L)
# }
Run the code above in your browser using DataLab