Permalink
Cannot retrieve contributors at this time
28 lines (24 sloc)
560 Bytes
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' @export | |
| distinct.tbl_lazy <- function(.data, ..., .keep_all = FALSE) { | |
| if (dots_n(...) > 0) { | |
| if (.keep_all) { | |
| stop( | |
| "Can only find distinct value of specified columns if .keep_all is FALSE", | |
| call. = FALSE | |
| ) | |
| } | |
| .data <- transmute(.data, ...) | |
| } | |
| add_op_single("distinct", .data, dots = list()) | |
| } | |
| #' @export | |
| op_vars.op_distinct <- function(op) { | |
| c(op_grps(op$x), op_vars(op$x)) | |
| } | |
| #' @export | |
| sql_build.op_distinct <- function(op, con, ...) { | |
| select_query( | |
| sql_build(op$x, con), | |
| distinct = TRUE | |
| ) | |
| } |