[R] Slight problem in sort

Peter Dalgaard BSA
Wed, 06 Aug 2003 21:35:15 -0000

Frank E Harrell Jr <fharrell at virginia.edu> writes:

> I get
>
> > sort(c(3,1,NA))
> [1] 1 3
>
> Shouldn't NAs be retained by default?

Not according to the documentation...

     sort(x, partial = NULL, na.last = NA, decreasing = FALSE,
          method = c("shell", "quick"), index.return =
FALSE)

 na.last: for controlling the treatment of `NA's. If `TRUE', missing
          values in the data are put last; if `FALSE', they are put
          first; if `NA', they are removed.


--
   O__  ---- Peter Dalgaard             Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907