Re: [R] Odp: question about "mean"

2010-06-15 Thread Allan Engelhardt
This solution also seems to be the fastest of the proposed options for this data set: library("rbenchmark") benchmark(columns = c("test", "elapsed", "relative"), order = "elapsed", apply =apply(iris[, -5], 2, tapply, iris$Species, mean), with = with(iris, rowsum(iris[, -5], S

[R] Odp: question about "mean"

2010-06-10 Thread Petr PIKAL
Hi split/sapply can be used besides other options sapply(split(iris[,1:4], iris$Species), mean) Regards Petr r-help-boun...@r-project.org napsal dne 10.06.2010 00:43:29: > Hi there: > I have a question about generating mean value of a data.frame. Take > iris data for example, if I have a