On Wed, 26 Apr 2006, Leon wrote: > Hi, All > I am using is.integer function to examine whether an object is an integer or > not, but I get such results,
As the help page says, is.integer() Creates or tests for objects of type '"integer"'. That is, is.integer() tests to see whether the variable is of type integer, not whether the number currently stored in that variable is a whole number. Numerical constants such as 5 are of type double, but the results of : with whole number arguments are of type integer. -thomas > >> x<-3 >> is.integer(x) > [1] FALSE > >> x<-3:4 >> x > [1] 3 4 >> is.integer(x) > [1] TRUE > > Seems that the is.integer cannot handle scalers, > >> is.integer(5) > [1] FALSE > >> is.integer(5:6) > [1] TRUE > > Is this a bug in R or I made some mistakes? I am using R 2.2.1 under Windows > XP > > Thanks a lot! > > Leon > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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 > Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle ______________________________________________ R-help@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