{"action":"created","issue":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/1861","repository_url":"https://api.github.com/repos/Rdatatable/data.table","labels_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1861/labels{/name}","comments_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1861/comments","events_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1861/events","html_url":"https://github.com/Rdatatable/data.table/issues/1861","id":180196625,"number":1861,"title":"strange behavior (functions not recognizing key)","user":{"login":"jfrostad","id":5043910,"avatar_url":"https://avatars.githubusercontent.com/u/5043910?v=3","gravatar_id":"","url":"https://api.github.com/users/jfrostad","html_url":"https://github.com/jfrostad","followers_url":"https://api.github.com/users/jfrostad/followers","following_url":"https://api.github.com/users/jfrostad/following{/other_user}","gists_url":"https://api.github.com/users/jfrostad/gists{/gist_id}","starred_url":"https://api.github.com/users/jfrostad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfrostad/subscriptions","organizations_url":"https://api.github.com/users/jfrostad/orgs","repos_url":"https://api.github.com/users/jfrostad/repos","events_url":"https://api.github.com/users/jfrostad/events{/privacy}","received_events_url":"https://api.github.com/users/jfrostad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-30T00:46:10Z","updated_at":"2016-09-30T00:56:19Z","closed_at":null,"body":"Hi,\r\n\r\nI am encountering some strange behavior when running data.table 1.9.7 on R version 3.2.4 using my institution's unix cluster. This behavior just began today without update to my version of R or data.table, though I have tried removing and reinstalling 1.9.7 from github, to no avail.\r\n\r\nThe issue is that functions that I understood to automatically use the key do not seem to be recognizing the key. For example:\r\n\r\n** to demonstrate clean session of R and clean install of data.table 1.9.7 **\r\n jfrostad@cn406:R\r\n\r\nR version 3.2.4 Revised (2016-03-16 r70336) -- \"Very Secure Dishes\"\r\nCopyright (C) 2016 The R Foundation for Statistical Computing\r\nPlatform: x86_64-pc-linux-gnu (64-bit)\r\n\r\nR is free software and comes with ABSOLUTELY NO WARRANTY.\r\nYou are welcome to redistribute it under certain conditions.\r\nType 'license()' or 'licence()' for distribution details.\r\n\r\n  Natural language support but running in an English locale\r\n\r\nR is a collaborative project with many contributors.\r\nType 'contributors()' for more information and\r\n'citation()' on how to cite R or R packages in publications.\r\n\r\nType 'demo()' for some demos, 'help()' for on-line help, or\r\n'help.start()' for an HTML browser interface to help.\r\nType 'q()' to quit R.\r\n\r\n> remove.packages(\"data.table\")                         # First remove the current version\r\nRemoving package from ‘/snfs2/HOME/jfrostad/R/x86_64-pc-linux-gnu-library/3.2’\r\n(as ‘lib’ is unspecified)\r\n> install.packages(\"data.table\", type = \"source\",\r\n+     repos = \"http://Rdatatable.github.io/data.table\") # Then install devel version\r\nInstalling package into ‘/snfs2/HOME/jfrostad/R/x86_64-pc-linux-gnu-library/3.2’\r\n(as ‘lib’ is unspecified)\r\ntrying URL 'http://Rdatatable.github.io/data.table/src/contrib/data.table_1.9.7.tar.gz'\r\nContent type 'application/octet-stream' length 2746374 bytes (2.6 MB)\r\n==================================================\r\ndownloaded 2.6 MB\r\n\r\n* installing *source* package ‘data.table’ ...\r\n** libs\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c assign.c -o assign.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c between.c -o between.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c bmerge.c -o bmerge.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c chmatch.c -o chmatch.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c dogroups.c -o dogroups.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c fastmean.c -o fastmean.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c fcast.c -o fcast.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c fmelt.c -o fmelt.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c forder.c -o forder.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c frank.c -o frank.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c fread.c -o fread.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c fsort.c -o fsort.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c fwrite.c -o fwrite.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c gsumm.c -o gsumm.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c ijoin.c -o ijoin.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c init.c -o init.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c inrange.c -o inrange.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c openmp-utils.c -o openmp-utils.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c quickselect.c -o quickselect.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c rbindlist.c -o rbindlist.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c reorder.c -o reorder.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c shift.c -o shift.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c subset.c -o subset.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c transpose.c -o transpose.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c uniqlist.c -o uniqlist.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c vecseq.c -o vecseq.o\r\ngcc -std=gnu99 -I/share/local/R-3.2.4/lib64/R/include -DNDEBUG  -I/usr/local/include   -fopenmp -fpic  -g -O2  -c wrappers.c -o wrappers.o\r\ngcc -std=gnu99 -shared -L/share/local/R-3.2.4/lib64/R/lib -L/usr/local/lib64 -o data.table.so assign.o between.o bmerge.o chmatch.o dogroups.o fastmean.o fcast.o fmelt.o forder.o frank.o fread.o fsort.o fwrite.o gsumm.o ijoin.o init.o inrange.o openmp-utils.o quickselect.o rbindlist.o reorder.o shift.o subset.o transpose.o uniqlist.o vecseq.o wrappers.o -fopenmp -L/share/local/R-3.2.4/lib64/R/lib -lR\r\nmv data.table.so datatable.so\r\nif [ \"\" != \"Windows_NT\" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id datatable.so datatable.so; fi\r\ninstalling to /snfs2/HOME/jfrostad/R/x86_64-pc-linux-gnu-library/3.2/data.table/libs\r\n** R\r\n** inst\r\n** byte-compile and prepare package for lazy loading\r\n** help\r\n*** installing help indices\r\n** building package indices\r\n** installing vignettes\r\n** testing if installed package can be loaded\r\n* DONE (data.table)\r\n\r\nThe downloaded source packages are in\r\n        ‘/tmp/RtmpV4nR4Y/downloaded_packages’\r\n> sessionInfo()\r\nR version 3.2.4 Revised (2016-03-16 r70336)\r\nPlatform: x86_64-pc-linux-gnu (64-bit)\r\nRunning under: CentOS release 6.8 (Final)\r\n\r\nlocale:\r\n [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C\r\n [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8\r\n [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8\r\n [7] LC_PAPER=en_US.UTF-8       LC_NAME=C\r\n [9] LC_ADDRESS=C               LC_TELEPHONE=C\r\n[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C\r\n\r\nattached base packages:\r\n[1] stats     graphics  grDevices utils     datasets  methods   base\r\n\r\nloaded via a namespace (and not attached):\r\n[1] tools_3.2.4\r\n> require(data.table)\r\nLoading required package: data.table\r\ndata.table 1.9.7 IN DEVELOPMENT built 2016-09-29 11:37:39 UTC; travis\r\n  The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way\r\n  Please type: ?data.table, example(data.table) and browseVignettes(\"data.table\")\r\n  Release notes and live news: http://r-datatable.com\r\n\r\n\r\n**to demonstrate issue using the unique() function and the example in the help file**\r\n\r\n> DT <- data.table(A = rep(1:3, each=4), B = rep(1:4, each=3), C = rep(1:2, 6), key = \"A,B\")\r\n> duplicated(DT)\r\n [1] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE\r\n> unique(DT)\r\n    A B C\r\n 1: 1 1 1\r\n 2: 1 1 2\r\n 3: 1 2 2\r\n 4: 2 2 1\r\n 5: 2 2 2\r\n 6: 2 3 1\r\n 7: 2 3 2\r\n 8: 3 3 1\r\n 9: 3 4 2\r\n10: 3 4 1\r\n> uniqueN(DT)\r\n[1] 10\r\n> unique(DT, by=c('A','B'))\r\n   A B C\r\n1: 1 1 1\r\n2: 1 2 2\r\n3: 2 2 1\r\n4: 2 3 1\r\n5: 3 3 1\r\n6: 3 4 2\r\n> uniqueN(DT, by=c('A','B'))\r\n[1] 6\r\n> key(DT)\r\n[1] \"A\" \"B\"\r\n> uniqueN(DT, by=key(DT))\r\n[1] 6\r\n> unique(DT, by=key(DT))\r\n   A B C\r\n1: 1 1 1\r\n2: 1 2 2\r\n3: 2 2 1\r\n4: 2 3 1\r\n5: 3 3 1\r\n6: 3 4 2\r\n\r\n**end example**\r\n\r\nI am unable to replicate this behavior on my Windows PC running 1.9.7 as well.\r\n\r\nThoughts on a solution?\r\n"},"comment":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/comments/250632623","html_url":"https://github.com/Rdatatable/data.table/issues/1861#issuecomment-250632623","issue_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1861","id":250632623,"user":{"login":"jfrostad","id":5043910,"avatar_url":"https://avatars.githubusercontent.com/u/5043910?v=3","gravatar_id":"","url":"https://api.github.com/users/jfrostad","html_url":"https://github.com/jfrostad","followers_url":"https://api.github.com/users/jfrostad/followers","following_url":"https://api.github.com/users/jfrostad/following{/other_user}","gists_url":"https://api.github.com/users/jfrostad/gists{/gist_id}","starred_url":"https://api.github.com/users/jfrostad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfrostad/subscriptions","organizations_url":"https://api.github.com/users/jfrostad/orgs","repos_url":"https://api.github.com/users/jfrostad/repos","events_url":"https://api.github.com/users/jfrostad/events{/privacy}","received_events_url":"https://api.github.com/users/jfrostad/received_events","type":"User","site_admin":false},"created_at":"2016-09-30T00:56:19Z","updated_at":"2016-09-30T00:56:19Z","body":"I see! Well that definitely explains it, sorry for not reading the documentation! I still don't understand why I am not experiencing this behavior on my Windows machine (also running 1.9.7)?\r\n\r\n> DT <- data.table(A = rep(1:3, each=4), B = rep(1:4, each=3), C = rep(1:2, 6), key = \"A,B\")\r\n> duplicated(DT)\r\n [1] FALSE  TRUE  TRUE FALSE\r\n [5] FALSE  TRUE FALSE  TRUE\r\n [9] FALSE FALSE  TRUE  TRUE\r\n> unique(DT)\r\n   A B C\r\n1: 1 1 1\r\n2: 1 2 2\r\n3: 2 2 1\r\n4: 2 3 1\r\n5: 3 3 1\r\n6: 3 4 2\r\n> sessionInfo()\r\nR version 3.2.3 (2015-12-10)\r\nPlatform: x86_64-w64-mingw32/x64 (64-bit)\r\nRunning under: Windows >= 8 x64 (build 9200)\r\n\r\nlocale:\r\n[1] LC_COLLATE=English_United States.1252 \r\n[2] LC_CTYPE=English_United States.1252   \r\n[3] LC_MONETARY=English_United States.1252\r\n[4] LC_NUMERIC=C                          \r\n[5] LC_TIME=English_United States.1252    \r\n\r\nattached base packages:\r\n[1] grid      parallel  stats    \r\n[4] graphics  grDevices utils    \r\n[7] datasets  methods   base     \r\n\r\nother attached packages:\r\n [1] plyr_1.8.3        \r\n [2] dplyr_0.4.3       \r\n [3] gridExtra_2.0.0   \r\n [4] ggthemes_3.0.2    \r\n [5] RColorBrewer_1.1-2\r\n [6] stringr_1.0.0     \r\n [7] RMySQL_0.10.7     \r\n [8] DBI_0.3.1         \r\n [9] magrittr_1.5      \r\n[10] ggplot2_2.0.0     \r\n[11] data.table_1.9.7  \r\n\r\nloaded via a namespace (and not attached):\r\n [1] Rcpp_0.12.2     \r\n [2] assertthat_0.1  \r\n [3] digest_0.6.8    \r\n [4] R6_2.1.1        \r\n [5] gtable_0.1.2    \r\n [6] pacman_0.3.0    \r\n [7] scales_0.3.0    \r\n [8] stringi_1.0-1   \r\n [9] reshape2_1.4.1  \r\n[10] labeling_0.3    \r\n[11] tools_3.2.3     \r\n[12] munsell_0.4.2   \r\n[13] colorspace_1.2-6\r\n> "}}
{"actor":{"display_login":"jfrostad"}}