Checks that the key columns identify each row once, and stops with the
number of duplicated keys and a few examples otherwise. Run it before
writing: DuckDB tables built for "delete then insert" updates have no
primary key, so uniqueness is enforced here (see create_schema()).
Usage
check_unique(data, keys, what = deparse1(substitute(data)))See also
Other writing:
append_raw_records(),
replace_documents(),
replace_rows()
Examples
check_unique(data.frame(doc_id = c("a:1", "a:2")), "doc_id")
try(check_unique(data.frame(doc_id = c("a:1", "a:1")), "doc_id"))
#> Error in check_unique(data.frame(doc_id = c("a:1", "a:1")), "doc_id") :
#> 1 duplicated value of key doc_id in data.frame(doc_id = c("a:1",
#> "a:1")).
#> ℹ For example: "a:1".