Suppose I have the following language object:
lang <- quote( f(x=a) )
and I want to substitute in 1 for a. How
1
a
Use do.call:
do.call
do.call(substitute, list(lang, list(a=1)))
By using do.call, we force evaluation of the name `lang` to its actual underlying value, f(x=a). Then substitution is performed on f(x=a), rather than the name `lang`.
`lang`
f(x=a)