[R] order by decerasing 1st variable and increasing 2nd variable

2009-06-24 Thread Daniel Brewer
Hello, I have a data.frame which I would like to sort with the primary key decreasing while the secondry key is increasing e.g. x - data.frame(One=c(1,1,1,2,2,3,4,5),Two=c(2,3,1,2,3,3,3,3)) I would like to order it so it looks like this: One Two 8 5 3 7 4 3 6 3 3 4 2 2 5 2

Re: [R] order by decerasing 1st variable and increasing 2nd variable

2009-06-24 Thread Ronggui Huang
How about this: x[order(x$One,-x$Two,decreasing=T),] One Two 8 5 3 7 4 3 6 3 3 4 2 2 5 2 3 3 1 1 1 1 2 2 1 3 2009/6/24 Daniel Brewer daniel.bre...@icr.ac.uk: Hello, I have a data.frame which I would like to sort with the primary key decreasing while the