data.table
based implementation.
# S3 method for relop_project 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. |
dL <- build_frame( "subjectID", "surveyCategory" , "assessmentTotal" | 1 , "withdrawal behavior", 5 | 1 , "positive re-framing", 2 | 2 , "withdrawal behavior", 3 | 2 , "positive re-framing", 4 ) test_p <- local_td(dL) %.>% project(., maxscore := max(assessmentTotal), count := n(), groupby = 'subjectID') cat(format(test_p))#> mk_td("dL", c( #> "subjectID", #> "surveyCategory", #> "assessmentTotal")) %.>% #> project(., maxscore := max(assessmentTotal), count := n(), #> groupby = c('subjectID'))dL %.>% test_p#> subjectID maxscore count #> 1 1 5 2 #> 2 2 4 2