powered by
This is a method for the dplyr distinct() generic. It adds the DISTINCT clause to the SQL query.
distinct()
DISTINCT
# S3 method for tbl_lazy distinct(.data, ..., .keep_all = FALSE)
Another tbl_lazy. Use show_query() to see the generated query, and use collect() to execute the query and return data to R.
tbl_lazy
show_query()
collect()
A lazy data frame backed by a database query.
<data-masking> Variables, or functions of variables. Use desc() to sort a variable in descending order.
data-masking
desc()
If TRUE, keep all variables in .data. If a combination of ... is not distinct, this keeps the first row of values.
TRUE
.data
...
library(dplyr, warn.conflicts = FALSE) db <- memdb_frame(x = c(1, 1, 2, 2), y = c(1, 2, 1, 1)) db %>% distinct() %>% show_query() db %>% distinct(x) %>% show_query()
Run the code above in your browser using DataLab