[R] Error in defining function

From: Megh Dal <megh700004_at_yahoo.com>
Date: Sun, 06 Jul 2008 12:19:23 -0700 (PDT)


Can anyone please tell me why I am getting this error?

library(zoo)
Z.index <- as.Date(sample(12450:15500, 3000)) Z.data <- matrix(rnorm(300), ncol = 1)

data1 <- zoo(Z.data, Z.index)

fnc = function(data1)

    {
    selection2 = select.list(c("Mean"), multiple = F)

     Mean = function(dataa) mean(dataa)

     return(aggregate(data1, as.yearqtr, selection2))     }     

    fnc(data1)

I got following error :
Error in get(as.character(FUN), mode = "function", envir = envir) :   variable "Mean" of mode "function" was not found

What would be the correct way?

Regards,



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 Sun 06 Jul 2008 - 19:24:35 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 Sun 06 Jul 2008 - 20:33:27 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