[Rd] is.integer() (PR#6984)

Martin Maechler maechler at stat.math.ethz.ch
Fri Jun 18 11:08:10 CEST 2004


       {removed R-bugs from CC; as we've seen it's not a bug at all}

>>>>> "Wolfi" == Wolfgang Huber <w.huber at dkfz-heidelberg.de>
>>>>>     on Thu, 17 Jun 2004 18:54:47 +0200 writes:

    Wolfi> Hi Marcio,
    Wolfi> it's not a bug, it's a well-documented feature. In the S language, 
    Wolfi> numeric literals are floating point by default.

that hasn't been true for quite a while now:
In S-plus since version 5.0, these literals *are* integer.

    > mode(9)
    [1] "numeric"

and the above doesn't tell you anything, since the mode() of an
integer is "numeric" in any case.
You'd need  storage.mode(9) [S and R] or  typeof(9) [R only] to get the
``low-level mode''.

    > is.integer(9)
    [1] FALSE
    > is.integer(as.integer(9))
    [1] TRUE

BTW, I've been using the  9:9  `acronym' instead of as.integer(9)
in cases where it enhances readability {e.g. in formulas}.
But note that really you shouldn't care in almost all
situations.

Regards,
Martin Maechler

    Wolfi> Best wishes
    Wolfi> Wolfgang

    Wolfi> mmr at tci.ufal.br wrote:
    >> Hello!
    >> 
    >> I'm not sure if is it a BUG or not...
    >> I'm using R 1.9.0, and I used the command below:
    >> 
    >> 
    >>> is.integer(9)
    >> 
    >> [1] FALSE
    >> 
    >> R manual contains this words about the is.integer() function:
    >> 
    >> "is.integer returns TRUE or FALSE depending on whether its argument is of 
    >> integer type or not."
    >> 
    >> What's the problem? Am I wrong about the BUG report?
    >> 
    >> Thank you very much.
    >> 
    >> Márcio de Medeiros Ribeiro
    >> Graduando em Ciência da Computação
    >> Departamento de Tecnologia da Informação - TCI
    >> Universidade Federal de Alagoas - UFAL
    >> Maceió - Alagoas - Brasil
    >> Projeto CoCADa



More information about the R-devel mailing list