I'm wondering if it's possible to substitute expressions into the i
portion of data.table. I've set up a deeply nested list that contains preset parameters to perform subsetting depending on which sub-group a user has selected in a shiny app. I'm suspecting that it is not possible but am hoping to get confirmation one way or the other.
If it's not possible, I welcome any ideas for alternative solutions.
Basic example
library(data.table)
dt = data.table(
y = rep(c('a','b'),5),
x = 1:10
)
exp1 = "x > 5"
dt[y == "a" & substitute(exp1)]
# Error: operations are possible only for numeric, logical or complex types