I have the following database along with a couple of input values:
operator <- ">="
amt <- 600
col <- "salary"
data <- data.frame(
emp_id = c (1:5),
emp_name = c("Rick","Dan","Michelle","Ryan","Gary"),
salary = c(623.3,515.2,611.0,729.0,843.25)
)
I've used match.fun using the original column name, but want to use the "col" value to specify which column name to filter on, similar to what it'd be below:
data %>%
filter(match.fun(operator)(col, amt))
I've tried adding "!!" to the front of col when it's in there, but that doesn't work. If I replace "col" with "salary" in the above table, that does work, but I want to be able to dynamically change what "col" is and have the function react to that.