From murdoch at stats.uwo.ca  Thu May 19 12:50:20 2005
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Thu May 19 12:49:40 2005
Subject: [Rd] Getting ... without evaluating it?
In-Reply-To: <Pine.LNX.4.61.0505191104180.6887@gannet.stats>
References: <428C6147.9060105@stats.uwo.ca>
	<Pine.LNX.4.61.0505191104180.6887@gannet.stats>
Message-ID: <428C6F6C.7030807@stats.uwo.ca>

Prof Brian Ripley wrote:
> On Thu, 19 May 2005, Duncan Murdoch wrote:
> 
> 
>>I'd like a function to get an unevaluated copy of its argument list, 
>>including ... .  That is, I'd like
>>
>>f <- function(...) {
>> args <- <what goes here??>
>> args
>>}
>>
>>when called as
>>
>>f(a = 1+1, b = foo)
>>
>>to return something like list(a = quote(1+1), b = quote(foo)).  If I use args 
>><- list(...) then it tries to evaluate the arguments and dies (because foo 
>>doesn't exist).  If I use args <- substitute(...) then it gives just 1+1, it 
>>doesn't keep the names or give the whole list.
> 
> 
>>f <- function(...) as.list(match.call())[-1]
>>f(a = 1+1, b = foo)
> 
> $a
> 1 + 1
> 
> $b
> foo
> 
> (which is what list(a = quote(1+1), b = quote(foo)) prints as).

Thanks!

Duncan Murdoch


[Rd] Getting ... without evaluating it?
Duncan Murdoch