A petty problem with an obvious solution to rename the parameter of the function. Yet I am interested whether there is a way how I can achieve the following where column name and argument name are the same?
library(dplyr)
d <- data.frame(x = 1:3)
f <- function(x) {
list(
## returns all b/c always true
d %>% filter(x == x),
## does not work either
## any way to tell dplyr to use the parameter x
d %>% filter(.data$x == x)
)
}
f(1)