Re: [R] cast function in package reshape

2009-04-17 Thread hadley wickham
On Fri, Apr 17, 2009 at 8:38 AM, David Hajage wrote: > Hello R useRs, > > I have a function which returns a list of functions : > > freq1 <- function(x) { >  lev <- unique(x[!is.na(x)]) >  nlev <- length(lev) >  args <- alist(x=) > >  if (nlev == 1) { >    body <- c("{", "sum(!is.na(x))", "}") >  

[R] cast function in package reshape

2009-04-17 Thread David Hajage
Hello R useRs, I have a function which returns a list of functions : freq1 <- function(x) { lev <- unique(x[!is.na(x)]) nlev <- length(lev) args <- alist(x=) if (nlev == 1) { body <- c("{", "sum(!is.na(x))", "}") f <- function() {} formals(f) <- as.pairlist(args) body(f)