[R] Problem in cluster sampling: 'mixed with negative subscripts'
Martin Møller Skarbiniks Pedersen
tr@xp|@yer @end|ng |rom gm@||@com
Sun Dec 20 17:55:28 CET 2020
On Sun, 20 Dec 2020 at 06:22, Richard O'Keefe <raoknz using gmail.com> wrote:
> More accurately, in x[i] where x and i are simple vectors,
> i may be a mix of positive integers and zeros
> where the zeros contribute nothing to the result
>
Yes, index 0 doesn't get an error or a warning. I think it should.
Eg.
(v <- 1:4)
[1] 1 2 3 4
v[c(0,2,4)] <- c(0,2)
v
[1] 1 0 3 2 # a surprise ?
Regards
Martin
[[alternative HTML version deleted]]
More information about the R-help
mailing list