My code, which was running without problems before, crashed when calling the dcast formula. After playing around, I found out that even the minimal example from the help page of dcast does not work for me anymore. More precisely:
#Air quality example
names(airquality) <- tolower(names(airquality))
aqm <- melt(airquality, id=c("month", "day"), na.rm=TRUE)
acast(aqm, day ~ month ~ variable)
acast(aqm, month ~ variable, mean)
The last line produces the following error:
Error in vaggregate(.value = value, .group = overall, .fun = fun.aggregate, :
could not find function ".fun"
Here is my sessionInfo():
R version 2.13.1 (2011-07-08)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_0.8.9 proto_0.3-9.2 reshape2_1.1 xtable_1.5-6 reshape_0.8.4 plyr_1.5.2 lubridate_0.2.5
loaded via a namespace (and not attached):
[1] stringr_0.5 tools_2.13.1
I don't come up with a satisfying answer of what is going wrong here, so I would appreciate some help. Also, I found the following thread here on stackoverflow: Similar problem This problem seems to result from a custom function. I, however, use the standard mean function and a standard example from the help page.
UPDATE: I just did some internet research and did not find any information regarding an update of the reshape2 package. This was the best guess I had regarding the problem.
UPDATE2: The problem occurred because I most probably reassigned the mean function while I was playing around with a statisctic example during an R session. Restarting R solved the problem. Now, everything works as expected again.