Hervé Pagès
2017-Dec-22 08:57 UTC
[Rd] Unexpected dimnames attribute returned by cbind/rbind
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: hpages at fredhutch.org Phone: (206) 667-5791 Fax: (206) 667-1319