[R] a R function for sort a data frame.

Romain Francois francoisromain at free.fr
Fri Apr 1 17:23:58 CEST 2005


Le 01.04.2005 05:22, Mario Morales a écrit :

> Is there a R function for sort a data frame by a variable ?
>
> I know sort a vector, but I don't know sort a data frame by a
> column. Can you help me ?
>
> the sort() function don't  work with data frame.
>
take a look at ?order  as in :
A <- data.frame(x=c(1,6,3),y=c(2,4,9))
A[order(A$x),]

-- 
Romain FRANCOIS : francoisromain at free.fr
page web : http://addictedtor.free.fr/  (en construction)
06 18 39 14 69 / 01 46 80 65 60
_______________________________________________________
Etudiant en 3eme année
Institut de Statistique de l'Université de Paris (ISUP)
Filière Industrie et Services
http://www.isup.cicrp.jussieu.fr/




More information about the R-help mailing list