.enclos and .envir are passed to eval / eval_tidy when evaluating the substituted expression (if eval is TRUE), they're also passed to expand by default.
eval is FALSE by default for substitute2, but it's TRUE for substituting
I don't think depth is needed much in practice, we can either keep the input unevaluated, use !! on it to unquote it once, and use !! eval(expr) with as many eval calls as necessary, which more control on envir and enclos.
*expand is FALSE by default, if it is TRUE it expands the input using .envir and .enclos, if it is an environment we'll forward it to the envir arg of expand, if it's a list of 2, first goes to envir, second to enclos.
!! is supported in the ... arguments of substitute2 / substituting but also in expr and the arguments of the mf of substituting
inspired by :
https://github.com/moodymudskipper/mmmisc/issues/11
we proposed :
But it would be nice to have
substituting
, just like we'll haveusing
, maybe also with a method for[
.enclos
arg.enclos
and.envir
are passed to eval / eval_tidy when evaluating the substituted expression (if eval isTRUE
), they're also passed to expand by default.eval
isFALSE
by default forsubstitute2
, but it'sTRUE
forsubstituting
depth
is needed much in practice, we can either keep the input unevaluated, use!!
on it to unquote it once, and use!! eval(expr)
with as many eval calls as necessary, which more control on envir and enclos. *expand
isFALSE
by default, if it isTRUE
it expands the input using.envir
and.enclos
, if it is an environment we'll forward it to the envir arg of expand, if it's a list of 2, first goes to envir, second to enclos.!!
is supported in the...
arguments ofsubstitute2
/substituting
but also inexpr
and the arguments of the mf ofsubstituting
substitute2 <- function(expr, ..., depth = 0, env = parent.frame(), expand = NULL, eval = FALSE) { ...}