Displaying 1 result from an estimated 1 matches for "matrixcolumnlabel".
2002 Aug 13
2
Misalignment of <NA> in rownames (PR#1905)
...s misalignment when the
matrix is printed:
R> x <- matrix(1:12, 3,4, dimnames=list(letters[1:3], LETTERS[1:4]))
R> rownames(x)[2] <- NA
R> x
A B C D
a 1 4 7 10
<NA> 2 5 8 11
c 3 6 9 12
The bug is in function Rstrlen, in src/main/printutils.c. MatrixRowLabel and
MatrixColumnLabel (same file) rely on Rstrlen to count the characters in each
label, but Rstrlen doesn't understand NA's. Here's a patch, to be applied
between lines 242 ("int len;") and 243 ("len = 0;"):
if (s == CHAR(NA_STRING))
return quote ? R_print.na_width : R_print....