EVOLUTION-MANAGER
Edit File: n_distinct.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: Efficiently count the number of unique values in a set of...</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 n_distinct {dplyr}"><tr><td>n_distinct {dplyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Efficiently count the number of unique values in a set of vector</h2> <h3>Description</h3> <p>This is a faster and more concise equivalent of <code>length(unique(x))</code> </p> <h3>Usage</h3> <pre> n_distinct(..., na.rm = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>vectors of values</p> </td></tr> <tr valign="top"><td><code>na.rm</code></td> <td> <p>if <code>TRUE</code> missing values don't count</p> </td></tr> </table> <h3>Examples</h3> <pre> x <- sample(1:10, 1e5, rep = TRUE) length(unique(x)) n_distinct(x) </pre> <hr /><div style="text-align: center;">[Package <em>dplyr</em> version 1.0.2 <a href="00Index.html">Index</a>]</div> </body></html>