ID EN
Data Types & Classes

name

R Base 3.6.2

A ‘name’ (also known as a ‘symbol’) is a way to refer to R objects by name (rather than the value of the object, if any, bound to that name). as.name and as.symbol are identical: they attempt to coerce the argument to a name. is.symbol and the identical is.name return TRUE or FALSE depending on whether the argument is a name or not.

Syntax

R
as.symbol(x)
is.symbol(x)<p></p><p>as.name(x)
is.name(x)</p>

Arguments

Parameter Description
x object to be coerced or tested.

Return Value

For as.name and as.symbol, an R object of type "symbol" (see typeof). For is.name and is.symbol, a length-one logical vector with value TRUE or FALSE.

Details

Names are limited to 10,000 bytes (and were to 256 bytes in versions of R before 2.13.0). as.name first coerces its argument internally to a character vector (so methods for as.character are not used). It then takes the first element and provided it is not "", returns a symbol of that name (and if the element is NA_character_, the name is `NA`). as.name is implemented as as.vector(x, "symbol"), and hence will dispatch methods for the generic function as.vector. is.name and is.symbol are primitive functions.

Examples

Example
R
# NOT RUN {
an <- as.name("arrg")
is.name(an) # TRUE
mode(an)   # name
typeof(an) # symbol
# }

See Also

call is.language. For the internal object mode typeof. plotmath for another use of ‘symbol’.