The as.double() function in R converts an integer to a double class.
Syntax
as.double(x, …)
Parameters
- x: It is an object to be coerced or tested.
- …: further arguments passed to or from other methods.
Example
x <- 1:5
y <- as.double(x)
y
typeof(y)
Output
[1] 1 2 3 4 5
[1] "double"
You can see that we converted a numeric class to a double class using the as.double() function.
is.double() function in R
To check if a data object has a double class in R, you can use the is.double() function. It returns TRUE if the value has class double and FALSE otherwise.
x <- 1:5
y <- as.double(x)
is.double(y)
Output
[1] TRUE
The as.double() function converts a numeric class to double, and that’s why it returns TRUE.
That’s it.

Krunal Lathiya is a Software Engineer with over eight years of experience. He has developed a strong foundation in computer science principles and a passion for problem-solving. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language.