blob: 2a20e4f50355547fb18347738596410da08ead59 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: row_number</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="R.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/languages/r.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head><body>
<table width="100%" summary="page for row_number {SparkR}"><tr><td>row_number {SparkR}</td><td align="right">R Documentation</td></tr></table>
<h2>row_number</h2>
<h3>Description</h3>
<p>Window function: returns a sequential number starting at 1 within a window partition.
</p>
<h3>Usage</h3>
<pre>
## S4 method for signature 'missing'
row_number()
row_number(x = "missing")
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p>empty. Should be used with no argument.</p>
</td></tr>
</table>
<h3>Details</h3>
<p>This is equivalent to the ROW_NUMBER function in SQL.
</p>
<h3>Note</h3>
<p>row_number since 1.6.0
</p>
<h3>See Also</h3>
<p>Other window_funcs: <code><a href="cume_dist.html">cume_dist</a></code>,
<code><a href="cume_dist.html">cume_dist</a></code>,
<code><a href="cume_dist.html">cume_dist,missing-method</a></code>;
<code><a href="dense_rank.html">dense_rank</a></code>, <code><a href="dense_rank.html">dense_rank</a></code>,
<code><a href="dense_rank.html">dense_rank,missing-method</a></code>;
<code><a href="lag.html">lag</a></code>, <code><a href="lag.html">lag</a></code>,
<code><a href="lag.html">lag,characterOrColumn-method</a></code>;
<code><a href="lead.html">lead</a></code>, <code><a href="lead.html">lead</a></code>,
<code><a href="lead.html">lead,characterOrColumn,numeric-method</a></code>;
<code><a href="ntile.html">ntile</a></code>, <code><a href="ntile.html">ntile</a></code>,
<code><a href="ntile.html">ntile,numeric-method</a></code>;
<code><a href="percent_rank.html">percent_rank</a></code>, <code><a href="percent_rank.html">percent_rank</a></code>,
<code><a href="percent_rank.html">percent_rank,missing-method</a></code>;
<code><a href="rank.html">rank</a></code>, <code><a href="rank.html">rank</a></code>,
<code><a href="rank.html">rank</a></code>, <code><a href="rank.html">rank,ANY-method</a></code>,
<code><a href="rank.html">rank,missing-method</a></code>
</p>
<h3>Examples</h3>
<pre><code class="r">## Not run:
##D df &lt;- createDataFrame(mtcars)
##D ws &lt;- orderBy(windowPartitionBy(&quot;am&quot;), &quot;hp&quot;)
##D out &lt;- select(df, over(row_number(), ws), df$hp, df$am)
## End(Not run)
</code></pre>
<hr><div align="center">[Package <em>SparkR</em> version 2.1.1 <a href="00Index.html">Index</a>]</div>
</body></html>