Re: [R] factors ordered by mean

2008-02-21 Thread Ronaldo Reis Junior
Em Qua 20 Fev 2008, Henrique Dallazuanna escreveu: > Try this: > factor(pH,levels=names(sort(tapply(Riqueza,pH,mean > Thanks it work Ronaldo -- > Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribei

Re: [R] factors ordered by mean

2008-02-20 Thread hadley wickham
On Wed, Feb 20, 2008 at 6:02 PM, Ronaldo Reis Junior <[EMAIL PROTECTED]> wrote: > Hi, > > How to order the levels os factor not by alphabetic order but by mean of Y. > Somethink like this: > > I have this alphabetic order: > > > levels(pH) > [1] "alto" "baixo" "medio" > > the order by mean o

Re: [R] factors ordered by mean

2008-02-20 Thread Henrique Dallazuanna
Try this: factor(pH,levels=names(sort(tapply(Riqueza,pH,mean 2008/2/20, Ronaldo Reis Junior <[EMAIL PROTECTED]>: > Hi, > > How to order the levels os factor not by alphabetic order but by mean of Y. > Somethink like this: > > I have this alphabetic order: > > > levels(pH) > [1] "alto" "baixo"

[R] factors ordered by mean

2008-02-20 Thread Ronaldo Reis Junior
Hi, How to order the levels os factor not by alphabetic order but by mean of Y. Somethink like this: I have this alphabetic order: > levels(pH) [1] "alto" "baixo" "medio" the order by mean os yvar is: > sort(tapply(Riqueza,pH,mean)) baixomedio alto 11.56667 20.0 26.8 How