Open In App

Check if the Argument is a Name in R Programming – is.name() Function

Last Updated : 19 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

is.name() function in R Language is used to return TRUE if the argument is name else returns FALSE. The is.name() and is.symbol() functions are identical.

Syntax: is.name(x)

Parameters:
x: R object to be tested

Example 1:




# R program to illustrate
# is.name() function
  
# Initializing a string
x <- "sample"
  
# Calling the is.name() function
# to check whether the argument is
# name or not
is.name(x)


Output:

[1] FALSE

Example 2:




# R program to illustrate
# is.name() function
  
# Coercing the argument to a name
x <- as.name("sample")
  
# Calling the is.name() function
# to check whether the argument is
# name or not
is.name(x)


Output:

[1] TRUE

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads