[Rd] repeat bug report: as.factor argument to row / col fails if NULL dimnames

Dan Davison davison at stats.ox.ac.uk
Tue Dec 9 01:45:21 CET 2008

This bug was reported to r-devel by Martin Morgan on 13th May 2008
(original email pasted below). However I couldn't locate it in the bug
tracker (with searches for row, col, as\.factor) It is still present
in today's svn version (rev 47115). I hope I'm doing something useful
by bringing it up again. I have not sent this to r-bugs, as I'm
concerned that not locating it in the bug tracker could be my failing.


original report:
col(matrix(0, 5, 5), as.factor=TRUE) fails

> col(matrix(0, 5, 5), as.factor=TRUE)
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

       labels=colnames(x, do.NULL=FALSE, prefix=""))

> sessionInfo()
R version 2.8.0 Under development (unstable) (2008-05-13 r45682)

Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793


More information about the R-devel mailing list