Learn R Programming

fixr (version 0.2.0)

find_duplicate_rows: Find duplicate rows in a data frame

Description

This function identifies and reports duplicate rows in a given data frame. It first removes any rows with no values in all cells, and then compares each row to subsequent rows to check for duplicates. Duplicate rows are identified by having the same values in all columns. The function returns a message stating whether or not duplicate rows were found, and if so, the row numbers of the duplicate and original rows.

Usage

find_duplicate_rows(df)

Value

A message stating whether or not duplicate rows were found, and if so, the row numbers of the duplicate and original rows.

Arguments

df

A data frame to check for duplicate rows.

Examples

Run this code
# Create example data frame
df <- data.frame(w = c(7, 8, 180, 7), x = c("a", "b", "c", "a"),
                 y = c(4, 5, -6, 4), z = c(7, 8, NA, 7))
# Find duplicate rows
find_duplicate_rows(df)

Run the code above in your browser using DataLab