Vincy Pyne
2011-Mar-28 21:03 UTC
[R] Resending the mail - Ordering data.frame based on some class
Dear R helpers I am resending my mail as the output I desire was not properly visible and I apologize for the same. Suppose I have a data.frame as given below - my_dat = data.frame(class = c("XYZ", "XYZ", "XYZ", "XYZ", "XYZ","ABC", "ABC", "ABC", "ABC", "ABC" ), var1 = c(20, 14, 89, 81, 17, 44, 36, 41, 11, 36), var2 = c(1001, 250, 456, 740, 380, 641, 111, 209, 830, 920))> my_datclass var1 var2 1 XYZ 20 1001 2 XYZ 14 250 3 XYZ 89 456 4 XYZ 81 740 5 XYZ 17 380 6 ABC 44 641 7 ABC 36 111 8 ABC 41 209 9 ABC 11 830 10 ABC 20 920 I wish to sort above data.frame class-wise on var1. Thus, Ineed to get class var1 var2 XYZ 14 250 XYZ 17 380 XYZ 20 1001 XYZ 81 740 XYZ 89 456 ABC 11 830 ABC 20 920 ABC 36 111 ABC 41 209 ABC 44 641 Regards Vincy [[alternative HTML version deleted]]