This function removes duplicate rows from a data frame while keeping the first occurrence of each unique combination of the specified grouping variables.

deduplicate_by(.data, ...)

Arguments

.data

A data frame or tibble

...

One or more unquoted variable names to group by

Value

A data frame with duplicate rows removed, keeping only the first occurrence for each unique combination of grouping variables

Examples

if (FALSE) { # \dontrun{
# Remove duplicates based on a single column
df %>% deduplicate_by(species)

# Remove duplicates based on multiple columns
df %>% deduplicate_by(species, site, year)
} # }