Supports bquote()
.()
-style name abstraction including .(-)
notation to promote strings to names (please see here: https://github.com/WinVector/rquery/blob/master/Examples/Substitution/Substitution.md).
project(source, ..., groupby = c(), env = parent.frame()) project_nse(source, ..., groupby = c(), env = parent.frame()) aggregate_nse(source, ..., groupby = c(), env = parent.frame())Arguments source
source to select from.
...new column assignment expressions.
groupbygrouping columns.
envenvironment to look for values in.
Valueproject node.
Examplesif (requireNamespace("DBI", quietly
= TRUE) && requireNamespace("RSQLite", quietly
= TRUE)) { my_db <- DBI::dbConnect(RSQLite::SQLite(),
":memory:") d <- rq_copy_to( my_db,
'd',
data.frame(group
= c('a',
'a',
'b',
'b'), val
= 1:4, stringsAsFactors
= FALSE)) op_tree <- d %.>% project(., groupby
= "group",
vmax %:=% max(val)) cat(format(op_tree)) sql <- to_sql(op_tree,
my_db) cat(sql) execute(my_db,
op_tree) %.>% print(.) op_tree <- d %.>% project(., groupby
= NULL,
vmax %:=% max(val)) cat(format(op_tree)) sql <- to_sql(op_tree,
my_db) cat(sql) execute(my_db,
op_tree) %.>% print(.) DBI::dbDisconnect(my_db) }#> mk_td("d", c( #> "group", #> "val")) %.>% #> project(., vmax := max(val), #> groupby = c('group')) #> SELECT `group`, max ( `val` ) AS `vmax` FROM ( #> SELECT #> `group`, #> `val` #> FROM #> `d` #> ) tsql_86188167191619545564_0000000000 #> GROUP BY #> `group` #> group vmax #> 1 a 2 #> 2 b 4 #> mk_td("d", c( #> "group", #> "val")) %.>% #> project(., vmax := max(val), #> groupby = c()) #> SELECT max ( `val` ) AS `vmax` FROM ( #> SELECT #> `val` #> FROM #> `d` #> ) tsql_06969961980534496516_0000000000 #> vmax #> 1 4
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4