[R] passing a list where names arguments are expected

Kaom Te sickfaichezi at gmail.com
Mon Oct 20 05:09:18 CEST 2008


I believe you want

do.call(f, list(a =..., b=...))

?do.call
-Kaom
On Oct 19, 2008, at 7:55 PM, erwann rogard wrote:

> hi,
>
> say i have a function f and i'd like to to call it like this:
>
> 1) f(list(a=...,b=...))
>
> but i can't do it, because f is defined as:
>
> 2) f<-function(a=NULL,b=NULL){...}
>
> is there a way that i can approximate 1), such as mapping  
> list(a=,...b=...)
> to "list(a=,...b=...)" and then replacing "list" by "f", and then  
> evaluating
> the expression?
>
> thanks.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list