Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

has_duplicates

Does the input have duplicates?


Description

Checks to see if the input has duplicates.

Usage

assert_has_duplicates(x, severity = getOption("assertive.severity", "stop"))

assert_has_no_duplicates(x, severity = getOption("assertive.severity",
  "stop"))

has_duplicates(x, .xname = get_name_in_parent(x))

has_no_duplicates(x, .xname = get_name_in_parent(x))

Arguments

x

Input to check.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

.xname

Not intended to be used directly.

Value

has_duplicates returns TRUE ifanyDuplicated is TRUE. assert_has_duplicates returns nothing but throws an error if has_duplicates is not TRUE. has_no_duplicates is the negation of has_duplicates.

See Also

Examples

x <- sample(10, 100, replace = TRUE)
assert_has_duplicates(x)
has_no_duplicates(x)

assertive.properties

Assertions to Check Properties of Variables

v0.0-4
GPL (>= 3)
Authors
Richard Cotton [aut, cre]
Initial release
2016-12-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.