R – Check if Type of Vector is Double
To check if type of given vector is double in R, call is.double() function and pass the vector as argument to this function. If the given vector is of type double, then is.double() returns TRUE, or else, it returns FALSE.
The syntax to call is.double() to check if type of vector
x is double is
The function returns a logical value.
In the following program, we take a vector in
x, and check if this vector is a double vector using
is.double() function. We print the value returned by
x <- c(2, 4, 6, 8) result <- is.double(x) print(result)
Now, let us take a vector
x of some type other than double, and check the value returned by
x is not of type double,
is.double() must return
x <- c(TRUE, FALSE, FALSE) result <- is.double(x) print(result)
In this R Tutorial, we learned how to check if given vector is of type double, using is.double() function, with the help of examples.