Rev 82890 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/name.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2022 R Core Team% Distributed under GPL 2 or later\name{name}\alias{name}\alias{symbol}% *also* symbol() font in ../../grDevices/man/plotmath.Rd\alias{is.symbol}\alias{as.symbol}\alias{as.name}\alias{is.name}\title{Names and Symbols}\description{A \sQuote{name} (also known as a \sQuote{symbol}) is a way to refer to\R objects by name (rather than the value of the object, if any, boundto that name).\code{as.name} and \code{as.symbol} are identical: they attempt tocoerce the argument to a name.\code{is.symbol} and the identical \code{is.name} return \code{TRUE}or \code{FALSE} depending on whether the argument is a name or not.}\usage{as.symbol(x)is.symbol(x)as.name(x)is.name(x)}\arguments{\item{x}{object to be coerced or tested.}}\details{Names are limited to 10,000 bytes (and were to 256 bytes in versionsof \R before 2.13.0).\code{as.name} first coerces its argument internally to a charactervector (so methods for \code{as.character} are not used). It thentakes the first element and provided it is not \code{""}, returns asymbol of that name (and if the element is \code{NA_character_}, thename is \code{`NA`}).\code{as.name} is implemented as \code{\link{as.vector}(x, "symbol")},and hence will dispatch methods for the generic function \code{as.vector}.\code{is.name} and \code{is.symbol} are \link{primitive} functions.}\value{For \code{as.name} and \code{as.symbol}, an \R object of type\code{"symbol"} (see \code{\link{typeof}}).For \code{is.name} and \code{is.symbol}, a length-one logical vectorwith value \code{TRUE} or \code{FALSE}.}\note{The term \sQuote{symbol} is from the LISP background of \R, whereas\sQuote{name} has been the standard S term for this.}\references{\bibshow{R:Becker+Chambers+Wilks:1988}}\seealso{\code{\link{call}}, \code{\link{is.language}}.For the internal object mode, \code{\link{typeof}}.\code{\link{plotmath}} for another use of \sQuote{symbol}.}\examples{an <- as.name("arrg")is.name(an) # TRUEmode(an) # nametypeof(an) # symbol}\keyword{programming}\keyword{attribute}