Description Usage Arguments Details Value Performance Note Examples
Count how many times each distinct value of a data.frame column is observed.
1 |
df |
A data.frame. |
col |
The column to count. |
sort |
Whether or not to sort the resulting total column. |
name |
The name of the total column. |
dfCount(x, "y") is similar in functionality to table(x$y), but
performs better on large datasets.
There are two main differences between dfCount and table:
1. dfCount returns a data.frame instead of table
object
2. dfCount includes a row for number of NA observations, whereas
table does not by default
A data.frame with two columns: The first column is the distinct values of the given variable, the second column shows the total number of rows with that value.
This function performs much faster than its equivalent table call on
large datasets, even though the table function does not sort the
results. The main speed boost is due to the fact that 'dplyr' is used.
The dplyr package is required for this function.
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.