lumpDuplicatedByPK: Lump duplicated registers by PK

View source: R/primaryKey.R

lumpDuplicatedByPKR Documentation

Lump duplicated registers by PK

Description

For duplicated rows, omit NAs and take unique values in columns when at least one value exists to reduce the duplicates.

Usage

lumpDuplicatedByPK(
  x,
  pk,
  collapse,
  tryNumeric = FALSE,
  tolerance = sqrt(.Machine$double.eps)
)

Arguments

x

a data.frame.

pk

columns with the primary key.

collapse

a character. If no missing, duplicated values are collapsed in a string separated by collapse character.

tryNumeric

if TRUE, convert values to numeric if no data is lost and take the mean if values are similar.

tolerance

relative tolerance passed to all.equal when comparing values if tryNumeric is TRUE.

Value

a named 'list' with a 'df' item for the x rows without duplicates and a 'dup' item with duplicated rows.


jmaspons/dbTools documentation built on March 10, 2024, 7:30 p.m.