Skip to content
Prev 293206 / 398502 Next

Data frame vs matrix quirk: Hinky error message?

Hi Bert,

The failure itself is the documented behavior: ?'[.data.frame' says

"Matrix indexing ('x[i]' with a logical or a 2-column integer
     matrix 'i') using '[' is not recommended, and barely supported.
     For extraction, 'x' is first coerced to a matrix.  For
     replacement, a logical matrix (only) can be used to select the
     elements to be replaced in the same way as for a matrix."

The error message may be a bit hinky, as obviously data.frames can be
indexed by things other than logical matricies. Or is there another
reason this strikes you as odd?

Best,
Ista
On Tue, May 1, 2012 at 1:33 PM, Bert Gunter <gunter.berton at gene.com> wrote: