It should always be left to right!
vec <- 1:10
vec[vec>5][1:2]
[1] 6 7
Question
When applying multiple filters, what is the execution order (left-to-right or right-to-left) for a data.table?
For example,
dt[,!excludeColumns,with=F][date > as.POSIXct('2013-01-02', 'GMT')][is.na(holiday)]
In the above, a data.table is:
Would like to know in which order they get executed? (so that we can put the filter that produces the smallest amount of data first, such that later steps have small data to further operate on, and thus faster).
Solution
It should always be left to right!
vec <- 1:10
vec[vec>5][1:2]
[1] 6 7