You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error using uniqueN() with v 1.11.6 and 1.11.7 #3055
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
I've grep'd the source and this error string does not exist in C or R for the new version. But it did exist in the old version at C level. So I suspect an upgrade issue on your Windows machine which we often see around this time just after an upgrade. Your R session is still using the old .dll, but calling it using the new version of R code in the package. That mismatch is causing the problem, if my guess is correct.
But don't install dev or GitLab. Just follow that procedure about closing open R sessions, rebooting, and then reinstalling cleanly from CRAN and running test.data.table().
I think you will find test.data.table() fails for you. But after a clean reinstall it should work.
Please update this issue with how you get on.
If the clean reinstall works, can you tell us precisely what were the conditions that allowed this to happen? We have never discovered for sure why it happens. My guess is that people have two R sessions open, upgrade in one, detach and reattach, but the underlying old .dll is still in use by Windows in the other R session, so Windows doesn't upgrade it yet. Whereas on Linux and Mac, two versions of the same file can exist at the same time just for this reason, so it's a Windows-only problem.
Rebooting and a clean install from CRAN fixed the error.
And, yes, I did have two R sessions going when installing v. 1.11.6 the first time. The one I used to install data.table was freshly opened. I had been working with the other session for some time though, and v. 1.11.4 was attached. I will take more care when updating next time.
I was able to go back and reproduce the error by installing v 1.11.4 and upgrading to v 1.11.6 without restarting a new R session (so with only a single session open).
I didn't follow the test.data.table() step correctly, so apologies, I can't report on the results with that. With v. 1.11.6 properly get installed I get one failure from test.data.table() that seems unrelated: "inst/tests/tests.Rraw for test number 1750.22."
Please let me know if I can provide more info. Thanks again.
Reacted by Matt Dowle, Michael Chirico and Jan Gorecki
Great - relief! This is the first time anyone has been able to reproduce the upgrade problem. By R do you mean RStudio?
On test 1750.22, do you have an object named a in your environment? Could you either remove a (e.g. rm(a)) or try again in a fresh R session, and does test.data.table() then fully pass? If so, I can see the problem and that test needs to be made a little bit more robust. It doesn't mean there's anything wrong with data.table. It's an artifact of the way that test works when run by a user in their environment.
Activity
mattdowle commentedon Sep 20, 2018
I've grep'd the source and this error string does not exist in C or R for the new version. But it did exist in the old version at C level. So I suspect an upgrade issue on your Windows machine which we often see around this time just after an upgrade. Your R session is still using the old .dll, but calling it using the new version of R code in the package. That mismatch is causing the problem, if my guess is correct.
Please follow the procedure here : https://github.com/Rdatatable/data.table/wiki/Installation#windows
But don't install dev or GitLab. Just follow that procedure about closing open R sessions, rebooting, and then reinstalling cleanly from CRAN and running
test.data.table().I think you will find
test.data.table()fails for you. But after a clean reinstall it should work.Please update this issue with how you get on.
If the clean reinstall works, can you tell us precisely what were the conditions that allowed this to happen? We have never discovered for sure why it happens. My guess is that people have two R sessions open, upgrade in one, detach and reattach, but the underlying old .dll is still in use by Windows in the other R session, so Windows doesn't upgrade it yet. Whereas on Linux and Mac, two versions of the same file can exist at the same time just for this reason, so it's a Windows-only problem.
nilescbn commentedon Sep 20, 2018
Wow, I really appreciate the quick reply.
Rebooting and a clean install from CRAN fixed the error.
And, yes, I did have two R sessions going when installing v. 1.11.6 the first time. The one I used to install data.table was freshly opened. I had been working with the other session for some time though, and v. 1.11.4 was attached. I will take more care when updating next time.
I was able to go back and reproduce the error by installing v 1.11.4 and upgrading to v 1.11.6 without restarting a new R session (so with only a single session open).
I didn't follow the test.data.table() step correctly, so apologies, I can't report on the results with that. With v. 1.11.6 properly get installed I get one failure from test.data.table() that seems unrelated: "inst/tests/tests.Rraw for test number 1750.22."
Please let me know if I can provide more info. Thanks again.
mattdowle commentedon Sep 20, 2018
Great - relief! This is the first time anyone has been able to reproduce the upgrade problem. By R do you mean RStudio?
On test 1750.22, do you have an object named
ain your environment? Could you either removea(e.g.rm(a)) or try again in a fresh R session, and doestest.data.table()then fully pass? If so, I can see the problem and that test needs to be made a little bit more robust. It doesn't mean there's anything wrong with data.table. It's an artifact of the way that test works when run by a user in their environment.mattdowle commentedon Sep 20, 2018
Closing now as original problem was due to upgrade problem. Confirmed fixed by clean reinstall.
nilescbn commentedon Sep 20, 2018
First, yes, I meant RStudio.
And, yes, with an clean environment I get the "All 7835 tests in inst/tests/tests.Rraw completed ok" message.
Okay, thanks again for the assistance (and for data.table!). Much appreciated.
Test 1750.22 robustified for side-issue in #3055
Test 1750.22 robustified for side-issue in #3055 (#3057)