Skip to content
Prev 19751 / 63421 Next

Expanding partial names

On 3/7/2006 2:00 PM, Deepayan Sarkar wrote:
Thanks, this is a nice idea.  It looks as though it would combine well 
with Charles Duponts' suggestion to change the formals, i.e. I could 
have a generic version of your newArgs function, then change the formals 
and the body to match the pattern you used.

One thing I'd like is to be able to put the new defaults in a list, 
because this code is going to show up in about a dozen places, and I 
don't want to have to edit all of them when the arg list of the low 
level function changes.  So really I want something like

newArgs(..., newDefaults)

where newDefaults is a tagged list (e.g. list(longname = 2) for the 
example below), and the return value is a list containing all the names 
in newDefaults, perhaps with their values modified according to the args 
passed in ... .

In the actual use newDefaults would be the result of a function call 
(the user will have made some configuration choices and I want those to 
be used as defaults to another function) but that's not so important 
here.  I'd like the wrapper to be a bit like par(), though I notice that 
par() doesn't accept partial name matching so maybe I'm worrying about 
something I shouldn't.

Duncan Murdoch