I'm trying to evaluate a string as a formula:
In dplyr it would look like this:
dt = data.table(a = 1:10)
expr = 'sum(a)'
dt %>%
mutate(b := !!parse_expr(expr))
However when I try with data.table I'm getting an error:
dt[, b := parse_expr(expr)]
Error in
[.data.table
(dt, ,:=
(b, parse_expr(expr))) : RHS of assignment is not NULL, not an an atomic vector (see ?is.atomic) and not a list column.