# NOT RUN {
# as_quosure() converts expressions or any R object to a validly
# scoped quosure:
as_quosure(quote(expr), base_env())
as_quosure(10L, base_env())
# Sometimes you get unscoped formulas because of quotation:
f <- ~~expr
inner_f <- f_rhs(f)
str(inner_f)
# In that case testing for a scoped formula returns FALSE:
is_formula(inner_f, scoped = TRUE)
# With as_quosure() you ensure that this kind of unscoped formulas
# will be granted a default environment:
as_quosure(inner_f, base_env())
# }
Run the code above in your browser using DataLab