Re: [R] Sorting a data frame when you don't know the columns

2006-11-28 Thread Peter Dalgaard
Gabor Grothendieck wrote: > DF <- data.frame(a = c(3, 4, 2, 3, 2, 4, 2), b = 7:1)) > DF[do.call(order, DF),] > > will sort on all the columns. ... and you can use DF[do.call(order, DF[names]),] if you have the column names in a character vector. > > On 11/28/06, michael watson (IAH-C) <[EMAIL P

Re: [R] Sorting a data frame when you don't know the columns

2006-11-28 Thread michael watson \(IAH-C\)
Thanks guys, sorted now :) From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Tue 28/11/2006 11:05 AM To: Gabor Grothendieck Cc: michael watson (IAH-C); r-help@stat.math.ethz.ch Subject: Re: [R] Sorting a data frame when you don't know the columns

Re: [R] Sorting a data frame when you don't know the columns

2006-11-28 Thread Dimitris Rizopoulos
" <[EMAIL PROTECTED]> To: Sent: Tuesday, November 28, 2006 11:45 AM Subject: [R] Sorting a data frame when you don't know the columns > Hi > > Sorry to ask such a well oiled question, but even with multiple > google hits I don't think this has been answered very

Re: [R] Sorting a data frame when you don't know the columns

2006-11-28 Thread Gabor Grothendieck
DF <- data.frame(a = c(3, 4, 2, 3, 2, 4, 2), b = 7:1)) DF[do.call(order, DF),] will sort on all the columns. On 11/28/06, michael watson (IAH-C) <[EMAIL PROTECTED]> wrote: > Hi > > Sorry to ask such a well oiled question, but even with multiple google hits I > don't think this has been answered

[R] Sorting a data frame when you don't know the columns

2006-11-28 Thread michael watson \(IAH-C\)
Hi Sorry to ask such a well oiled question, but even with multiple google hits I don't think this has been answered very well. It's all well and good doing a sort of a data frame on multiple columns when you know in advance which columns you want to sort on, but what about when the names of