R integer
integer() function creates or tests for objects of type integer. Integer is a subset of numeric.
It ranges from -2^53 to 2^53, and occupies less storage than numeric which using double precision. R will convert integer to
numeric automatically if necessary.
integer(length = 0)
as.integer(x, ...)
is.integer(x)
length: length of the integer vector created
x: R object to be tested
> integer(length=3)
[1] 0 0 0
> x <- 3
> is.integer(x)
[1] FALSE
To assign an integer value, as.integer() may be used, or append a letter "L" to the value.
> x <- 3L
> x
[1] 3
> is.integer(x)
[1] TRUE
> x <- as.integer(c(3,4,5))
> is.integer(x)
[1] TRUE