This function checks if there are any duplicate rows in the specified columns of a data frame. It prints the unique rows and returns a boolean indicating whether the number of rows in the original data frame is the same as the number of rows in the data frame with duplicate rows removed.

check_duplicates(data, columns)

Arguments

data

A data frame.

columns

A character vector of column names.

Value

A logical value indicating whether the number of rows in the original data frame is the same as the number of rows in the data frame with duplicate rows removed.

Examples

# Create a data frame
df <- data.frame(a = c(1, 2, 3, 1), b = c(4, 5, 6, 4), c = c(7, 8, 9, 7))
# Check for duplicate rows in the first two columns
check_duplicates(df, c("a", "b"))
#> c(1, 2, 3)c(4, 5, 6)
#> [1] FALSE