This is from some R code that worked at one time, and I can't figure what changed.
I want to use the aggregate()
function to find the mean, sd, and length of the columns in the PlantGrowth
data table.
library("datasets")
data("PlantGrowth")
aggregate(weight ~ group, data = PlantGrowth, mean)
aggregate(weight ~ group, data = PlantGrowth, sd)
aggregate(weight ~ group, data = PlantGrowth, length)
The first two work, producing the mean and standard deviation. The last one doesn't, giving me the error
Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'FUN' of mode 'function' was not found
As far as I know, you can find the lengths (which is the number of observations, 10) using this method...or at least can't figure out why you can't.