as.name()
R 语言中的函数用于将参数强制转换为名称。这as.name()
和as.symbol()
函数是相同的。
用法: as.name(x)
参数:
x:被胁迫的对象
范例1:
# R program to illustrate
# as.name() function
# Calling the as.name() function to
# coerce 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
范例2:
# R program to illustrate
# as.name() function
# Calling the as.name() function to
# coerce the argument to a name
x <- as.name("sample")
# Getting the class of the argument
class(x)
输出:
[1] "name"
相关用法
- R语言 is.name()用法及代码示例
- R语言 expand.grid()用法及代码示例
- R语言 print()用法及代码示例
- R语言 seq_along()用法及代码示例
- R语言 get()用法及代码示例
- R语言 exists()用法及代码示例
- R语言 is.primitive()用法及代码示例
- R Character String转Variable Name用法及代码示例
- R语言 dunif()用法及代码示例
- R语言 lapply()用法及代码示例
- R语言 optimize()用法及代码示例
- R语言 lgamma()用法及代码示例
注:本文由纯净天空筛选整理自Kanchan_Ray大神的英文原创作品 Coercing the Argument to a Name in R Programming – as.name() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。