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" <[EMAIL PROTECTED]>
To: <r-help@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@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



______________________________________________ R-help@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

Reply via email to