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 varian

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

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

2011-08-25 Thread Coghlan, Avril
Hello, I have been looking for functions for calculating the within-groups variance and between-groups variance, for the case where you have several numerical variables describing samples from a number of groups. I didn't find such functions in R, so wrote my own versions myself (see below). I ca