Skip to contents

Generic function that removes or merges duplicate records from a table based on duplicate pairs identified by detect_duplicates().

Usage

deduplicate_table(base_table, duplicates, id, ...)

Arguments

base_table

A data.frame / tibble / data.table (or db table in other backends).

duplicates

A table of duplicate pairs generated by detect_duplicates

id

Character scalar naming the ID column in base_table.

...

Additional arguments passed to backend-specific methods.

Value

A deduplicated version of base_table.

Examples

ex <- exact_strategy(
  workshop ~ normalize_text() + word_tokens(min_nchar = 3),
  block_by = c("postcode_area", "trade")
)
dups <- detect_duplicates(workshop_register, id = "reg_no", strategy = ex)
deduped <- deduplicate_table(workshop_register, dups, id = "reg_no")
c(before = nrow(workshop_register), after = nrow(deduped))
#> before  after 
#>   1052    927