Wrapping each supplied argument with a call to quote()
will accomplish what you seem to be asking for:
Foocall <- call("Foo", arg1=quote(x), arg2=quote(y))
## Check that it works
Foocall
# Foo(arg1 = x, arg2 = y)
eval(Foocall)
# $value
# [1] 3
#
# $call
# Foo(arg1 = x, arg2 = y)
identical(Foocall, eval(Foocall)$call)
# [1] TRUE
If you'd further like to be able to supply unnamed arguments and have them automatically matched by position to their associated formal arguments, just wrap the preceding in a call to match.call()
:
## Note that arg1 and arg2 not explicitly mentioned anywhere in this call
match.call(Foo, call("Foo", quote(x), quote(y)))
# Foo(arg1 = x, arg2 = y)