expression {base} | R Documentation |
Creates or tests for objects of mode "expression"
.
expression(...) is.expression(x) as.expression(x, ...)
... |
valid R calls, symbols or constants. |
x |
an arbitrary R object. |
‘Expression’ here is not being used in its colloquial sense,
that of mathematical expressions. Those are calls (see
call
) in R, and an R expression vector is a list of
calls etc, typically as returned by parse
.
As an object of mode "expression"
is a list, it can be
subsetted by both [
and by [[
, the latter extracting
individual calls.
expression
returns a vector of type "expression"
containing its arguments (unevaluated).
is.expression
returns TRUE
if expr
is an
expression object and FALSE
otherwise.
as.expression
attempts to coerce its argument into an
expression object.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
call
,
eval
,
function
.
Further,
text
and
legend
for plotting mathematical expressions.
length(ex1 <- expression(1+ 0:9))# 1 ex1 eval(ex1)# 1:10 length(ex3 <- expression(u,v, 1+ 0:9))# 3 mode(ex3 [3]) # expression mode(ex3[[3]])# call rm(ex3)