Consider the following data.frame
and variable x
df <- data.frame(x = c(rep(0, 10), rep(1, 10)), y = 1:20)
x <- 0
I tried to use dplyr
to select elements from column x
equal to global variable x
library(dplyr)
df %>% filter(x == x))
But I got all the data.frame
in the response. The filter should be considering only the column, I imagine.
How do I indicate for filter
that one of the x
is a global variable?