Skip to content
Prev 293228 / 398502 Next

Data frame vs matrix quirk: Hinky error message?

P.S.

The way the logical matrix is constructed is NOT general purpose.
Quoting myself quoting Bert,
Here the number of rows in zdf is a multiple of the vectors ix[, 1] and ix[
, 2] lengths.
The recycling rules makes it work. But if the numeric index matrix has, say,
3 rows,
another way of constructing the logical one would be needed.

jx <- cbind(1:3, c(2:3, 3))
row(zdf) == jx[, 1] & col(zdf) == jx[, 2]
      [,1]  [,2]  [,3]
[1,] FALSE FALSE FALSE
[2,] FALSE FALSE FALSE
[3,] FALSE FALSE FALSE
[4,] FALSE FALSE FALSE

(Anyway, I don't believe that was the point.)

R.B.



--
View this message in context: http://r.789695.n4.nabble.com/Data-frame-vs-matrix-quirk-Hinky-error-message-tp4601254p4601558.html
Sent from the R help mailing list archive at Nabble.com.