Skip to content

Error using uniqueN() with v 1.11.6 and 1.11.7 #3055

@nilescbn

Description

@nilescbn

I updated to v. 1.11.6 while working on a project and immediately had trouble using the uniqueN() function. The error message I get is:

Error in isReallyReal(by) : x must be of type double.

I get the same error with this minimal reproducible example:

DT <- data.table(x = sample(letters, 100, replace = TRUE))

DT[ , uniqueN(x)]

I used this example because I first noticed the error with a character column. However, I get the same error with integer and numberic columns as well.

Using the base method DT[, length(unique(x))] works properly.

I did check and the same error occurs in the development version ( v. 1.11.7).

And rolling back to v. 1.11.4, uniqueN() works fine.

I'm a huge data.table fan, thank you for all your efforts. If I can help futher diagnosis the issue, I'm happy to do so. At the time of writing, I don't see anything in the news or open issues or StackOverflow on this possible bug. Apologies if I missed something obvious.

I'm using RStudio v. 1.2.830. And #here is my session info:

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils    
[5] datasets  methods   base     

other attached packages:
[1] data.table_1.11.7

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1   
[3] knitr_1.20    

Metadata

Metadata

Assignees

No one assigned

    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