Remove duplicate rows considering all or a few columns

remove_duplicate_rows(x, columnNames, ...)

Arguments

x

A dataframe

columnNames

Names of the columns to use for computing duplicates. If not specified, all columns are used.

...

Arguments to be passed to `duplicated` function

Examples

temp <- data.frame(x = c(1, 2, 3, 1), y = c(1, 3, 3, 1), z = c(1, 2, 3, 2)) remove_duplicate_rows(temp)
#> x y z #> 1 1 1 1 #> 2 2 3 2 #> 3 3 3 3 #> 4 1 1 2
remove_duplicate_rows(temp, c("x", "y"))
#> x y z #> 1 1 1 1 #> 2 2 3 2 #> 3 3 3 3