[R] passing arguments to multiple functions
Elizabeth Purdom
epurdom at stat.Berkeley.EDU
Thu Mar 1 23:35:40 CET 2007
Hi,
I am writing a function and I want to pass arguments to a function I
will call internally without having to specify all the possible
arguments to pass. Usually I would use '...' but I want to do this for
two functions that I will call, and the two functions do not take the
same arguments. So I would like a call to my function to look like this:
> myfunc(x, fun1Args, fun2Args)
where fun1Args would be a list of arguments to pass to the first
function and fun2Args would be list of arguments to pass to the second
function. The problem is that I don't know how to write 'myfunc' so that
I can input these elements into the calls I will make to the two
functions. I certainly don't want to have to specify all the possible
values and input them manually (for example if one of the functions is a
plotting function!) I know I've run across functions that require you to
pass arguments in a list like this, but the only one I can remember is
'mapply' which calls a C function so it doesn't help me figure out how
to parse/send the arguments to the functions. Is this possible to do
within R? Or is there a way to parse the '...' so that only the right
arguments go to the right function?
Thanks,
Elizabeth
More information about the R-help
mailing list