[Rd] na.omit fails for matrices (PR#522)

sergei@stams.strath.ac.uk sergei@stams.strath.ac.uk
Mon, 17 Apr 2000 12:53:20 +0200 (MET DST)


Dear R-core team,
I came across the following bug (feature?):
Modyfying example from help(na.omit):
> ( m<-matrix(c(1, 2, 3, 0, 10, NA),ncol=2) )
     [,1] [,2]
[1,]    1    0
[2,]    2   10
[3,]    3   NA
> ( mo<- na.omit(m) )
     [,1] [,2]
attr(,"na.action")
[1] 1
attr(,"na.action")attr(,"class")
[1] "omit"  
> dim(mo)
[1] 0 2        
> is.matrix(mo)
[1] TRUE                                                                       

So the result is an empty matrix! On the other hand   
> na.omit(as.data.frame(m))
  V1 V2
1  1  0
2  2 10                                                                        


works fine. help(na.omit) does not say that matrix is not a valid argument. At 
least in na.omit in Splus it is valid.
I have tested this in R-1.0.0 and development version R-1.1 under LINUX, 
Solaris and MSWindows.

Best wishes,
Sergei

=================================================================
                           Dr. Sergei ZUYEV
Statistics and Modelling Science dept., University of Strathclyde
    Livingston Tower, 26 Richmond str., Glasgow, G1 1XH, U.K.
     Tel.: +44 (0)141 548 3663    Fax:  +44 (0)141 552 2079
E-mail: sergei@stams.strath.ac.uk   http://www.stams.strath.ac.uk
=================================================================


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._