I'm writing a function that takes in a formula and uses the different elements of that formula to manipulate a data frame. I'm running into trouble when I try to use dplyr (I think this is because of something called "non-standard evaluation").
For example, I want to reference a column in a data frame df using the elements in the formula. If I store the formula as form and want to access the column of df named for the first element of form I can write:
df[all.vars(form)[1]].
Unfortunately, the following doesn't work:
df %>% filter(all.vars(form)[1]) < 100).
How would I go about referencing the variable this way using dpylr? I've tried several things like rlang::sym but haven't had any luck.