Skip to content
Prev 48970 / 63421 Next

negative numerics in []

Hello,

I'm a bit puzzled by what looks (to me) like a discrepancy between documentation and implementation.

The documentation for [] says this about the indices: "Numeric values are coerced to integer as by as.integer (and hence truncated towards zero)."
[1] -3

Good. But:
[1] 1 2 3

Given the documentation, I'd have expected a result of "[1] 1 2", because -3.1 should be coerced to -3 (by virtue of as.integer).

What bit do I not get? (I'm using R 3.1.1, if that matters.)

Best,

Michael