Numeric Type
In this page:
Numeric Type
numeric is R's default type for any number, storing values as double-precision floating point regardless of whether they look like whole numbers. Most arithmetic in R produces numeric results. Use class() or typeof() to check a value's actual type.
Note: Even x <- 5 (no decimal point) creates a numeric (double), not an integer, unless you explicitly use 5L.
Example: Numeric Type
x <- 5
y <- 5.5
cat(class(x), class(y), "\n")
cat(x + 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: