Remove duplicate works, preferring the record with more complete data. Ties keep the first record. Kept records stay in their input order, with only their child rows and referenced lookup records.
Arguments
- corpus
An
sm_corpus.- by
Non-empty character vector of works columns that together identify duplicates. Default
"doi". DOIs and titles are normalised, other character values are trimmed, and other types compare as stored. A missing or empty value in any key column never counts as a duplicate.- verbose
Logical; show progress?
Examples
corpus <- sm_example_corpus(n_works = 20, seed = 1)
doubled <- sm_bind_corpora(corpus, corpus)
#> ℹ Re-keyed 20 works, 0 authors, 0 sources and 0 institutions in the second
#> corpus.
#> ℹ 20 works share a DOI with the first corpus; use `sm_dedupe()` to remove
#> duplicates.
nrow(doubled$works)
#> [1] 40
deduped <- sm_dedupe(doubled)
#> ✔ Removed 20 duplicate works with the same doi.
nrow(deduped$works)
#> [1] 20