EVOLUTION-MANAGER
Edit File: iter.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: Iterator Factory 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 iter {iterators}"><tr><td>iter {iterators}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Iterator Factory Functions</h2> <h3>Description</h3> <p><code>iter</code> is a generic function used to create iterator objects. </p> <h3>Usage</h3> <pre> iter(obj, ...) ## Default S3 method: iter(obj, checkFunc=function(...) TRUE, recycle=FALSE, ...) ## S3 method for class 'iter' iter(obj, ...) ## S3 method for class 'matrix' iter(obj, by=c('column', 'cell', 'row'), chunksize=1L, checkFunc=function(...) TRUE, recycle=FALSE, ...) ## S3 method for class 'data.frame' iter(obj, by=c('column', 'row'), checkFunc=function(...) TRUE, recycle=FALSE, ...) ## S3 method for class 'function' iter(obj, checkFunc=function(...) TRUE, recycle=FALSE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>obj</code></td> <td> <p>an object from which to generate an iterator.</p> </td></tr> <tr valign="top"><td><code>by</code></td> <td> <p>how to iterate.</p> </td></tr> <tr valign="top"><td><code>chunksize</code></td> <td> <p>the number of elements of <code>by</code> to return with each call to <code>nextElem</code>.</p> </td></tr> <tr valign="top"><td><code>checkFunc</code></td> <td> <p>a function which, when passed an iterator value, return <code>TRUE</code> or <code>FALSE</code>. If <code>FALSE</code>, the value is skipped in the iteration.</p> </td></tr> <tr valign="top"><td><code>recycle</code></td> <td> <p>a boolean describing whether the iterator should reset after running through all it's values.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>additional arguments affecting the iterator.</p> </td></tr> </table> <h3>Value</h3> <p>The iterator. </p> <h3>Examples</h3> <pre> # a vector iterator i1 <- iter(1:3) nextElem(i1) nextElem(i1) nextElem(i1) # a vector iterator with a checkFunc i1 <- iter(1:3, checkFunc=function(i) i %% 2 == 0) nextElem(i1) # a data frame iterator by column i2 <- iter(data.frame(x=1:3, y=10, z=c('a', 'b', 'c'))) nextElem(i2) nextElem(i2) nextElem(i2) # a data frame iterator by row i3 <- iter(data.frame(x=1:3, y=10), by='row') nextElem(i3) nextElem(i3) nextElem(i3) # a function iterator i4 <- iter(function() rnorm(1)) nextElem(i4) nextElem(i4) nextElem(i4) </pre> <hr /><div style="text-align: center;">[Package <em>iterators</em> version 1.0.14 <a href="00Index.html">Index</a>]</div> </body></html>