no_duplicates: Returns TRUE if no values are duplicated

Description Usage Arguments Details Value See Also Examples

View source: R/r_utils.R

Description

This function tests if values in the sepcified columns have no duplicate values. This the inverse of duplicated. This is a convenience function meant to be used as a predicate in an assertr verify statment.

Usage

1

Arguments

...

columns from the data.frame

Details

Warning: Since this uses duplicated, the columns are pasted together with '\t', this will fail if any of the specified columns contain '\t' characters.

Value

A vector of the same length that is TRUE when the values in the specified columns are distinct

See Also

duplicated

Examples

1
2
3
4
5
6
7
8
z <- data.frame(a=c(1,2,3,4,5,6), b=c(1,1,1,3,3,3), c=c(1,2,3,1,2,3))
zz <- z %>% verify(no_duplicates(a))
zz <- z %>% verify(no_duplicates(b))    # verification failed! (4 failures)
zz <- z %>% verify(no_duplicates(c))    # verification failed! (3 failures)
zz <- z %>% verify(no_duplicates(a,b))
zz <- z %>% verify(no_duplicates(a,c))
zz <- z %>% verify(no_duplicates(b,c))
zz <- z %>% verify(no_duplicates(a,b,c))

momeara/Bethany documentation built on Aug. 6, 2019, 9:26 a.m.