View source: R/ex_data_frame.R
apply_right.relop | R Documentation |
Execute pipeline treating pipe_left_arg as local data to be copied into database.
## S3 method for class 'relop'
apply_right(
pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name
)
pipe_left_arg |
left argument. |
pipe_right_arg |
pipe_right_arg argument. |
pipe_environment |
environment to evaluate in. |
left_arg_name |
name, if not NULL name of left argument. |
pipe_string |
character, name of pipe operator. |
right_arg_name |
name, if not NULL name of right argument. |
data.frame
rquery_apply_to_data_frame
# WARNING: example tries to change rquery.rquery_db_executor option to RSQLite and back.
if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
# set up example database and
# db execution helper
db <- DBI::dbConnect(RSQLite::SQLite(),
":memory:")
RSQLite::initExtension(db)
old_o <- options(list("rquery.rquery_db_executor" = list(db = db)))
# operations pipeline/tree
optree <- mk_td("d", "x") %.>%
extend(., y = x*x)
# wrapr dot pipe apply_right dispatch
# causes this statment to apply optree
# to d.
data.frame(x = 1:3) %.>% optree %.>% print(.)
# remote example
rq_copy_to(db, "d",
data.frame(x = 7:8),
overwrite = TRUE,
temporary = TRUE)
# wrapr dot pipe apply_right dispatch
# causes this statment to apply optree
# to db.
db %.>% optree %.>% print(.)
# clean up
options(old_o)
DBI::dbDisconnect(db)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.