EVOLUTION-MANAGER
Edit File: expression.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Unevaluated Expressions</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for expression {base}"><tr><td>expression {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Unevaluated Expressions</h2> <h3>Description</h3> <p>Creates or tests for objects of mode <code>"expression"</code>. </p> <h3>Usage</h3> <pre> expression(...) is.expression(x) as.expression(x, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p><code>expression</code>: <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> objects, typically calls, symbols or constants.<br /> <code>as.expression</code>: arguments to be passed to methods.</p> </td></tr> <tr valign="top"><td><code>x</code></td> <td> <p>an arbitrary <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> object.</p> </td></tr> </table> <h3>Details</h3> <p>‘Expression’ here is not being used in its colloquial sense, that of mathematical expressions. Those are calls (see <code><a href="call.html">call</a></code>) in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>, and an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> expression vector is a list of calls, symbols etc, for example as returned by <code><a href="parse.html">parse</a></code>. </p> <p>As an object of mode <code>"expression"</code> is a list, it can be subsetted by <code>[</code>, <code>[[</code> or <code>$</code>, the latter two extracting individual calls etc. The replacement forms of these operators can be used to replace or delete elements. </p> <p><code>expression</code> and <code>is.expression</code> are <a href="Primitive.html">primitive</a> functions. <code>expression</code> is ‘special’: it does not evaluate its arguments. </p> <h3>Value</h3> <p><code>expression</code> returns a vector of type <code>"expression"</code> containing its arguments (unevaluated). </p> <p><code>is.expression</code> returns <code>TRUE</code> if <code>expr</code> is an expression object and <code>FALSE</code> otherwise. </p> <p><code>as.expression</code> attempts to coerce its argument into an expression object. It is generic, and only the default method is described here. (The default method calls <code>as.vector(type = "expression")</code> and so may dispatch methods for <code><a href="vector.html">as.vector</a></code>.) <code>NULL</code>, calls, symbols (see <code><a href="name.html">as.symbol</a></code>) and pairlists are returned as the element of a length-one expression vector. Atomic vectors are placed element-by-element into an expression vector (without using any names): lists are changed type to an expression vector (keeping all attributes). Other types are not currently supported. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="call.html">call</a></code>, <code><a href="eval.html">eval</a></code>, <code><a href="function.html">function</a></code>. Further, <code><a href="../../graphics/html/text.html">text</a></code> and <code><a href="../../graphics/html/legend.html">legend</a></code> for plotting mathematical expressions. </p> <h3>Examples</h3> <pre> length(ex1 <- expression(1 + 0:9)) # 1 ex1 eval(ex1) # 1:10 length(ex3 <- expression(u, 2, u + 0:9)) # 3 mode(ex3 [3]) # expression mode(ex3[[3]]) # call ## but not all components are 'call's : sapply(ex3, mode ) # name numeric call sapply(ex3, typeof) # symbol double language rm(ex3) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>