This is a non_sql_node, so please see non_sql_node for some of the issues for this node type.

rsummary_node(
  source,
  ...,
  quartiles = FALSE,
  tmp_name_source = wrapr::mk_tmp_name_source("sn"),
  temporary = TRUE
)

Arguments

source

incoming source (relop node or data.frame).

...

force later arguments to be by name

quartiles

logical, if TRUE add Q1 (25%), median (50%), Q3 (75%) quartiles.

tmp_name_source

wrapr::mk_tmp_name_source(), temporary name generator.

temporary

logical, if TRUE use temporary tables

Value

rsummary node

See also

Examples

if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) { d <- data.frame(p= c(TRUE, FALSE, NA), s= NA, w= 1:3, x= c(NA,2,3), y= factor(c(3,5,NA)), z= c('a',NA,'a'), stringsAsFactors=FALSE) db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") RSQLite::initExtension(db) rq_copy_to(db, "dRemote", d, overwrite = TRUE, temporary = TRUE) ops <- db_td(db, "dRemote") %.>% extend(., v %:=% ifelse(x>2, "x", "y")) %.>% rsummary_node(.) cat(format(ops)) print(to_sql(ops, db)) reshdl <- materialize(db, ops) print(DBI::dbGetQuery(db, to_sql(reshdl, db))) DBI::dbDisconnect(db) }
#> mk_td("dRemote", c( #> "p", #> "s", #> "w", #> "x", #> "y", #> "z")) %.>% #> extend(., #> v := ifelse(x > 2, "x", "y")) %.>% #> non_sql_node(., rsummary_node(.)) #> [[1]] #> [1] "CREATE TEMPORARY TABLE `sn_78423848310883927581_0000000000` AS SELECT\n `p`,\n `s`,\n `w`,\n `x`,\n `y`,\n `z`,\n ( CASE WHEN ( `x` > 2 ) THEN ( 'x' ) WHEN NOT ( `x` > 2 ) THEN ( 'y' ) ELSE NULL END ) AS `v`\n FROM (\n SELECT\n `p`,\n `s`,\n `w`,\n `x`,\n `y`,\n `z`\n FROM\n `dRemote`\n ) tsql_21419932143980659800_0000000000\n" #> #> [[2]] #> [1] "non SQL step: rsummary_node(.)" #> #> [[3]] #> [1] " SELECT\n `column`,\n `index`,\n `class`,\n `nrows`,\n `nna`,\n `nunique`,\n `min`,\n `max`,\n `mean`,\n `sd`,\n `lexmin`,\n `lexmax`\n FROM\n `sn_78423848310883927581_0000000001`\n" #> #> column index class nrows nna nunique min max mean sd lexmin lexmax #> 1 p 1 integer 3 1 NA 0 1 0.5 0.7071068 <NA> <NA> #> 2 s 2 integer 3 3 0 NA NA NA NA <NA> <NA> #> 3 w 3 integer 3 0 NA 1 3 2.0 1.0000000 <NA> <NA> #> 4 x 4 numeric 3 1 NA 2 3 2.5 0.7071068 <NA> <NA> #> 5 y 5 character 3 1 2 NA NA NA NA 3 5 #> 6 z 6 character 3 1 1 NA NA NA NA a a #> 7 v 7 logical 3 1 2 0 0 0.0 0.0000000 FALSE FALSE