R/relop_set_indicator.R
ex_data_table_step.relop_set_indicator.Rd
data.table
based implementation.
# S3 method for relop_set_indicator ex_data_table_step( optree, ..., tables = list(), source_usage = NULL, source_limit = NULL, env = parent.frame() )
optree | relop operations tree. |
---|---|
... | not used, force later arguments to bind by name. |
tables | named list map from table names used in nodes to data.tables and data.frames. |
source_usage | list mapping source table names to vectors of columns used. |
source_limit | if not null limit all table sources to no more than this many rows (used for debugging). |
env | environment to work in. |
d <- data.frame(a = c("1", "2", "1", "3"), b = c("1", "1", "3", "2"), q = 1, stringsAsFactors = FALSE) set <- c("1", "2") op_tree <- local_td(d) %.>% set_indicator(., "one_two", "a", set) %.>% set_indicator(., "z", "a", c()) d %.>% op_tree#> a b q one_two z #> 1 1 1 1 1 0 #> 2 2 1 1 1 0 #> 3 1 3 1 1 0 #> 4 3 2 1 0 0