Re: [R] recursive do.call

From: Felix Andrews <felix_at_nfrac.org>
Date: Mon, 14 Mar 2011 21:34:57 +1100

It is complicated if the argument list is all mixed in together as in your example. You would have to look up argument lists for possible S3 methods (e.g. 'digits' is an argument to print.default), and then there is S4 to think about. Also, can arguments be matched by partial names? Can they be given in the argument list without a name?

My point is that you had better have a good reason to want to do it this way...

Cheers
Felix

On 14 March 2011 14:24, Jeroen Ooms <jeroenooms_at_gmail.com> wrote:
> I would like to define a recursive equivalent to call or do.call, which takes
> a vector of multiple function names and 'chains' them, by greedy matching of
> arguments down the chain. For example, I would like to be able to do:
>
> rec.do.call(c("glm","coef","print), list(formula=dist~speed, digits=3,
> data=cars));
>
> which would then be equivalent to:
>
> print(coef(glm(formula=dist~speed, data=cars)), digits=3);
>
> I've been playing around with a recursive function with ellipses, but I
> can't wrap my head around it.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/recursive-do-call-tp3353074p3353074.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Felix Andrews / 安福立
http://www.neurofractal.org/felix/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 14 Mar 2011 - 10:40:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Mar 2011 - 20:20:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive