R/ex_data_frame.R
apply_right.relop.Rd
Execute pipeline treating pipe_left_arg as local data to be copied into database.
# S3 method for relop
apply_right(
pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name
)
left argument.
pipe_right_arg argument.
environment to evaluate in.
name, if not NULL name of left argument.
character, name of pipe operator.
name, if not NULL name of right argument.
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)
}
#> x y
#> 1 1 1
#> 2 2 4
#> 3 3 9
#> x y
#> 1 7 49
#> 2 8 64