Displaying 1 result from an estimated 1 matches for "285087".
Did you mean:
28087
2004 Jul 14
2
using "mean" in by(x,y,mean)
Dear list friends
I fail to understand how to find means for multiple groups using the
by() function. Help would be appreciated. Thanks.
Bill
x <- runif(20,0,10)
group <- rep(c("A","B"),10)
df <-data.frame(x,group)
#df #show the data
rm(x,group)
attach(df)
sd(x) # sd is defined
mean(x) #so is mean
by(x,group,sd) #this works for both groups