Re: [R] Ordering data.frame based on class

2011-03-28 Thread Vincy Pyne
Dear sir, Thanks for the great solution. Regards Vincy --- On Mon, 3/28/11, Henrique Dallazuanna wrote: From: Henrique Dallazuanna Subject: Re: [R] Ordering data.frame based on class To: "Vincy Pyne" Cc: r-help@r-project.org Received: Monday, March 28, 2011, 9:02 PM Try thi

Re: [R] Ordering data.frame based on class

2011-03-28 Thread Henrique Dallazuanna
Try this: my_dat[order(my_dat$class, -my_dat$var1, decreasing = TRUE),] On Mon, Mar 28, 2011 at 5:55 PM, Vincy Pyne wrote: > Dear R helpers > > 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" ),