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...
group1<-rep(1:3,each=nr[1,])
group2<-rep(1:3,each=nr[2,])
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
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.