Perhaps BA[, 2] is a factor?  What you might need is something like

BA[order(BA[, 1], -as.numeric(BA[, 2]), ]

?

Bill Venables.
________________________________________
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
Jun Shen [jun.shen...@gmail.com]
Sent: 28 March 2009 08:26
To: r-h...@stat.math.ethz.ch
Subject: [R] Sorting problem

Hi, everyone,

I was trying to sort a data frame by two columns, one increasing, the other
decreasing  and got an error.

"Error in FUN(left) : invalid argument to unary operator",

The command is "BA[order(BA[1],-BA[2]),]". BA is the data frame. It was
working if I used increasing on both columns.

Why the decreasing symbol "-" is not working here? Thanks.

--
Jun Shen PhD
PK/PD Scientist
BioPharma Services
Millipore Corporation
15 Research Park Dr.
St Charles, MO 63304
Direct: 636-720-1589

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to