For printing purposes with large matrices or arrays, it is often useful to print them in close block form without the array names or numbers. Removing the dimnames attribute will not achieve this effect, but rather the array must be given a dimnames attribute consisting of empty strings. For example to print a matrix, X
temp <- X
dimnames(temp) <- list(rep("", nrow(X)), rep("", ncol(X))
temp; rm(temp)
This can be much more conveniently done using a function,
no.dimnames(), shown in Figure
, as a ``wrap around'' to
achieve the same result. It also illustrates how some effective and useful
user functions can be quite short.
no.dimnames(X)
This is particularly useful for large integer arrays, where patterns are the real interest rather than the values.