Skip to content
Prev 8696 / 63424 Next

Undocumented bahavior of as.integer() (PR#2430)

You are (still) confusing type with value.  That statement is about type
(as in typeof).  Nowhere can I find documented that X[y], y non-integral
(as in value) has y rounded.  The problem is your use of such values. For
example, R-lang says

   Other numeric. Non-integer values are converted to integer before use.

You are assuming that the coversion is by rounding, but that is not
stated, and is not what happens.  If you want an integral value, plese
write code that ensures that you get it.

I agree with Martin there is no need for a WARNING section, and BTW, no
other section name is in capitals, so why did you suggest this extra
emphasis?  (I see a couple of other exceptions in the R sources that
need fixing.)

?as.integer already tells you to look at round/ceiling/floor to
convert to integral values.
On Wed, 8 Jan 2003, Philippe Grosjean wrote: