Integer Type
In this page:
Integer Type
An explicit integer is created with an L suffix, like 5L, distinct from the default numeric (double) type. Integers use less memory and are useful when a value is guaranteed to be a whole number, such as an index or count. is.integer() checks whether a value is specifically of integer type.
Note: Without the L suffix, 5 is a double, not an integer, even though it looks like a whole number.
Example: Integer Type
x <- 5L
y <- 5
cat(class(x), class(y), "\n")
cat(is.integer(x), is.integer(y), "\n")
Login to try C/C++/Java/PHP code in the editor
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: