[R] is.integer() function
Thomas Lumley
tlumley at u.washington.edu
Wed Jan 25 16:36:18 CET 2006
On Tue, 24 Jan 2006, Taka Matzmoto wrote:
> Hi R users
> I have a simple question to ask.
> Why am I getting FALSE on this
>
>> is.integer(10)
> [1] FALSE
>
> 10 is a integer number.
is.integer() asks how a number is stored, not whether the number happens
to be an integer. Explicit numbers typed into R are stored as double
precision even if they happen to be whole numbers. This is historical but
is also useful: the double precision type can hold integers up to 2^52
exactly and the integer type can only hold integers up to 2^31.
-thomas
More information about the R-help
mailing list