[R] integers

paoso at libero.it paoso at libero.it
Wed Sep 5 13:08:40 CEST 2007


> On 9/4/07, Christoph Heibl <christoph.heibl at gmx.net> wrote:
>> Hi list,
>>
>> The function is.integer tests if an object is of type integer:
>>
>> see e.g.:
>>
>> is.integer(12)  # FALSE
>> is.real(12)     # TRUE
>> mode(12)                # "numeric"
>>
>> But how can I test if a number is actually an integer? R seek is
>> difficult to search in this case because it mainly yields entries
>> about the integer()-function family.
>>
>> Thanks for any hint!
>> Christoph Heibl
> ?mode
> r = 12
> is.integer(r)
[1] FALSE
> is.double(r)
[1] TRUE
> i = as.integer(r)
> storage.mode(r)
[1] "double"
> storage.mode(i)
[1] "integer"


Paolo Sonego



More information about the R-help mailing list