[R] order with NAs
Thomas Lumley
tlumley at u.washington.edu
Tue Sep 24 20:29:33 CEST 2002
On Tue, 24 Sep 2002, Remigijus Lapinskas wrote:
>
> I want to rate Names by Score. However, NAs pop up to the
> upper rows when doing
>
> > data.frame(Rating=1:dim(test)[1],test[rev(order(test$Score)),])
> Rating Name Score
> 4 1 d NA
> 2 2 b NA
> 5 3 e 10
> 1 4 a 7
> 3 5 c 5
>
> Is there an elegant way to place NAs in the lowest rows? And BTW how
> can I remove the first column of 4, 2, 5 etc?
If you look at the help page for order() you will find the option to put
NAs at the end.
-thomas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list