data.table based implementation.

# S3 method for relop_extend
ex_data_table_step(
  optree,
  ...,
  tables = list(),
  source_usage = NULL,
  source_limit = NULL,
  env = parent.frame()
)

Arguments

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.

Details

Will re-order columns if there are ordering terms.

Examples

dL <- build_frame( "subjectID", "surveyCategory" , "assessmentTotal", "one" | 1 , "withdrawal behavior", 5 , 1 | 1 , "positive re-framing", 2 , 1 | 2 , "withdrawal behavior", 3 , 1 | 2 , "positive re-framing", 4 , 1 ) rquery_pipeline <- local_td(dL) %.>% extend_nse(., probability %:=% exp(assessmentTotal * 0.237)/ sum(exp(assessmentTotal * 0.237)), count %:=% sum(one), rank %:=% rank(), orderby = c("assessmentTotal", "surveyCategory"), reverse = c("assessmentTotal"), partitionby = 'subjectID') %.>% orderby(., c("subjectID", "probability")) dL %.>% rquery_pipeline
#> subjectID surveyCategory assessmentTotal one probability count rank #> 1 1 positive re-framing 2 1 0.3293779 2 2 #> 2 1 withdrawal behavior 5 1 0.6706221 2 1 #> 3 2 withdrawal behavior 3 1 0.4410258 2 2 #> 4 2 positive re-framing 4 1 0.5589742 2 1