Open In App

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

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
Article Tags :