[R] sorting with criteria that are "out of order"
Niels Steen Krogh
nielssteenkrogh at zitelab.dk
Mon Mar 19 17:31:39 CET 2007
I try to sort this dataframe:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] "CM" "BARBY" "INCREASED" " 0" " 2" " 0" " 1" " 1"
[2,] "CM" "BARBY" "REDUCED" " 0" " 1" " 2" " 2" " 5"
[3,] "CM" "BARBY" "STANDARD" " 93" " 51" " 56" " 41" " 77"
[4,] "CM" "BONBON" "INCREASED" " 43" " 30" " 39" " 32" " 58"
[5,] "CM" "BONBON" "REDUCED" " 4" " 3" " 6" " 4" " 10"
[6,] "CM" "BONBON" "STANDARD" "200" "141" "127" " 73" "134"
[7,] "RAR" "BARBY" "INCREASED" " 4" " 1" " 3" " 1" " 5"
[8,] "RAR" "BARBY" "REDUCED" " 5" " 7" " 8" " 9" " 16"
[9,] "RAR" "BARBY" "STANDARD" "571" "286" "314" "270" "467"
[10,] "RAR" "BONBON" "INCREASED" " 49" " 92" "108" "154" "240"
[11,] "RAR" "BONBON" "REDUCED" " 11" " 9" " 5" " 6" " 18"
[12,] "RAR" "BONBON" "STANDARD" "978" "627" "571" "324" "541"
I want the sorting criteria:
Column 1: CM before RAR
Column 2: BONBON before BARBY
Column 3: REDUCED before STANDARD before INCREASED
Have played with the "order" function but without being able to "sort out" how
to sort using information in column three.
/Niels
Niels Steen Krogh
Konsulent
ZiteLab ApS
Mail: ---------- nielssteenkrogh at zitelab.dk
Telefon: ------- +45 38 88 86 13
Mobil: --------- +45 22 67 37 38
Adresse: ------- ZiteLab ApS
---------------- Solsortvej 44
---------------- 2000 F.
Web: ----------- www.zitelab.dk
ZiteLab
-Let's Empower Your Data with Webservices
More information about the R-help
mailing list