Passes a single table to a function that takes a single data.frame as its argument, and returns a single data.frame.

# S3 method for relop_non_sql
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.

Examples


set.seed(3252)
d <- data.frame(a = rnorm(1000), b = rnorm(1000))

optree <- local_td(d) %.>%
  quantile_node(.)
d %.>% optree
#>   quantile_probability           a           b
#> 1                 0.00 -3.50439920 -3.28609345
#> 2                 0.25 -0.68953634 -0.65437269
#> 3                 0.50  0.06202078 -0.02633575
#> 4                 0.75  0.70671528  0.68149724
#> 5                 1.00  2.80643560  2.74298098

p2 <- local_td(d) %.>%
  rsummary_node(.)
d %.>% p2
#>   column index   class nrows nna nunique       min      max        mean
#> 1      a     1 numeric  1000   0    1000 -3.504399 2.806436 0.023769312
#> 2      b     2 numeric  1000   0    1000 -3.286093 2.742981 0.009730607
#>          sd lexmin lexmax
#> 1 1.0276878     NA     NA
#> 2 0.9885712     NA     NA

summary(d)
#>        a                  b            
#>  Min.   :-3.50440   Min.   :-3.286093  
#>  1st Qu.:-0.68729   1st Qu.:-0.653802  
#>  Median : 0.06250   Median :-0.023986  
#>  Mean   : 0.02377   Mean   : 0.009731  
#>  3rd Qu.: 0.70683   3rd Qu.: 0.682012  
#>  Max.   : 2.80644   Max.   : 2.742981