Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Row selection error in 1.9.4 #865

Closed
kaybenleroll opened this issue Oct 7, 2014 · 5 comments
Closed

Row selection error in 1.9.4 #865

kaybenleroll opened this issue Oct 7, 2014 · 5 comments

Comments

@kaybenleroll
Copy link

The following code now gives me an error in 1.9.4

report.dt <- structure(list(symbol = c("SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "SPY.AMEX",
"SPY.AMEX", "SPY.AMEX", "SPY.AMEX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX", "XIU.TSX",
"XIU.TSX", "XIU.TSX", "XIU.TSX"), bias.date = structure(c(16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332, 16087,
16122, 16150, 16177, 16206, 16241, 16269, 16297, 16332), class = "Date"),
bias.horizon = c(5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 30L,
30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 35L, 35L, 35L, 35L,
35L, 35L, 35L, 35L, 35L, 40L, 40L, 40L, 40L, 40L, 40L, 40L,
40L, 40L, 45L, 45L, 45L, 45L, 45L, 45L, 45L, 45L, 45L, 50L,
50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 25L, 25L, 25L, 25L, 25L, 25L,
25L, 25L, 25L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L,
35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 40L, 40L, 40L,
40L, 40L, 40L, 40L, 40L, 40L, 45L, 45L, 45L, 45L, 45L, 45L,
45L, 45L, 45L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L
), count = c(12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L), bias.factor = c(-0.181990730793591, -0.157386373051271,
-0.108788532285382, -0.10416147549407, -0.0959501840744551,
-0.141049442763147, -0.0855197772248671, -0.0962186870222952,
-0.110056497094665, -0.248410993052872, -0.244319970602503,
-0.200232999356397, -0.166130250813882, -0.122979210228853,
-0.158013070022775, -0.129173394906029, -0.114432181350096,
-0.103624540668688, -0.197267956604023, -0.169105952610585,
-0.148799560197651, -0.138340863157197, -0.119489321994165,
-0.146373483747205, -0.126248958117156, -0.0989360689054807,
-0.0980415008550114, -0.254325080624769, -0.193626767236272,
-0.169298442705999, -0.156526415333403, -0.156526415333403,
-0.174893425890281, -0.158012837960526, -0.158012837960526,
-0.173203922220292, -0.189000523563615, -0.1628261440773,
-0.154827312304701, -0.141457174449658, -0.194420034963782,
-0.202660039764033, -0.164481095134292, -0.173512152830851,
-0.173512152830851, -0.206758305196044, -0.192097192771725,
-0.17609729430406, -0.145847059414039, -0.187375738943488,
-0.201863758076926, -0.167739765903027, -0.181083636004296,
-0.181083636004296, -0.216836948654052, -0.188794653101378,
-0.160589091357613, -0.143680373033423, -0.174454439415515,
-0.189958545684938, -0.158089755619784, -0.157000922601376,
-0.157000922601376, -0.232982086703608, -0.180998043061361,
-0.15561589788422, -0.15561589788422, -0.174502171005641,
-0.167061095482464, -0.167061095482464, -0.163777175613345,
-0.163777175613345, -0.203680400769742, -0.183028962854708,
-0.168424472070266, -0.186771385520673, -0.216464734698358,
-0.207058969927012, -0.196528526261894, -0.196528526261894,
-0.196528526261894, -0.236079358893044, -0.215188684264064,
-0.195994902695388, -0.20535274207546, -0.229516104659371,
-0.225632411639441, -0.202260156642463, -0.202260156642463,
-0.202260156642463, -0.219346993570206, -0.20370181499692,
-0.182405973333341, -0.195089698863144, -0.20741935202983,
-0.236071201057387, -0.2194263508064, -0.217422681444193,
-0.206608863426703, -0.25783472338109, -0.240964583524164,
-0.227975592051871, -0.22297040162216, -0.188816122552011,
-0.221954961047395, -0.192777035714416, -0.159127781773642,
-0.140597266073715, -0.147868152512557, -0.119428779100635,
-0.10375883099938, -0.123288761406698, -0.123986242148983,
-0.155615002731116, -0.13294655072552, -0.114604592003737,
-0.11393487487072, -0.205261081709739, -0.150877424143677,
-0.161431663724531, -0.165954712891148, -0.165954712891148,
-0.149725519141146, -0.122149254245281, -0.122149254245281,
-0.125380175592321, -0.20652584227752, -0.191954066407412,
-0.196448688735699, -0.204374496199013, -0.229389053452753,
-0.217657238439756, -0.188169573217857, -0.193638037257531,
-0.193638037257531, -0.229768246298331, -0.216404065256089,
-0.216421098874323, -0.216094046546474, -0.237756797390961,
-0.241758508187849, -0.208461566703768, -0.208922866320351,
-0.208922866320351, -0.215959944509461, -0.192905083739829,
-0.184753767180671, -0.197488261622962, -0.201693360538085,
-0.206768275880781, -0.174350258969571, -0.168769778896188,
-0.168769778896188, -0.21413110018024, -0.177372732499464,
-0.186702494825749, -0.186702494825749, -0.199904800477863,
-0.175132275759552, -0.175132275759552, -0.166318279466713,
-0.166318279466713, -0.203629393878263, -0.197898923564453,
-0.204135513051953, -0.216366359116556, -0.226616152914679,
-0.210263379682083, -0.190804506464986, -0.190804506464986,
-0.190804506464986, -0.24639963685819, -0.237539315263458,
-0.240687936784342, -0.256246054793533, -0.26354191395087,
-0.254574533086412, -0.23690278266819, -0.23690278266819,
-0.23690278266819)), .Names = c("symbol", "bias.date", "bias.horizon",
"count", "bias.factor"), class = c("data.table", "data.frame"
));

report.dt[symbol == "SPY.AMEX"][bias.horizon == max(bias.horizon)]

The error it returns is

Error in eval(expr, envir, enclos) : object 'bias.horizon' not found

If I change the code to

report.dt[symbol == "SPY.AMEX" & bias.horizon == max(bias.horizon)]

it works as expected.

All the code worked before, so I assume something changed in 1.9.4? Happy to change my code if I need to, in the event that this is not a bug and just a result of how things have changed.

@pteehan
Copy link

pteehan commented Oct 7, 2014

+1 we're getting similar issues in some circumstances (1.9.4 upgrade broke old code related to row indexing)

@jangorecki
Copy link
Member

duplicate of #858?

@kaybenleroll
Copy link
Author

Yep. My bad.

@arunsrinivasan
Copy link
Member

Yes this is a duplicate, and is a bug. This is a new experimental feature that'll enable very fast binary search based indexing automatically. Please have a look at the README file which says:

These optimizations and function names/arguments are experimental and may be turned off with options(datatable.auto.index=FALSE).

@arunsrinivasan
Copy link
Member

Fixed by @mattdowle in commit 181aec9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants