[R] Error in defining function
Megh Dal
megh700004 at yahoo.com
Sun Jul 6 21:19:23 CEST 2008
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,
More information about the R-help
mailing list