Numeric
Decimal values are called numerics in R. It is the default computational data type. If we assign a decimal value to a variable x as follows, x will be of numeric type.
> x = 10.5 # assign a decimal value
> x # print the value of x
[1] 10.5
> class(x) # print the class name of x
[1] "numeric"
> x # print the value of x
[1] 10.5
> class(x) # print the class name of x
[1] "numeric"
Furthermore, even if we assign an integer to a variable k, it is still being saved as a numeric value.
The fact that k is not an integer can be confirmed with the is.integer function. We will discuss how to create an integer in our next tutorial on the integer type.
Tags: