>>>>> "CH" == Christoph Heibl <[EMAIL PROTECTED]>
>>>>> on Tue, 4 Sep 2007 11:53:43 +0200 writes:
CH> Hi list,
CH> The function is.integer tests if an object is of type integer:
CH> see e.g.:
CH> is.integer(12) # FALSE
CH> is.real(12) # TRUE
CH> mode(12) # "numeric"
CH> But how can I test if a number is actually an integer?
something like round(x) == x
is often good enough, maybe x %% 1 == 0
seems a bit more efficient.
Note that both return NA whenever x[] is NA so may not directly be
appropriate for your use case.
CH> R seek is difficult to search in this case because it mainly yields
entries
CH> about the integer()-function family.
"R seek" ???
Do you mean the R function RSiteSearch() which goes to
'http://search.r-project.org/' ?
Well, calling
RSiteSearch("integer number")
gives almost 3000 hits, *but* number 10 is exactly relevant to
your question...
CH> Thanks for any hint!
CH> Christoph Heibl
______________________________________________
[email protected] 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.