Up to including R 3.0.2, the following was possible to calculate the overall mean:
dat <- data.frame(Y=runif(10), X=sample(LETTERS[1:3], 10, TRUE))
aggregate(Y ~ 1, FUN=mean, data=dat)
In R 3.0.3RC, this error is returned:
Error in split.default(e, grp) : group length is 0 but data length > 0
I cannot pinpoint the release from where this failed, but it was before 3.0.3RC.
Fixed in R-devel (to become 3.1.0). Too late to slip into 3.0.3.