is_integer | R Documentation |
Given a vector, check if its values are integers or not. Base R lacks a function for checking if a value is an integer or not. So we have to write our own.
is_integer(xs)
x. |
A vector of any type. |
A logical vector of the same length as 'x', indicating which elements are integers and which are not.
is_integer(c(NA_integer_, NA_complex_, NA_real_, NA_character_))
is_integer(c(-9, 9, -9.2, 1L))
is_integer(c(NaN, Inf, -Inf))
all(is_integer(iris[[4]]))
all(is_integer(mtcars[[2]]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.