howmany | R Documentation |
Count the number of unique values
howmany(x, ...)
## Default S3 method:
howmany(x, ...)
## S3 method for class 'data.frame'
howmany(x, ...)
## S3 method for class 'table'
howmany(x, ...)
x |
(Object) The object to count. |
... |
|
howmany(default)
: Returns the number of unique values in x
.
howmany(data.frame)
: Returns a dataframe showing the number of unique values in
each column of x
.
howmany(table)
: Coerces x
to data.frame
and passes it to data.frame
method.
Desi Quintans (http://www.desiquintans.com)
## --- Default method ---
howmany(rep(letters, 3))
#> 26
howmany(letters, LETTERS)
#> 52
## --- Data.frame method ---
howmany(mtcars)
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> 25 3 27 22 22 29 30 2 2 3 6
howmany(mtcars, -(mpg:disp))
#> hp drat wt qsec vs am gear carb
#> 22 22 29 30 2 2 3 6
howmany(mtcars, drat)
#> drat
#> 22
## --- Table method ---
class(Titanic)
#> [1] "table"
howmany(Titanic)
#> Class Sex Age Survived Freq
#> 4 2 2 2 22
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.