Skip to content
Prev 3448 / 63424 Next

possible BUG with as.data.frame() and/or [.data.frame

"Jens Oehlschlägel-Akiyoshi" <jens.oehlschlaegel-akiyoshi@mdfactory.de> writes:
It's a prototype "feature"...
...
Version 3.4 Release 1 for Sun SPARC, SunOS 5.3 : 1996 
...
tablename   
1       abc 1
2       abc 2
3       abc 3
Error in "[.data.frame"(b,  , 2): undefined columns selected
Dumped


This is a conspiracy of three things: 

1) The deparse.level feature of cbind (which is unsettable, but the
   internals still behave as if deparse.level=1) which causes a
   deparsing of simple arguments (i.e. symbols) into colnames, leaving
   others blank.

2) as.data.frame.matrix expects that if colnames are present, they can
   just be copied to the names() of the result

3) "[.data.frame" explicitly checks whether a column name is blank
   after subsetting, and protests if it is.