简体   繁体   中英

data.table column/data filtering execution order in R?

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:

  1. being excluded few columns
  2. filtering the rows for certain date-range
  3. filtering the rows for one particular holiday period

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).

It should always be left to right!

vec <- 1:10
vec[vec>5][1:2]

[1] 6 7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM