rlang
rlang copied to clipboard
Edge case difference of `quos()` vs `enquos()` with `.ignore_empty = "all"`
library(rlang)
fn_quos <- function(cond) {
quos_it({{cond}})
}
fn_enquos <- function(cond) {
enquos_it({{cond}})
}
quos_it <- function(...) {
quos(..., .ignore_empty = "all")
}
enquos_it <- function(...) {
enquos(..., .ignore_empty = "all")
}
fn_quos()
#> <list_of<quosure>>
#>
#> [[1]]
#> <quosure>
#> expr: ^
#> env: empty
fn_enquos()
#> <list_of<quosure>>
#>
#> named list()
This came up in a revdepcheck of dplyr with the headliner package. It has to do with the fact that we changed dplyr_quosures()
from enquos()
to quos()
.
x <- headliner:::aggregate_group(
df = mtcars,
name = "_x",
.cols = c(mpg, hp),
.fns = list(avg = mean)
)
This has an "optional" cond
argument that isn't being used here that gets passed to filter()
. It shows up as a missing argument if not used and I guess it used to get filtered out of the enquos()
results, but now it isn't, and this headliner example will give an error with dev dplyr. I'm not sure what the right behavior is.