Displaying 1 result from an estimated 1 matches for "grmean".
Did you mean:
gmean
2010 Feb 03
1
Calculating subsets "on the fly" with ddply
...data. So, for iris data, let me try to take the mean of the
Petal.Width on subsets of data as grouped by:
("some range" of sepal.length, and species).
The "normal" ddply invocation would look like so:
R> my <- ddply(iris, .(w=Sepal.Length < 5.5, Species), transform,
grmean=mean(Petal.Width))
R> head(my)
w Sepal.Length Sepal.Width Petal.Length Petal.Width Species grmean
1 FALSE 5.8 4.0 1.2 0.2 setosa 0.260000
2 FALSE 5.7 4.4 1.5 0.4 setosa 0.260000
3 FALSE 5.7 3...