Call the function below using foo(c("b")). The outputs are displayed in a line.
What is the correct way to record df %>% filter(!!x > (!!x))?
I included a mutatetidyeval-style usage example to compare it with filter.
foo <- function(variables) {
x <- rlang::sym(variables[[1]])
print(x)
print(typeof(x))
df <- data_frame(a = 1, b = 2)
print(df %>% mutate(!!x := 100 + !!x))
print(df %>% filter(!!x > (!!x)))
print(df %>% filter(magrittr::is_greater_than(!!x, !!x)))
}
source
share