For the analysis of a species database, I often need to change lots of criteria, depending on the projects scope etc.
As it is very inconvenient to always change the
In addition to @Konrad's methods, if the expression is a string, then we can use parse_expr from rlang
library(rlang)
library(dplyr)
df1 %>%
filter(!! parse_expr(expr1))
# col_A col_B
#1 A 1
df1 <- data.frame(col_A = LETTERS[1:10],
col_B = 1:10,
stringsAsFactors = FALSE)
expr1 <- "col_A == 'A' & col_B == 1"