select_rows: Make a select rows node.

Description Usage Arguments Value Examples

View source: R/select_rows.R

Description

Supports bquote() .()-style name abstraction (please see here: https://github.com/WinVector/rquery/blob/master/Examples/Substitution/Substitution.md).

Usage

1
2
3

Arguments

source

source to select from.

expr

expression to select rows.

env

environment to look to.

Value

select rows node.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
  my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
  d <- rq_copy_to(my_db, 'd',
                   data.frame(AUC = 0.6, R2 = 0.2, z = 3))
  TARGETCOL = as.name("AUC")
  optree <- select_rows(d, .(TARGETCOL) >= 0.5) %.>%
    select_columns(., "R2")
  cat(format(optree))
  sql <- to_sql(optree, my_db)
  cat(sql)
  print(DBI::dbGetQuery(my_db, sql))
  DBI::dbDisconnect(my_db)
}

WinVector/rquery documentation built on Dec. 8, 2019, 3:51 a.m.