[R] integers

Gustaf Rydevik gustaf.rydevik at gmail.com
Tue Sep 4 12:08:14 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

How about


x<- c(12,12.66)
trunc(x)==x

?
--
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik



More information about the R-help mailing list