Thanks Tony (and others), for getting me started. I eventually ended up with:
TopLevel$build_accessor <- function(., extra_args = c()) {
layer <- if (.$class() %in% c("geom","stat", "position")) c(
list(mapping=NULL,data=NULL),
compact(list(
geom = if (exists("default_geom", .)) .
Maybe something like this? (though it seems like it might be more
straightforward to do this sort of thing by text-processing a source
file then source'ing it in R).
> f <- function(a, b, c) c(a=a,b=b,c=c)
> attr(f, "source") <- NULL
> f
function (a, b, c)
c(a = a, b = b, c = c)
> g1 <- f
>
On Sat, Feb 23, 2008 at 5:52 PM, Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:
> I assume he wants to be able to change the
> formals although its confusing since the example
> uses the same formals in both cases.
Yes, that was an important point that I forgot to mention! Thanks for
the pointer
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 <[EMAIL PROTECTED]> wrote:
> Dear Hadley,
>
> Why not just f <- g ?
>
> Regards,
> John
>
>
>
formals can be used like this:
f <- g
formals(f) <- pairlist(a=1,b=2,c=3)
On Sat, Feb 23, 2008 at 5:40 PM, hadley wickham <[EMAIL PROTECTED]> wrote:
> 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
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: [EMAIL PROTECTED] [mailto