Skip to content

uniqueN could supports list input #1224

@jangorecki

Description

@jangorecki

And not just lists but any type which is not supported by uniqueN could simply redirects to length(unique(.)).

library(data.table)
d1 <- data.table(a = 1:4, l = list(list(letters[1:2]),list(Sys.time()),list(1:10),list(letters[1:2])))
d1[,length(unique(l))]
# [1] 3
d1[,uniqueN(l)]
#Error in uniqueN(l) : 
#  x must be an atomic vector or data.frames/data.tables

Looks pretty easy to do, I will try to make PR for that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions