Is an Object a Language Object? (original) (raw)
is.language {base} | R Documentation |
---|
Description
is.language
returns TRUE
if x
is a variable [name](../../base/help/name.html)
, a [call](../../base/help/call.html)
, or an[expression](../../base/help/expression.html)
.
Usage
is.language(x)
Arguments
Note
A name
is also known as ‘symbol’, from its type ([typeof](../../base/help/typeof.html)
), see [is.symbol](../../base/help/is.symbol.html)
.
If [typeof](../../base/help/typeof.html)(x) == "language"
, then is.language(x)
is always true, but the reverse does not hold as expressions or names y
also fulfill is.language(y)
, see the examples.
This is a primitive function.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)The New S Language. Wadsworth & Brooks/Cole.
Examples
ll <- list(a = expression(x^2 - 2*x + 1), b = as.name("Jim"),
c = as.expression(exp(1)), d = call("sin", pi))
sapply(ll, typeof)
sapply(ll, mode)
stopifnot(sapply(ll, is.language))
[Package _base_ version 4.6.0 Index]