On 18-10-2014, at 12:41, PO SU <rhelpmaill...@163.com> wrote: > > > Dear usRers, > I want to judge virable is or not a integer? > e.g. is.integer(1) FALSE because it is a numeric, but i want it's true. > as.integer may not be used. because i don't know a is 1 or 1.1. >
is.integer is surely what you need if you wish to test if a variable is integer. See this # a <- 1 # b <- 1L # is.integer(a) [1] FALSE # is.integer(b) [1] TRUE See the help for is.integer to see how you can test for a wholenumber, which might be what you want. Berend ______________________________________________ R-help@r-project.org 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.