[R] how do I get means by factor?

Gabor Grothendieck ggrothendieck at myway.com
Thu Feb 24 05:05:17 CET 2005


Chris <grover2160 <at> metrocast.net> writes:

: 
: I want the mean of a response variable for each level of a factor in a
: data.frame.  How is this done?

In addition to the tapply suggestion already given you can use
summary in package Hmisc:

summary(y ~ f)




More information about the R-help mailing list