epi_clean_get_dups: Get all duplicated rows including the originals

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/epi_clean_get_dups.R

Description

base R duplicated() does not return the originals (duplicated - 1). See for example find duplicates in R.

Usage

1
epi_clean_get_dups(df = NULL, var = "", freq = 1)

Arguments

df

A data.frame to extract duplicates from

var

Variable/column name as a string to use to detect duplicate values

freq

Frequency count, an integer. Defaults to 1 (so will return original plus any repeating values)

Value

a data.frame with original and duplicated rows

Note

Creates a table with frequencies, checks those which have more than 1 (or value passed to freq and considers these as variables with duplicates) and extracts them.

Author(s)

Antonio Berlanga-Taylor <https://github.com/AntonioJBT/episcout>

See Also

duplicated

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
dim(df)
epi_head_and_tail(df, rows = 2, cols = 2)
# Get all duplicates:
check_dups <- epi_clean_get_dups(df, 'var_id', 1)
dim(check_dups)
check_dups

## End(Not run)

AntonioJBT/episcout documentation built on Nov. 7, 2019, 5:34 p.m.