cut() on NA gives 0 when labels=F

David Brahm brahm@alum.mit.edu
Tue, 15 Oct 2002 18:52:19 -0400


Hi all,

I just noticed this odd behavior in R 1.5.1 (on Solaris 2.6):

  R> cut(c(2,NA), 1:5, labels=F)
     [1] 1 0

Is it a bug?  I would have expected "1 NA" (better for indexing), and also the
S-Plus analog is:

  S-Plus> as.integer(cut(c(2,NA), 1:5))
     [1]  1 NA

Apologies ahead of time if it's already fixed in R 1.6.0 and/or already known
(perhaps related to PR#1694?).  If others agree it's a bug I'll submit it.
-- 
                              -- David Brahm (brahm@alum.mit.edu)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._