Description Usage Arguments Examples
Uses very generic dplyr code to aggregate data. Because of this approach, the calculations automatically run inside the database if 'data' has a database or sparklyr connection. The 'class()' of such tables in R are: tbl_sql, tbl_dbi, tbl_sql
1 | db_compute_count(data, x, ..., y = n())
|
data |
A table (tbl) |
x |
A discrete variable |
... |
A set of named or unamed aggregations |
y |
The aggregation formula. Defaults to count (n) |
1 2 3 4 5 6 7 8 9 10 11 | # Returns the row count per am
mtcars %>%
db_compute_count(am)
# Returns the average mpg per am
mtcars %>%
db_compute_count(am, mean(mpg))
# Returns the average and sum of mpg per am
mtcars %>%
db_compute_count(am, mean(mpg), sum(mpg))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.