Re: [R] within-groups variance and between-groups variance

2011-08-26 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Coghlan, Avril > Sent: 25 August 2011 16:02 > To: r-help@r-project.org > Cc: Coghlan, Avril > Subject: [R] within-groups variance and between-groups variance > > Hello, > > I ha

Re: [R] within-groups variance and between-groups variance

2011-08-25 Thread Daniel Malter
#Here is I think an easier way of coding all the components you need. #The within-group variances, you get with this function: apply(iris[,1:4],2,function(x) tapply(x,iris$Species,var)) #You can get what you computed by taking the column means. apply(apply(iris[,1:4],2,function(x) tapply(x,iri