Learn R Programming

vvauditor (version 0.7.0)

check_duplicates: Check for Duplicate Rows in Selected Columns

Description

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.

Usage

check_duplicates(data, columns)

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.

Arguments

data

A data frame.

columns

A character vector of column names.

Examples

Run this code
# 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"))

Run the code above in your browser using DataLab