Learn R Programming

rquery (version 0.5.0)

doubleapply: Double apply pipe to local data frame.

Description

Defined as roughly : rquery::rquery_apply_to_data_frame(d %.>% ops). Useful for systems like rquery where first appearance of an object captures a description and second appearance applies the operation.

Usage

d %>>% ops

Arguments

d

data.frame.

ops

free-form op tree.

Value

rquery::rquery_apply_to_data_frame(d %.>% ops)

Details

Note: to make this usefull one must parenthesize the pipeline that are piping into to. This is to work around left to right associativity. Please see the example for how this is done.

Examples

Run this code
# NOT RUN {
# WARNING: example tries to change rquery.rquery_db_executor option to RSQLite and back.
if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
  my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
  old_o <- options(list("rquery.rquery_db_executor" = list(db = my_db)))

  data.frame(AUC = c(0.6, 0.45), R2 = c(0.2, 0.01)) %>>% (
    extend_se(., c("v" %:=% "AUC + R2", "x" %:=% "pmax(AUC,v)")) %.>%
    select_rows_nse(., x > 0.5) ) %.>%
    print(.)

  options(old_o)
  DBI::dbDisconnect(my_db)
}




# }

Run the code above in your browser using DataLab