Skip to content

bug (?) in [.data.frame with matrix-like indexing

2 messages · Uwe Ligges, Peter Dalgaard

#
Consider in R-2.6.0 (also R-patched from yesterday):

iris[1, c(TRUE, FALSE, FALSE, FALSE, FALSE)]
##  Error in .subset2(xx, j) : recursive indexing failed at level 2

iris[1, c(FALSE, FALSE, FALSE, FALSE, TRUE)]
## Error in .subset2(xx, j) : attempt to select less than one element

i.e. matrix-like indexing on data.frames, one logically-indexed 
dimension with only one value TRUE in it.

It is not documented to work, but it did so in former versions of R.
Is it a bug or withdrawn support?


Uwe Ligges
#
Uwe Ligges wrote:
It's been reported before. Looks unintentional.

As I also said last time, the log for the relevant revision has

"make DF[, 1] and DF[1:m, 1] consistent"

(and it doesn't...)