[Rd] is.integer and rank
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
23 Oct 2000 12:20:07 +0200
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._