2 dedup()

The dedup() function deduplicates data, functioning the same as unique().

dedup(iris$Species)
## [1] setosa     versicolor virginica 
## Levels: setosa versicolor virginica

2.1 dup_rows()

The dup_rows() functions returns the duplicated rows in a 2-dimensional dataset. It is functionally the same as x[duplicated(x), ], where x is a matrix or data frame.

dup_rows(iris)
##     Sepal.Length Sepal.Width Petal.Length Petal.Width   Species
## 143          5.8         2.7          5.1         1.9 virginica

2.2 dup_nrow()

The dup_nrow() function counts the number of duplicates in a dataset.

dup_nrow(iris)
## [1] 1

2.3 dup_mark()

The dup_mark() function codes duplicate rows with a 1 and non-duplicates with a 0.

dup_mark(iris)
##   [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##  [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##  [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
## [149] 0 0