Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Check if an Object is of Type Numeric in R Programming – is.numeric() Function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

is.numeric() function in R Language is used to check if the object passed to it as argument is of numeric type.

Syntax: is.numeric(x)

Parameters:
x: Object to be checked

Example 1:




# R program to check if 
# object is of numeric type
  
# Calling is.numeric() function
is.numeric(1)
is.numeric(1.5)
is.numeric(-1.5)


Output:

[1] TRUE
[1] TRUE
[1] TRUE

Example 2:




# R program to check if 
# object is of numeric type
  
# Creating a matrix
x1 <- matrix(c(1:9), 3, 3)
  
# Calling is.numeric() function
is.numeric(x1)


Output:

[1] TRUE
My Personal Notes arrow_drop_up
Last Updated : 16 Jun, 2020
Like Article
Save Article
Similar Reads