On Wed, 16 Jul 2003 14:42:09 +0100, Wayne Jones <[EMAIL PROTECTED]>
wrote :

>
>Hi there R-Helpers, 
>
>Does anyone know if it is possible to sort a dataframe?
>
>I.e. Sort alphabetically column 1 ( which has some reocurring elements) then
>sort alphabetically column2 but keeping the order of column 1 constant; 
>much the same way that the sort function works in Excel.

The general idea is to use order():

sorted <- unsorted[order(unsorted$col1, unsorted$col2),]

Duncan Murdoch

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to