blob: 370752343254f3e783b05780d62e54a2b8c67605 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Count Distinct Values</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 countDistinct {SparkR}"><tr><td>countDistinct {SparkR}</td><td align="right">R Documentation</td></tr></table>
<h2>Count Distinct Values</h2>
<h3>Description</h3>
<p>Count Distinct Values
</p>
<p>Aggregate function: returns the number of distinct items in a group.
</p>
<h3>Usage</h3>
<pre>
## S4 method for signature 'Column'
countDistinct(x, ...)
## S4 method for signature 'Column'
n_distinct(x, ...)
countDistinct(x, ...)
n_distinct(x, ...)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p>Column to compute on</p>
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
<p>other columns</p>
</td></tr>
</table>
<h3>Value</h3>
<p>the number of distinct items in a group.
</p>
<h3>Note</h3>
<p>countDistinct since 1.4.0
</p>
<p>n_distinct since 1.4.0
</p>
<h3>See Also</h3>
<p>Other agg_funcs: <code><a href="summarize.html">agg</a></code>, <code><a href="summarize.html">agg</a></code>,
<code><a href="summarize.html">agg</a></code>, <code><a href="summarize.html">agg,GroupedData-method</a></code>,
<code><a href="summarize.html">agg,SparkDataFrame-method</a></code>,
<code><a href="summarize.html">summarize</a></code>, <code><a href="summarize.html">summarize</a></code>,
<code><a href="summarize.html">summarize</a></code>,
<code><a href="summarize.html">summarize,GroupedData-method</a></code>,
<code><a href="summarize.html">summarize,SparkDataFrame-method</a></code>;
<code><a href="avg.html">avg</a></code>, <code><a href="avg.html">avg</a></code>,
<code><a href="avg.html">avg,Column-method</a></code>; <code><a href="count.html">count</a></code>,
<code><a href="count.html">count</a></code>, <code><a href="count.html">count,Column-method</a></code>,
<code><a href="count.html">count,GroupedData-method</a></code>, <code><a href="count.html">n</a></code>,
<code><a href="count.html">n</a></code>, <code><a href="count.html">n,Column-method</a></code>;
<code><a href="first.html">first</a></code>, <code><a href="first.html">first</a></code>,
<code><a href="first.html">first</a></code>,
<code><a href="first.html">first,SparkDataFrame-method</a></code>,
<code><a href="first.html">first,characterOrColumn-method</a></code>;
<code><a href="kurtosis.html">kurtosis</a></code>, <code><a href="kurtosis.html">kurtosis</a></code>,
<code><a href="kurtosis.html">kurtosis,Column-method</a></code>; <code><a href="last.html">last</a></code>,
<code><a href="last.html">last</a></code>,
<code><a href="last.html">last,characterOrColumn-method</a></code>;
<code><a href="max.html">max</a></code>, <code><a href="max.html">max,Column-method</a></code>;
<code><a href="mean.html">mean</a></code>, <code><a href="mean.html">mean,Column-method</a></code>;
<code><a href="min.html">min</a></code>, <code><a href="min.html">min,Column-method</a></code>;
<code><a href="sd.html">sd</a></code>, <code><a href="sd.html">sd</a></code>,
<code><a href="sd.html">sd,Column-method</a></code>, <code><a href="sd.html">stddev</a></code>,
<code><a href="sd.html">stddev</a></code>, <code><a href="sd.html">stddev,Column-method</a></code>;
<code><a href="skewness.html">skewness</a></code>, <code><a href="skewness.html">skewness</a></code>,
<code><a href="skewness.html">skewness,Column-method</a></code>;
<code><a href="stddev_pop.html">stddev_pop</a></code>, <code><a href="stddev_pop.html">stddev_pop</a></code>,
<code><a href="stddev_pop.html">stddev_pop,Column-method</a></code>;
<code><a href="stddev_samp.html">stddev_samp</a></code>, <code><a href="stddev_samp.html">stddev_samp</a></code>,
<code><a href="stddev_samp.html">stddev_samp,Column-method</a></code>;
<code><a href="sumDistinct.html">sumDistinct</a></code>, <code><a href="sumDistinct.html">sumDistinct</a></code>,
<code><a href="sumDistinct.html">sumDistinct,Column-method</a></code>;
<code><a href="sum.html">sum</a></code>, <code><a href="sum.html">sum,Column-method</a></code>;
<code><a href="var_pop.html">var_pop</a></code>, <code><a href="var_pop.html">var_pop</a></code>,
<code><a href="var_pop.html">var_pop,Column-method</a></code>;
<code><a href="var_samp.html">var_samp</a></code>, <code><a href="var_samp.html">var_samp</a></code>,
<code><a href="var_samp.html">var_samp,Column-method</a></code>; <code><a href="var.html">var</a></code>,
<code><a href="var.html">var</a></code>, <code><a href="var.html">var,Column-method</a></code>,
<code><a href="var.html">variance</a></code>, <code><a href="var.html">variance</a></code>,
<code><a href="var.html">variance,Column-method</a></code>
</p>
<h3>Examples</h3>
<pre><code class="r">## Not run: countDistinct(df$c)
## Not run: n_distinct(df$c)
</code></pre>
<hr><div align="center">[Package <em>SparkR</em> version 2.1.1 <a href="00Index.html">Index</a>]</div>
</body></html>