Submitted by: M C; Assigned to: Arun ; R-Forge link
Calling anyDuplicated on a data.table currently calls anyDuplicated.data.frame and anyDuplicated.default, when any(duplicated.data.table(.)) would be faster on large data tables.
Suggest a simple redirect to the duplicated.data.table method, which would also respect the other arguments in duplicated.data.table.
anyDuplicated.data.table(...) <- function(...) any(duplicated.data.table(...)).
Reproducible code:
a <- data.table(a = c(1,1,2), b = letters[c(1,1,2)], key = "a")
debugonce(anyDuplicated.default)
anyDuplicated(a)