[R] how to judge a virable is a integer?

S Ellison S.Ellison at LGCGroup.com
Sat Oct 18 14:10:09 CEST 2014


> But i use a<-10/b ,  b is some value ,may be  5, maybe 5.5
If you do floating point arithmetic on integers you'll usually get floating point answers, including the 5.0.

See FAQ 7.31 for the usual floating point problem, and ?all.equal for the usual answer to it. You could see if a result is close to an integer by,for example, using all.equal to compare it to itself after rounding.

S

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list