Re: [R] means and variances of several groups in the matrix

From: Jim Lemon <>
Date: Mon, 21 Apr 2008 20:31:41 +1000

kathie wrote:
> Dear R users,
> I have 32 observations in data x. After sorting this, I want to compute
> means and variances of 3 groups divided by "nr".
> Actually, the number of groups is flexible. Any suggestion will be greatly
> appreciated.
Hi Kathryn,
One way (there are many others) is to use the brkdn function in the prettyR package. You have to create a grouping variable, but it's pretty easy...

y.df<-data.frame(y=y,group1=group1,group2=group2) brkdn(y~group1,y.df,num.desc=c("mean","var")) brkdn(y~group2,y.df,num.desc=c("mean","var"))

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 21 Apr 2008 - 10:31:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Apr 2008 - 11:30:31 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive