epi_clean_get_dups: Get all duplicated rows including the originals

View source: R/epi_clean_get_dups.R

epi_clean_get_dupsR Documentation

Get all duplicated rows including the originals

Description

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

Usage

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 <\url{https://github.com/AntonioJBT/episcout}>

See Also

duplicated

Examples


## 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 June 8, 2024, 7:47 a.m.