R-alpha: Array indexing out of range -- difference to R-minus
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 5 Dec 1997 15:00:45 +0100
> x <- cbind(1,1:3); x
[,1] [,2]
[1,] 1 1
[2,] 1 2
[3,] 1 3
> x[5:6] <- 10
> x
[,1] [,2]
[1,] 1 1
[2,] 1 10
[3,] 1 10
> x[5:7] <- 12 #<<<<< loses its dimension, because of `out of range' indexing
> x
[1] 1 1 1 1 12 12 12
1 2 3 4 5 6 7
---
with S-plus or S4,
x remains a 3 x 2 matrix;
it only `silently' grows *after* being coerced to vector
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._