[R] rank function and NA in 2.3.1

From: Talbot Katz <topkatz_at_msn.com>
Date: Thu 11 Jan 2007 - 23:29:16 GMT


Hi.

I am using R 2.3.1 on WIndows XP, and I am having trouble with the rank function in the presence of numerical NA data. I want the NA's all to get the same rank, but they don't. Here is an example from my session:

>ct_align_rets_f2$liq[6851:6859]

[1] 115396 NA 362595 NA 242986 340805 NA 692905 251533
>rankl=rank(ct_align_rets_f2$liq,na.last=FALSE,ties.method="min")
>rankl[6851:6859]

[1] 4392 2424 5535 2425 5037 5451 2426 6625 5082

What am I doing wrong? Is there a way to check whether there's a problem with the data, i.e., somehow the NA's have different values? (By the way, I have tried not using na.last, and also different ties.methods, but the NA ranks have never come out equal.)

Thanks!


R-help@stat.math.ethz.ch 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. Received on Fri Jan 12 10:36:42 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 12 Jan 2007 - 07:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.