Check if an Object is an Expression in R Programming – is.expression() Function
Last Updated :
24 Jun, 2020
is.expression()
function in R Language is used to check if the object passed to it as argument is of the expression class.
Syntax: is.expression(object)
Parameters:
object: Object to be checked
Example 1:
x < - "sin(pi / 2)"
eval (x)
is .expression(x)
|
Output:
[1] "sin(pi/2)"
[1] FALSE
Example 2:
x < - expression(sin(pi / 2 ))
eval (x)
is .expression(x)
|
Output:
[1] 1
[1] TRUE
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...