unduplicate | R Documentation |
Remove duplicated elements from an object. Simple wrapper for base::duplicated()
to use in functional contexts.
unduplicate(x)
x |
An object. |
Calls either x[!duplicated(x)]
or x[!duplicated(x), ]
depending on input dimensions. Will work for objects with a defined method for base::duplicated()
.
Object of the same type as input.
#simple vector
simple_vector = sample(1:5, size = 20, replace = T) %T>% print
simple_vector %>% unduplicate
#example on iris (data frame)
iris_with_dups = iris[c(1, 1, 2, 2, 3, 4, 1, 5, 2, 4), ] %T>% print
iris_with_dups %>% unduplicate
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.