[R] Double sort a data frame

Jan Goebel jgoebel at diw.de
Fri Feb 11 14:09:40 CET 2005


Hi,
you can use order, like

DATA <- DATA[order(DATA$V1, DATA$V2), ]

best
jan

On Fri, 11 Feb 2005, Luis Ridao Cruz wrote:

> R-help,
> 
> Long ago I asked how to sort a data frame according to one of the
> columns.
> But Iwas wondering ho I could "double sort" , i.e, sort according to
> one column and another one afterwards.
> It is quite easy in Excel but  I am unable to implemented in R.
> 
> 
> I have searched in the R help archives and found nothing.
> 
> 
> Thank you in advance.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
+-----------------------------------------
 Jan Goebel 
 j g o e b e l @ d i w . d e

 DIW Berlin 
 German Socio-Economic Panel Study (GSOEP) 
 Königin-Luise-Str. 5
 D-14195 Berlin -- Germany --
 phone: 49 30 89789-377
+-----------------------------------------




More information about the R-help mailing list