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

bogdan romocea br44114 at yahoo.com
Fri Apr 1 16:07:05 CEST 2005


dfr <- data.frame(sample(1:50,10),sample(1:50,10))
colnames(dfr) <- c("a","b")
dfr <- dfr[order(dfr$a),]
dfr <- dfr[order(-dfr$a),]



-----Original Message-----
From: Mario Morales [mailto:malfonso at telecom.com.co]
Sent: Thursday, March 31, 2005 10:23 PM
To: r-help at stat.math.ethz.ch
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