[R] writing function with ,... )

Carmen Meier carmei3 at web.de
Fri Dec 1 11:51:47 CET 2006


Thanks, a lot
I was not able to find it the hole day ...
Carmen

Phil Spector schrieb:
> Carmen -
>    You certainly can write functions that use ..., but you need
> to extract the arguments that the dots represent with list().
> Here's a modified version of your function that may help explain
> how this feature works.
>
> test <- function(x,...){
>     print(x)
>     args = list(...)
>     if('y' %in% names(args))print(args$y)
>     if('z' %in% names(args))print(args$z)
> }
>
>                                        - Phil Spector
>                      Statistical Computing Facility
>                      Department of Statistics
>                      UC Berkeley
>                      spector at stat.berkeley.edu
>
>




More information about the R-help mailing list