select.tbl_lazy {dbplyr} | R Documentation |
Subset, rename, and reorder columns using their names
Description
These are methods for the dplyr select()
, rename()
, and relocate()
generics. They generate the SELECT
clause of the SQL query.
These functions do not support predicate functions, i.e. you can
not use where(is.numeric)
to select all numeric variables.
Usage
## S3 method for class 'tbl_lazy'
select(.data, ...)
## S3 method for class 'tbl_lazy'
rename(.data, ...)
## S3 method for class 'tbl_lazy'
rename_with(.data, .fn, .cols = everything(), ...)
## S3 method for class 'tbl_lazy'
relocate(.data, ..., .before = NULL, .after = NULL)
Arguments
.data |
A lazy data frame backed by a database query. |
... |
< |
.fn |
A function used to transform the selected |
.cols |
< |
.before , .after |
< |
Examples
library(dplyr, warn.conflicts = FALSE)
db <- memdb_frame(x = 1, y = 2, z = 3)
db %>% select(-y) %>% show_query()
db %>% relocate(z) %>% show_query()
db %>% rename(first = x, last = z) %>% show_query()
[Package dbplyr version 2.5.0 Index]