Skip to content
Prev 76031 / 398503 Next

Substituted arguments surviving multiple function calls

I think you would do better to use [[]], which allows this sort of thing 
as character strings.

f1 <- function(x) d[[deparse(substitute(x))]]

Now f1 is looking for the *name* it is called with, so you need

f2 <- function(x) eval(substitute(f1(x), list(x=substitute(x))))

Leaving the eval off

f2n <- function(x) substitute(f1(x), list(x=substitute(x)))
f1(a1)

shows you how it works.

This really isn't a good idea, though, just to avoid a couple of quotes.
On Tue, 23 Aug 2005, Michael Hoffman wrote: