Using tidy eval for multiple dplyr filter conditions
问题 I'm new to tidy eval and trying to write generic functions- one thing I'm struggling with right now is writing multiple filter conditions for categorical variables. This is what I'm using right now- create_expr <- function(name, val){ if(!is.null(val)) val <- paste0("c('", paste0(val, collapse = "','"), "')") paste(name, "%in%", val) } my_filter <- function(df, cols, conds){ # Args: # df: dataframe which is to be filtered # cols: list of column names which are to be filtered # conds: