expression
Expression Objects
Description
Creates or tests for objects of mode expression.
Usage
expression(...)
is.expression(x)
as.expression(x)
## Default S3 method:
as.expression(x)
Arguments
... |
any valid expression. Not evaluated by the call to
expression.
|
x |
any object.
|
Details
as.expression is a generic function, but currently there is only the default method.
Value
expression | returns an expression; that is, a list-like
object of mode "expression". Its elements are the arguments,
unsubstituted and unevaluated. |
is.expression | returns TRUE if x has mode
"expression". Otherwise it returns FALSE. |
as.expression | changes the mode of x to
"expression". |
Background
The output from parse is of mode "expression".
References
Becker, R. A., Chambers, J. M., and Wilks, A. R. 1988. The New S Language. Pacific Grove, CA: Wadsworth & Brooks/Cole Advanced Books and Software.
See Also
Examples
x<-c(1,2,3)
y<-c(2,4,6)
mymethod <- expression(lsfit(x,y), rexp(1))
eval(mymethod[[which(x == 1)]])
rand.choice <- expression("Gaussian"=rnorm(1),"exp"=rexp(1),
"uniform"=runif(1))
eval(rand.choice[["exp"]])