We still "forget" that dimnames(.) can be named in R, something IIRC Peter invented in the time before R 1.0.0 and we use "extensively" for producing nicely printing table(.) results. However our print function fails to combine this well when a matrix (or an array) in addition has zero extents. It seems, the printing is wrong only in the case where tail(dim(.), 1) == 0 : > r <- matrix(,0,4, dimnames=list(Row=NULL, Col=paste0("c",1:4))) ## a matrix with named dimnames and 0 rows -- prints fine: > r Col Row c1 c2 c3 c4 ## But not so with 0 columns : > t(r) c1 c2 c3 c4 > ## --------- Even worse for non-matrix arrays: > A <- array(dim=c(3,2,0), dimnames=list(D1=c("a","b","c"), D2=c("X","Y"), D3=NULL)) > str(A) logi[1:3, 1:2, 0 ] - attr(*, "dimnames")=List of 3 ..$ D1: chr [1:3] "a" "b" "c" ..$ D2: chr [1:2] "X" "Y" ..$ D3: NULL > A ## i.e., when the last dimension is 0, it does not print *anything* ! ## whereas it prints fine in cases when another dimension is zero : > aperm(A, c(3,1:2)) , , D2 = X D1 D3 a b c , , D2 = Y D1 D3 a b c > ## a 1d array prints identical to a vector .. which we can accept as this ## is also the case for other 1d arrays > a1 <- array(dim=0, dimnames=list(D=NULL)) > a1 logical(0) > (array(1:2, dim=2)) [1] 1 2 > (a2 <- array(1:2, dim=2, dimnames=list(c("x","y")))) x y 1 2 > (a2. <- array(1:2, dim=2, dimnames=list(D = c("x","y")))) D x y 1 2 ## where the last one *does* print the names(dimnames(.))

fixing it myself ... currently planned to also go into R 3.1.2

currently only in R-devel ... current fix as a "Request for Comments" (RFC). to be backported to R pre-3.1.2 soon as that will go into freeze.