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

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Fri Apr 1 16:11:16 CEST 2005


look at "?order()", e.g.,

dat[order(dat[,1]),]

will sort your data.frame wrt the first column.

I hope it helps.


Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Mario Morales" <malfonso at telecom.com.co>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, April 01, 2005 5:22 AM
Subject: [R] a R function for sort a data frame.


> 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.
>
> ______________________________________________
> 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
>




More information about the R-help mailing list