require(dplyr)
sampleDF <- data.frame("Column A" = c(1,2,3))
sampleDF %>%
dplyr::filter(
`Column A` > 2
)
How should I fix the codes above so it works? I don't want to change the name.
dplyr is probably not the problem, because in general only dots and underscores are allowed in variable names, but no spaces. If you would like to include a quoted name under all circumstances, maybe:
require(dplyr)
require(rlang)
sampleDF <- data.frame("Column A" = c(1,2,3))
sampleDF %>%
dplyr::filter(
eval_tidy(quo("Column A")) > 2 # OR: eval(quote("Column A")) > 2
)