Learn R Programming

campfin (version 1.0.11)

flag_dupes: Flag Duplicate Rows With New Column

Description

This function uses dplyr::mutate() to create a new dupe_flag logical variable with TRUE values for any record duplicated more than once.

Usage

flag_dupes(data, ..., .check = TRUE, .both = TRUE)

Value

A data frame with a new dupe_flag logical variable.

Arguments

data

A data frame to flag.

...

Arguments passed to dplyr::select() (needs to be at least dplyr::everything()).

.check

Whether the resulting column should be summed and removed if empty.

.both

Whether to flag both duplicates or just subsequent.

Examples

Run this code
flag_dupes(iris, dplyr::everything())
flag_dupes(iris, dplyr::everything(), .both = FALSE)

Run the code above in your browser using DataLab