[R] Getting mean in a dataframe
James D Forester
jdforest at uchicago.edu
Wed Nov 14 00:06:30 CET 2007
Gang Chen-3 wrote:
> Sorry to hijack this thread. I have a similar but slightly different
> situation. Using the original poster's example, how to elegantly get
> the mean of column V2 when column V1 is either A or C and F1 is 0?
I am not sure if this is elegant, but it works:
a=mean(mydat$V2[mydat$F1==0 & mydat$V1 %in% ("A","C")])
View this message in context: http://www.nabble.com/Getting-mean-in-a-dataframe-tf4801030.html#a13736727
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help