[R] Retrieve ... argument values

Thomas Lumley tlumley at u.washington.edu
Tue Sep 16 16:40:45 CEST 2003


On Tue, 16 Sep 2003 huan.huang at bnpparibas.com wrote:

>
> Dear R users,
>
> I want to retrieve "..." argument values within a function. Here is a small
> exmaple:
>
> myfunc <- function(x, ...)
> {
>       if (hasArg(ylim))  a <- ylim
>       plot(x, ...)
> }
>

One solution is
    dots<-substitute(list(...))
    a<-dots$ylim

which sets a to NULL if there is no ylim argument and to the ylim argument
if it exists

	-thomas




More information about the R-help mailing list