search for: substitute_e

Displaying 1 result from an estimated 1 matches for "substitute_e".

Did you mean: substitute
2012 Jul 27
1
Version of substitute that evaluates it's first argument
Hi all, Does there already exist a version of substitute that evaluates it's first argument? (i.e. it accepts an already quoted expression). This seems like something that's pretty handy, but I haven't found any existing function to do it: substitute_e <- function(expr, env) { eval(substitute(substitute(expr, env), list(expr = expr))) } f <- quote(x + y + z) substitute(f, list(y = 1, z = as.name("b"))) substitute_e(f, list(y = 1, z = as.name("b"))) Hadley -- Assistant Professor / Dobelman Family Junior Chair Depar...