From p.dalgaard@biostat.ku.dk  Mon Oct 23 11:20:07 2000
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 23 Oct 2000 12:20:07 +0200
Subject: [Rd] is.integer and rank
In-Reply-To: Torsten Hothorn's message of "Mon, 23 Oct 2000 12:01:15 +0200 (CEST)"
References: <Pine.LNX.4.21.0010231157110.12947-100000@artemis.imbe.med.uni-erlangen.de>
Message-ID: <x2k8az3lm0.fsf@blueberry.kubism.ku.dk>

Torsten Hothorn <Torsten.Hothorn@rzmail.uni-erlangen.de> writes:

> Hello, 
> 
> why does
> 
> > test <- rank(sample(10))
> > test
>  [1]  4  8  9 10  2  1  7  6  3  5
> > is.integer(test)
> [1] FALSE
> > is.double(test)
> [1] TRUE
> 
> make sense in R-1.1.1?  

Ranks have to be able to include non-integers, hence storage mode
double

> rank(c(1,2,2,3))
[1] 1.0 2.5 2.5 4.0

More confusing is:

> is.integer(1)
[1] FALSE

> is.integer(1:1)
[1] TRUE

(both of which is for a reason, although I have temporarily forgotten
why we make integer sequences integer.... Speed issues, possibly)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] is.integer and rank
Peter Dalgaard BSA