R语言 检查参数是否是一个名字 – is.name() 函数

R语言 检查参数是否是一个名字 – is.name() 函数

R语言中的 is.name() 函数用于返回TRUE,如果参数是名字,则返回FALSE。 is.name()is.symbol() 函数是相同的。

语法: is.name(x)

参数:

x: 要测试的R对象

例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)

输出

[1] FALSE

例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)

输出

[1] TRUE

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程