What are the differences between distinct and unique in R using dplyr in consideration to:
- Speed
- Capabilities (valid inputs, parameters, etc) & Uses
- Output
For example:
library(dplyr)
data(iris)
# creating data with duplicates
iris_dup <- bind_rows(iris, iris)
d <- distinct(iris_dup)
u <- unique(iris_dup)
all(d==u) # returns True
In this example distinct and unique perform the same function. Are there examples of times you should use one but not the other? Are there any tricks or common uses of one?