Subsetting and then binding works as expected
var <- c("wt", "mpg")
mtcars %>% select(!!!var) -> df1
mtcars %>% select(!!!var) -> df2
bind_rows(df1, df2)
But if we skip intermediate steps
bind_rows(
mtcars %>% select(!!!var),
mtcars %>% select(!!!var)
)
it fails with Error: only lists can be spliced
This is a bug in rlang that has to do with value splicing. All functions taking dots support splicing, even if they are not quoting their input. This is handy because you don't have to use do.call()
with these functions when you have a list of arguments, you can just splice the list.
The mechanism is a bit different for technical reasons. There's currently a bug and value-splicing instead of call-splicing is used within the select()
call. This should be fixed shortly.