nunique | R Documentation |
Given a vector of atomic type (logical
, integer
,
numeric
, complex
, character
) or a factor the function
returns the number of different elements.
nunique(x)
x |
[ |
A single integer value.
NAs are counted as a seperate value.
x = c(1, 2, 2, 3, 2, NA, NA, 5)
nunique(x) # 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.