How to Apply the as.double() & is.double() Functions in R (2 Examples)
In this article you’ll learn how to apply the as.double and is.double functions in the R programming language.
Creating Example Data
vec <- 1:10 # Creating integer vector vec # Printing integer vector # 1 2 3 4 5 6 7 8 9 10 |
vec <- 1:10 # Creating integer vector vec # Printing integer vector # 1 2 3 4 5 6 7 8 9 10
Example 1: Converting Integer Vector to double Class
vec_double <- as.double(vec) # Using as.double function |
vec_double <- as.double(vec) # Using as.double function
Example 2: Checking if New Vector has Class double
is.double(vec) # Applying is.double function # FALSE |
is.double(vec) # Applying is.double function # FALSE
is.double(vec_double) # Applying is.double to new vector # TRUE |
is.double(vec_double) # Applying is.double to new vector # TRUE