library(dplyr, warn.conflicts = FALSE)
df <- data.frame(x = 1:2, y = 3:4)
this fails, as it should
filter(df, c(TRUE, TRUE, FALSE, FALSE))
#> Error: Problem with `filter()` input `..1`.
#> ℹ Input `..1` is `c(TRUE, TRUE, FALSE, FALSE)`.
#> x Input `..1` must be of size 2 or 1, not size 4.
but this does not fail, and worse it silently uses the first column of the matrix:
filter(df, matrix(c(TRUE, TRUE, TRUE, FALSE), nrow = 2))
#> x y
#> 1 1 3
#> 2 2 4
however if we convert the matrix to a data frame, then
we get an auto splicing behavior
filter(df, as.data.frame(matrix(c(TRUE, TRUE, TRUE, FALSE), nrow = 2)))
#> x y
#> 1 1 3
Created on 2021-08-06 by the reprex package (v2.0.0)
this fails, as it should
but this does not fail, and worse it silently uses the first column of the matrix:
however if we convert the matrix to a data frame, then
we get an auto splicing behavior
Created on 2021-08-06 by the reprex package (v2.0.0)