For example :
filter(data, var=="A") #works
i <- "A"
filter(data, var==i) #empty table
Why ? Thank you.
CodePudding user response:
A possible solution:
library(tidyverse)
df <- data.frame(a = 1:3, b = LETTERS[1:3])
i <- "B"
df %>%
filter(b == !!i)
#> a b
#> 1 2 B