Note: must keep at least one column.
drop_columns(source, drops, ..., strict = FALSE, env = parent.frame())
source | source to drop columns from. |
---|---|
drops | list of distinct column names. |
... | force later arguments to bind by name |
strict | logical, if TRUE do check columns to be dropped are actually present. |
env | environment to look to. |
drop columns node.
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)) optree <- drop_columns(d, 'AUC') cat(format(optree)) sql <- to_sql(optree, my_db) cat(sql) print(DBI::dbGetQuery(my_db, sql)) DBI::dbDisconnect(my_db) }#> mk_td("d", c( #> "AUC", #> "R2")) %.>% #> drop_columns(., #> c('AUC')) #> SELECT #> `R2` #> FROM ( #> SELECT #> `R2` #> FROM #> `d` #> ) tsql_95055157526764533838_0000000000 #> R2 #> 1 0.2