This is a method for the dplyr summarise() generic. It generates the SELECT clause of the SQL query, and generally needs to be combined with group_by().

# S3 method for tbl_lazy
summarise(.data, ...)

Arguments

.data

A lazy data frame backed by a database query.

...

<data-masking> Variables, or functions or variables. Use desc() to sort a variable in descending order.

Value

Another tbl_lazy. Use show_query() to see the generated query, and use collect() to execute the query and return data to R.

Examples

library(dplyr, warn.conflicts = FALSE) db <- memdb_frame(g = c(1, 1, 1, 2, 2), x = c(4, 3, 6, 9, 2)) db %>% summarise(n()) %>% show_query()
#> <SQL> #> SELECT COUNT(*) AS `n()` #> FROM `dbplyr_018`
db %>% group_by(g) %>% summarise(n()) %>% show_query()
#> <SQL> #> SELECT `g`, COUNT(*) AS `n()` #> FROM `dbplyr_018` #> GROUP BY `g`