Re: [R] multiple functions with three dots

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Fri, 1 Feb 2008 11:46:21 -0700

You can try something like:

>a <- 1:5
>b <- 6:10
>d <- 3:7

>example <- function(x,y, z, ..., plot.dots, points.dots){

   plot.list <- list(x=x,y=y)
   plot.list <- c(plot.list,list(...), as.list(plot.dots))    do.call(plot, plot.list)

   points.list <- list(x=x,y=z)
   points.list <- c(points.list, list(...), as.list(points.dots) )    do.call(points, points.list)

}

>example(a,b,d, pch=0, plot.dots=list(cex=2),
points.dots=list(col='green'))

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces@r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of John Lande
> Sent: Friday, February 01, 2008 7:34 AM
> To: r-help_at_r-project.org
> Subject: [R] multiple functions with three dots
>
> 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?
>
>
> thank you.
>
> [[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.
>
______________________________________________ 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 Fri 01 Feb 2008 - 18:50:44 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 Fri 01 Feb 2008 - 19:30:11 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