find_duplicates: Extract duplicated rows from data frame.

Description Usage Arguments Value See Also Examples

Description

Extract all rows from a data frame that occur more than once when compared in terms of the columns specified in columns. Two rows are duplicates with respect to the columns specified in columns if they agree element-wise in all of the specified columns.

Usage

1
find_duplicates(data, columns, select = NULL)

Arguments

data

Data frame

columns

Columns in data to be considered when looking for duplicated rows. Can be a character vector of column names or a numeric vector giving the column indexes.

select

Columns to include in resulting data frame. By default all columns will be included.

Value

A data frame containing all rows of data that had duplicates with respect to the columns specified in columns.

See Also

is_duplicated_in

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
d <- read.table(text = "
x y z
1 2 3
1 3 4
1 2 4
", header = TRUE)

find_duplicates(d, "x")
find_duplicates(d, "x", c("y", "z"))
find_duplicates(d, c("x", "y"))
find_duplicates(d, c("x", "z"))

cbaumbach/miscFun documentation built on May 13, 2019, 1:48 p.m.