From ggrothendieck at gmail.com  Sun Feb 24 00:52:22 2008
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Sat, 23 Feb 2008 18:52:22 -0500
Subject: [Rd] Aliasing a function
In-Reply-To: <000001c87674$4cd1a230$e674e690$@ca>
References: <f8e6ff050802231440xcbe8597yf99b2fb83e9c2ca3@mail.gmail.com>
	<000001c87674$4cd1a230$e674e690$@ca>
Message-ID: <971536df0802231552r3295c86n95cd5322aaa18d3b@mail.gmail.com>

I assume he wants to be able to change the
formals although its confusing since the example
uses the same formals in both cases.

On Sat, Feb 23, 2008 at 6:32 PM, John Fox <jfox at mcmaster.ca> wrote:
> Dear Hadley,
>
> Why not just f <- g ?
>
> Regards,
>  John
>
> --------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada L8S 4M4
> 905-525-9140x23604
> http://socserv.mcmaster.ca/jfox
>
>
>
> > -----Original Message-----
> > From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
> > project.org] On Behalf Of hadley wickham
> > Sent: February-23-08 5:40 PM
> > To: R-devel
> > Subject: [Rd] Aliasing a function
> >
> > A simple way to alias a function is to do :
> >
> > g <- function(a = 1, b = 2, c = 3) a + b * c
> > f <- function(...) g(...)
> >
> > but formals (etc) is no longer very helpful.  Is there an easy way to
> > programmatically create:
> >
> > f <- function(a=1, b=2, c=3) g(a=a, b=b, c=c)
> >
> > This comes up in ggplot2 where I alias many functions to hide the fact
> > that I'm using proto in the background, and I'd like the aliased
> > functions to be a little more user friendly in terms of revealing what
> > are valid arguments (and also to match up with the rdoc files which I
> > am building).
> >
> > Any ideas?
> >
> > Thanks,
> >
> > Hadley
> >
> > --
> > http://had.co.nz/
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Aliasing a function
Gabor Grothendieck