substitute_call | R Documentation |
Substitute Values from an Environment into a Call
substitute_call(sub_call, envir, more_subs = list(), depth = 1, quote = TRUE)
sub_call |
R expression, quoted if |
envir |
An environment from which to substitute values. |
more_subs |
Optional named list of additional values to substitute. If any names are shared with |
depth |
Used internally to track recursion depth. Do not specify this argument. |
quote |
Logical. Should the call be quoted (i.e., it is passed as an unevaluated expression?). |
This function recursively traverses an R call object (a list-like representation of the abstract syntax tree) and replaces names with corresponding values in envir
. Mandatory non-default arguments to any function in the call are substituted the same way, even if omitted; thus, this function can
convert semantically invalid calls into valid ones. The modified call may still be invalid, however, if some mandatory arguments are unspecified and neither envir
or more_subs contains substitutions for them.
This function is meant to be used with calls to functions from this package, using a LinRegProblem
instance as envir
. Because most function arguments are also attributes of LinRegProblem
objects, doing so will automatically yield a valid call.
Call object with all matched names substituted with corresponding names.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.