[R] Sorting problem
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Sat Mar 28 02:50:17 CET 2009
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-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Jun Shen [jun.shen.ut at gmail.com]
Sent: 28 March 2009 08:26
To: r-help at 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 at 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.
More information about the R-help
mailing list