duplicates | R Documentation |
Inspect duplicate rows in a data frame by sets of columns.
duplicates(x, by_list, check_all = FALSE)
x |
A data frame, or a data frame extension, like a
|
by_list |
A list, where each element is a character vector
with columns names from |
check_all |
If |
If x
is a data.table
, we use data.table's optimized
data.table::uniqueN()
, otherwise we use dplyr::distinct()
to
calculate the number of duplicates.
We use list columns in the results, with typically short lists,
which in general can be printed nicely. As tibbles hide elements of
list columns, we return a data.frame
.
A data.frame
with columns by
(list), N_unique
and
N_duplicated
(integers), where each row corresponds to an element
of by_list
. If check_all == TRUE
, we add a row to the bottom,
where the value of by
is NULL
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.