EVOLUTION-MANAGER
Edit File: Colon.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: Colon Operator</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 Colon {base}"><tr><td>Colon {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Colon Operator</h2> <h3>Description</h3> <p>Generate regular sequences. </p> <h3>Usage</h3> <pre> from:to a:b </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>from</code></td> <td> <p>starting value of sequence.</p> </td></tr> <tr valign="top"><td><code>to</code></td> <td> <p>(maximal) end value of the sequence.</p> </td></tr> <tr valign="top"><td><code>a, b</code></td> <td> <p><code><a href="factor.html">factor</a></code>s of the same length.</p> </td></tr> </table> <h3>Details</h3> <p>The binary operator <code>:</code> has two meanings: for factors <code>a:b</code> is equivalent to <code><a href="interaction.html">interaction</a>(a, b)</code> (but the levels are ordered and labelled differently). </p> <p>For other arguments <code>from:to</code> is equivalent to <code>seq(from, to)</code>, and generates a sequence from <code>from</code> to <code>to</code> in steps of <code>1</code> or <code>-1</code>. Value <code>to</code> will be included if it differs from <code>from</code> by an integer up to a numeric fuzz of about <code>1e-7</code>. Non-numeric arguments are coerced internally (hence without dispatching methods) to numeric—complex values will have their imaginary parts discarded with a warning. </p> <h3>Value</h3> <p>For numeric arguments, a numeric vector. This will be of type <code><a href="integer.html">integer</a></code> if <code>from</code> is integer-valued and the result is representable in the <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> integer type, otherwise of type <code>"double"</code> (aka <code><a href="mode.html">mode</a></code> <code>"<a href="numeric.html">numeric</a>"</code>). </p> <p>For factors, an unordered factor with levels labelled as <code>la:lb</code> and ordered lexicographically (that is, <code>lb</code> varies fastest). </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.<br /> (for numeric arguments: S does not have <code>:</code> for factors.) </p> <h3>See Also</h3> <p><code><a href="seq.html">seq</a></code> (a <em>generalization</em> of <code>from:to</code>). </p> <p>As an alternative to using <code>:</code> for factors, <code><a href="interaction.html">interaction</a></code>. </p> <p>For <code>:</code> used in the formal representation of an interaction, see <code><a href="../../stats/html/formula.html">formula</a></code>. </p> <h3>Examples</h3> <pre> 1:4 pi:6 # real 6:pi # integer f1 <- gl(2, 3); f1 f2 <- gl(3, 2); f2 f1:f2 # a factor, the "cross" f1 x f2 </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>