[R] rank function and NA in 2.3.1

Talbot Katz topkatz at msn.com
Fri Jan 12 00:29:16 CET 2007


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!


--  TMK  --
212-460-5430	home
917-656-5351	cell



More information about the R-help mailing list