Re: [R] multiple functions with three dots

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Sat, 02 Feb 2008 17:03:27 +1100

John Lande wrote:
> Dear all,
>
> I am creating functions with the "three dot" strategy. I wold like to have
> suggestion when writing multiple functions that calls multiple functions
> with "...".
>
> I will give you a couple of example:
>
>

>>a=1:5
>>b=6:10
>>d=3:7

>
>
>>example=function(x,y, z, ...){

>
> plot(x,y, ...)
> points(x,z, ...)
>
> }
>
>
>>example(a,b,d)

>
>
> how can I set different parameters for points and plot functions? for
> example in plot I want to have bigger dots (lwd=3), while in the points I
> want to have green dots.
>
> any suggestion?
>
Hi John,
There are probably better solutions to this problem, but I usually add explicit arguments like this:

example<-function(x,y,z,y.lwd,z.col,...) {   ...
  plot(x,y,lwd=y.lwd,...)
  points(x,z,col=z.col)
  ...
}

Jim



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 Sat 02 Feb 2008 - 06:02:03 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 Sat 02 Feb 2008 - 09:30:09 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