EVOLUTION-MANAGER
Edit File: dots.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: ..., '..1', etc used in Functions</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 dots {base}"><tr><td>dots {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>..., <code>..1</code>, etc used in Functions</h2> <h3>Description</h3> <p><code>...</code> and <code>..1</code>, <code>..2</code> etc are used to refer to arguments passed down from a calling function. These (and the following) can only be used <em>inside</em> a function which has <code>...</code> among it formal arguments. </p> <p><code>...elt(n)</code> is a functional way to get <code>..<n></code> and basically the same as <code>eval(paste0("..", n))</code>, just more elegant and efficient. Note that <code>switch(n, ...)</code> is very close, differing by returning <code>NULL</code> invisibly instead of an error when <code>n</code> is zero or too large. </p> <p><code>...length()</code> returns the number of expressions in <code>...</code>. This is the same as <code>length(list(...))</code> but without evaluating the expressions in <code>...</code> (which happens with <code>list(...)</code>). </p> <h3>Usage</h3> <pre> ...length() ...elt(n) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>n</code></td> <td> <p>a positive integer, not larger than the number of expressions in ..., which is the same as <code>...length()</code> which is the same as <code>length(list(...))</code>, but the latter evaluates all expressions in <code>...</code>.</p> </td></tr> </table> <h3>See Also</h3> <p><code>...</code> and <code>..1</code>, <code>..2</code> are <em>reserved</em> words in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>, see <code><a href="Reserved.html">Reserved</a></code>. </p> <p>For more, see the <a href="/doc/manual/R-intro.html#The-three-dots-argument">Introduction to R</a> manual for usage of these syntactic elements, and <a href="../../methods/html/dotsMethods.html">dotsMethods</a> for their use in formal (S4) methods. </p> <h3>Examples</h3> <pre> tst <- function(n, ...) ...elt(n) tst(1, pi=pi*0:1, 2:4) ## [1] 0.000000 3.141593 tst(2, pi=pi*0:1, 2:4) ## [1] 2 3 4 try(tst(1)) # -> Error about '...' not containing an element. tst.dl <- function(x, ...) ...length() tst.dl(1:10) # 0 (because the first argument is 'x') tst.dl(4, 5) # 1 tst.dl(4, 5, 6) # 2 namely '5, 6' tst.dl(4, 5, 6, 7, sin(1:10), "foo"/"bar") # 5. Note: no evaluation! </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>