Unexpected dimnames attribute returned by cbind/rbind

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unexpected dimnames attribute returned by cbind/rbind

Hervé Pagès-2
Hi,

   > m5 <- cbind(integer(5), integer(5))
   > m5
        [,1] [,2]
   [1,]    0    0
   [2,]    0    0
   [3,]    0    0
   [4,]    0    0
   [5,]    0    0
   > dimnames(m5)
   NULL

No dimnames, as expected.

   > m0 <- cbind(integer(0), integer(0))
   > m0
        [,1] [,2]
   > dimnames(m0)
   [[1]]
   NULL

   [[2]]
   NULL

Unexpected dimnames attribute!

rbind'ing empty vectors also returns a matrix with unexpected
dimnames:

   > dimnames(rbind(character(0), character(0)))
   [[1]]
   NULL

   [[2]]
   NULL

Cheers,
H.

--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: [hidden email]
Phone:  (206) 667-5791
Fax:    (206) 667-1319

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel