There's a quite subtle (and very confusing) distinction in rlang that... quosures are not quosure objects! In other terms:
quo()
and enquo()
return a quosurequos()
and enquos()
return a quosureS, not a quosure (is_quosure(enquos(...))
returns FALSE
)What is the equivalent of quo_is_null()
and quo_is_missing()
for quosures? In particular, I would like to test the ...
argument, captured by enquos(...)
, is null/missing, how do I do that?
library(rlang)
fo1 <- function(df, var1) {
dot_vars <- rlang::enquo(var1)
quo_is_missing(dot_vars)
}
fo2 <- function(df, ...) {
dot_vars <- rlang::enquos(...)
quo_is_missing(dot_vars)
}
fo1()
#> [1] TRUE
fo2()
#> `quo` must be a quosure
Use length(dot_vars)
to determine if it has a length of 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With