count_dupes() returns values of by variables for which the .data has
multiple rows, along with the number of rows for each combination of values.
assert_unique() throws an error if there are multiple rows for any
combination of by variable values
Usage
count_dupes(.data, by, setkey = FALSE)
assert_unique(.data, by, data_chr, by_chr)
Value
count_dupes()
A data.table with the (filtered) by
columns and an additional column "n_rows" which shows the number of rows in
.data having the combination of by values shown in the output
row.
assert_unique()
No return value. Called to throw an
error depending on the input.
Arguments
.data
A data frame or data table
by
tidy-select. Columns in .data
setkey
Logical. Should the output be keyed by by cols?
data_chr
optional. character. You can use this argument to manually specify
the name of data shown in error messages. Useful when using these functions
as checks inside other functions.
by_chr
optional. character. You can use this argument to manually specify
the name of by shown in error messages. Useful when using these functions
as checks inside other functions.