Hi all,

I'm really new to data.table and something really simple has me stumped.

Lets say I have the following (but much bigger so timing matters)

dt = data.table(x=1:100,y=1:2,z=1:4,key="y,z")

>From the documentation, I understand that

dt[J(1,3)]

is significantly faster 

dt[y==1 & z==3]


and I could do

dt[J(1)]

instead of 

dt[y==1]

but is there any way to do 

dt[z==3]

faster?  I want to do something like

df[J( ,3)]

but I know that doesn't make sense. Is it because z is not the primary key 
that I can't seem to figure out how to use J to do this? Since it isn't 
sorted on z anyway I doubt I can get a speed up right?
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to