I have created a reproducible example to illustrate the problem I am having with non-standard evaluation in R (dplyr). I would like to use dynamic variable names in the scen
Here is one option with parse_expr from rlang
library(rlang)
library(dplyr)
patientData %>%
filter(!! parse_expr(paste(firstDateName, ">", secondDateName)))
# patientID birth_d treat_d death_d
#1 5 2017-01-01 2011-12-27 2012-12-26
#2 7 2011-06-25 2012-06-24 2001-01-01
#3 12 2018-05-05 2013-09-17 2014-09-17