In this article, we will discuss about as.double() and is.double() functions in R Programming Language.
as.double() Method in R
as.double is used to convert an integer to double.
Syntax: as.double(input_values)
Both will take values as input.
Example: In this example, we will a vector with 5 elements and convert to double using as.double()
R
vector1= c (2,3,4,5,6)
print (vector1)
result= as.double (vector1)
print (vector1)
|
Output:
[1] 2 3 4 5 6
[1] 2 3 4 5 6
is.double() methods in R
is.double() is used to test an data object has the double class.
Syntax: is.double(input_values)
Example: In this example, we will a vector with 5 elements and convert to double using as.double() and check they are double or not using is.double()
It will return TRUE, if it is double otherwise it will return FALSE.
R
vector1= c (2,3,4,5,6)
result= as.double (vector1)
print ( is.double (result))
|
Output:
[1] TRUE