View source: R/duplicate-count.R
| duplicate_count | R Documentation |
duplicate_count() returns a frequency table of the values in
a vector or data frame. For a data frame, it pools the values of all
columns and records which columns each value appears in.
This is a blunt tool for initial checks. If many values have few characters each, duplicates occur by chance and mean little.
Call audit() on the output for summary statistics.
duplicate_count(x, ignore = NULL, locations_type = c("character", "list"))
x |
Vector, matrix, or data frame. Missing values are not counted, nor are
blank strings, |
ignore |
Optionally, a vector of values not to count. |
locations_type |
String. |
A tibble with these columns, or only the first two if x is not
named:
value: the distinct values of x.
frequency: how often each occurs, in descending order.
locations: the names of the columns of x in which value appears.
locations_n: the number of such columns.
The tibble has the class scrutiny_dup_count, which is recognized by
audit().
audit()audit() on duplicate_count()
output returns summary statistics for frequency and locations_n (or
frequency alone if x is not named).
duplicate_count_colpair() for duplicates between pairs of columns.
duplicate_tally() for counts next to each value.
janitor::get_dupes() for duplicate rows.
iris |>
duplicate_count()
iris |>
duplicate_count() |>
audit()
# Ignore some values:
iris |>
duplicate_count(ignore = c("setosa", "versicolor", "virginica"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.