Re: [R] is.integer() function

From: Barry Rowlingson <>
Date: Thu 26 Jan 2006 - 02:57:20 EST

Gabor Csardi wrote:
> Becaues is.integer shows the internal representation, which is not an > integer but a double (real number). Some functions create integer vectors,

  Some functions that you might think create integer vectors and even seem to say they create integer vectors dont create integer vectors:

      'ceiling' takes a single numeric argument 'x' and returns a
      numeric vector containing the smallest integers not less than the
      corresponding elements of 'x'.

> ceiling(0.5)

[1] 1

> is.integer(ceiling(0.5))

> is.integer(1:3)

[1] TRUE
> is.integer(ceiling(1:3))

[1] FALSE   This could possibly be a documentation problem, since ?ceiling is using 'integer' in the sense of 'whole number', whereas ?is.integer is concerned with internal representation (aka 'storage mode')....

  This seems to be an endless source of confusion to anyone who didn't start their programming days in Fortran, C, or assembly language (or other strongly-typed language, I guess).

Barry mailing list PLEASE do read the posting guide! Received on Thu Jan 26 03:29:13 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:10 EST