From michael.haupt at oracle.com  Thu Sep  4 17:17:16 2014
From: michael.haupt at oracle.com (Michael Haupt)
Date: Thu, 4 Sep 2014 17:17:16 +0200
Subject: [Rd] negative numerics in []
Message-ID: <2D13E3F7-A7AE-4614-959B-B48C74E60D62@oracle.com>

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)."

> as.integer(-3.1)
[1] -3

Good. But:

> x <- c(1,2,3)
> x[-3.1]
[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

-- 
Dr. Michael Haupt
Principal Member of Technical Staff
Phone: +49 331 200 7277, Fax: +49 331 200 7561
Oracle Labs
Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14, 14467 Potsdam, Germany



[Rd] negative numerics in []
Michael Haupt