counts_tb | R Documentation |
counts_tb
is a convenience extension of
counts
that returns the most AND least common "n" unique
value(s) a vector. This is useful for identifying data entry errors or rare
cases. For complex use cases see describe
.
counts_tb(y, n = 10, sep = "_", na.rm = TRUE)
y |
A vector. |
n |
The number of top & bottom unique values you want frequency counts for. Default is 10 (fewer than "n" will be shown if there aren't "n" unique values). |
sep |
This only needs to be modified if some values to be counted contain an underscore, in which case you should change it to a character string that is not present in any of the values of y. |
na.rm |
Should missing values be omitted (TRUE/FALSE)? |
A list of data frames of the top and bottom counts for each variable of the input data frame. Return value columns are "top_v" = top value, "top_n" = count of the top value in the same row of the adjacent top_v column, "bot_v" = bottom value, & "bot_n" = count of the bottom value in the same row of the adjacent bot_v column.
Craig P. Hutton, Craig.Hutton@gov.bc.ca
counts_tb_all
, counts_all
, counts
#using the mtcars data data(mtcars) counts_tb(mtcars$cyl) #top & bottom values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.