[R] Retrieve ... argument values

Liaw, Andy andy_liaw at merck.com
Tue Sep 16 16:54:39 CEST 2003


Try:

 myfunc <- function(x, ...)
 {
       if (hasArg(ylim))  a <- ...$ylim
       plot(x, ...)
 }

HTH,
Andy

> -----Original Message-----
> From: huan.huang at bnpparibas.com [mailto:huan.huang at bnpparibas.com] 
> Sent: Tuesday, September 16, 2003 10:14 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Retrieve ... argument values
> 
> 
> 
> 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, ...)
> }
> 
> x <- rnorm(100)
> myfunc(x, ylim=c(-0.5, 0.5))
> Error in myfunc(x, ylim = c(-0.5, 0.5)) : Object "ylim" not found
> >
> 
> I need to retrieve values of "ylim" (if it is defined when 
> function is called) for later use in the function. Can 
> anybody give me some hint?
> 
> Thanks a lot.
> 
> Huan
> 
> 
> 
> 
> This message and any attachments (the "message") is\ 
> intende...{{dropped}}
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 

------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list