integer
creates a integer vector of the specified length.
Each element of the vector is equal to 0
.
as.integer
attempts to coerce its argument to be of integer
type. The answer will be NA
unless the coercion succeeds. Real
values larger in modulus than the largest integer are coerced to
NA
(unlike S which gives the most extreme integer of the same
sign). Non-integral numeric values are truncated towards zero (i.e.,
as.integer(x)
equals trunc(x)
there), and
imaginary parts of complex numbers are discarded (with a warning).
Character strings containing optional whitespace followed by either a
decimal representation or a hexadecimal representation (starting with
0x
or 0X
) can be converted, as well as any allowed by
the platform for real numbers. Like as.vector
it strips
attributes including names. (To ensure that an object x
is of
integer type without stripping attributes, use
storage.mode(x) <- "integer"
.)
is.integer
returns TRUE
or FALSE
depending on
whether its argument is of integer type or not, unless it is a
factor when it returns FALSE
.