EVOLUTION-MANAGER
Edit File: vec_recycle.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: Vector recycling</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 vec_recycle {vctrs}"><tr><td>vec_recycle {vctrs}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Vector recycling</h2> <h3>Description</h3> <p><code>vec_recycle(x, size)</code> recycles a single vector to a given size. <code>vec_recycle_common(...)</code> recycles multiple vectors to their common size. All functions obey the <a href="vector_recycling_rules.html">vctrs recycling rules</a>, and will throw an error if recycling is not possible. See <code><a href="vec_size.html">vec_size()</a></code> for the precise definition of size. </p> <h3>Usage</h3> <pre> vec_recycle(x, size, ..., x_arg = "", call = caller_env()) vec_recycle_common(..., .size = NULL, .arg = "", .call = caller_env()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>A vector to recycle.</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>Desired output size.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Depending on the function used: </p> <ul> <li><p> For <code>vec_recycle_common()</code>, vectors to recycle. </p> </li> <li><p> For <code>vec_recycle()</code>, these dots should be empty. </p> </li></ul> </td></tr> <tr valign="top"><td><code>x_arg</code></td> <td> <p>Argument name for <code>x</code>. These are used in error messages to inform the user about which argument has an incompatible size.</p> </td></tr> <tr valign="top"><td><code>call, .call</code></td> <td> <p>The execution environment of a currently running function, e.g. <code>caller_env()</code>. The function will be mentioned in error messages as the source of the error. See the <code>call</code> argument of <code><a href="../../rlang/html/abort.html">abort()</a></code> for more information.</p> </td></tr> <tr valign="top"><td><code>.size</code></td> <td> <p>Desired output size. If omitted, will use the common size from <code><a href="vec_size.html">vec_size_common()</a></code>.</p> </td></tr> <tr valign="top"><td><code>.arg</code></td> <td> <p>An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.</p> </td></tr> </table> <h3>Dependencies</h3> <ul> <li> <p><code><a href="vec_slice.html">vec_slice()</a></code> </p> </li></ul> <h3>Examples</h3> <pre> # Inputs with 1 observation are recycled vec_recycle_common(1:5, 5) vec_recycle_common(integer(), 5) ## Not run: vec_recycle_common(1:5, 1:2) ## End(Not run) # Data frames and matrices are recycled along their rows vec_recycle_common(data.frame(x = 1), 1:5) vec_recycle_common(array(1:2, c(1, 2)), 1:5) vec_recycle_common(array(1:3, c(1, 3, 1)), 1:5) </pre> <hr /><div style="text-align: center;">[Package <em>vctrs</em> version 0.5.0 <a href="00Index.html">Index</a>]</div> </body></html>