Skip to content
Prev 28811 / 63421 Next

doc buglet / bug: row / col as.factor requires dimnames

col(matrix(0, 5, 5), as.factor=TRUE) fails
Error in factor(.Internal(col(dim(x))), labels = colnames(x)) : 
  invalid labels; length 0 should be 1 or 5

when the matrix has no dimnames. This is not as advertised. I would
have expected the equivalent of

factor(.Internal(col(dim(x))),
       labels=colnames(x, do.NULL=FALSE, prefix=""))
R version 2.8.0 Under development (unstable) (2008-05-13 r45682) 
x86_64-unknown-linux-gnu 

Martin