Skip to contents

Count the number of rows and filter to show which combinations have duplicates. This is just a wrapper around dplyr::count and dplyr::filter.

Usage

count_duplicates(.data, ...)

Arguments

.data

A tibble::tibble or data frame. There should not be a column with the name n. If there is, this won't work right.

...

<data-masking> Variables to group by.

Value

A tibble (or data frame) with columns from ... and an n column with the number of rows for each combination of ....

Examples

mtcars |>
    count_duplicates(cyl)
#>   cyl  n
#> 1   8 14
#> 2   4 11
#> 3   6  7