groupMutate | R Documentation |
Some databases don't support window functions over grouped data. This requires a workaround to group and summarise then join the data. All database seem to support group_by(...) and then mutate(x = sum(...)) but not all will do group_by(...) and then mutate(x = mean(...)) for example.
groupMutate(df, ...)
df |
- a df which may be a dbplyr table |
... |
- the contents of the mutuate function |
Ranking functions all seem to work natively (including row_number)
* sum * row_number * rank * lead, lag
Aggregation on the other hand functions are variably supported by the default mutate depending on the database
* mean * sd * min * max
groupMutate allows any window functions to be applied to any database but using an intermediate table
a dbplyr dataframe containing the grouped function
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.