# Check if "name" is a unique key of the starwars table (yes !)
dup(dplyr::starwars, keyby = "name", view = FALSE)
# Check if "key" is a unique key of the basic table (no !)
basic <- data.frame("key" = c("a", "b", "c", "d", NA, "a", "e", "f"),
"value" = c(112, 117, 317, NA, 0, 17, 117, 112))
dup(basic, keyby = "key", view = FALSE)
Run the code above in your browser using DataLab