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
If you have auto.index=TRUE your code will always create index when filtering in i for supported cases but many times the dataset is just temporary processing data which will be gone after exit of function. In those cases there is not point to create index. On the other hand I have dataset where I've manually set indexes and those I would like to use (via == or %in%).
Currently datatable.auto.index option seems to affect both cases so cannot be turned on.
library(data.table)
options("datatable.auto.index"=TRUE)
options("datatable.verbose"=TRUE)
d= data.table(k=1)
set2key(d, k)
fordertook0.004secd[k==1]
# Using existing index 'k'# Starting bmerge ...done in 0 secs# k#1: 1
options("datatable.auto.index"=FALSE)
d= data.table(k=1)
set2key(d, k)
# forder took 0 secd[k==1]
# k#1: 1
The text was updated successfully, but these errors were encountered:
Upvoting the request, I also had use cases were wanted to manually maintain secondary keys and not to rely on automatic secondary keys construction. Unfortunately, options("datatable.auto.index"=FALSE) disables a use of already available secondary keys.
arunsrinivasan
changed the title
Allow to auto use index but don't allow to auto create it
Use existing index even when auto index is disabled
Nov 26, 2015
Added to 1.9.8 milestone as it will be useful to have when presenting difference of use of index vs not using index. So allows to avoid helper functions like the one with_index I've used in Scaling data.table using index. Now in 1.9.7 we have index used on joins so it is good to be able to present that feature nicely.
Proposing a new option with following default options("datatable.use.index"=TRUE), combined with datatable.auto.index will give fine control.
If you have
auto.index=TRUE
your code will always create index when filtering ini
for supported cases but many times the dataset is just temporary processing data which will be gone after exit of function. In those cases there is not point to create index. On the other hand I have dataset where I've manually set indexes and those I would like to use (via==
or%in%
).Currently
datatable.auto.index
option seems to affect both cases so cannot be turned on.The text was updated successfully, but these errors were encountered: