EVOLUTION-MANAGER
Edit File: vec_identify_runs.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: Runs</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_identify_runs {vctrs}"><tr><td>vec_identify_runs {vctrs}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Runs</h2> <h3>Description</h3> <p><code>vec_identify_runs()</code> returns a vector of identifiers for the elements of <code>x</code> that indicate which run of repeated values they fall in. The number of runs is also returned as an attribute, <code>n</code>. </p> <h3>Usage</h3> <pre> vec_identify_runs(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>A vector.</p> </td></tr> </table> <h3>Details</h3> <p>Unlike <code><a href="../../base/html/rle.html">base::rle()</a></code>, adjacent missing values are considered identical when constructing runs. For example, <code>vec_identify_runs(c(NA, NA))</code> will return <code>c(1, 1)</code>, not <code>c(1, 2)</code>. </p> <h3>Value</h3> <p>An integer vector with the same size as <code>x</code>. A scalar integer attribute, <code>n</code>, is attached. </p> <h3>Examples</h3> <pre> x <- c("a", "z", "z", "c", "a", "a") vec_identify_runs(x) y <- c(1, 1, 1, 2, 2, 3) # With multiple columns, the runs are constructed rowwise df <- data_frame( x = x, y = y ) vec_identify_runs(df) </pre> <hr /><div style="text-align: center;">[Package <em>vctrs</em> version 0.5.0 <a href="00Index.html">Index</a>]</div> </body></html>