groupMutate: Execute a mutate function on grouped data in all databases

View source: R/dbplyHelper.R

groupMutateR Documentation

Execute a mutate function on grouped data in all databases

Description

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.

Usage

groupMutate(df, ...)

Arguments

df

- a df which may be a dbplyr table

...

- the contents of the mutuate function

Details

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

Value

a dbplyr dataframe containing the grouped function


terminological/tidy-info-stats documentation built on Nov. 19, 2022, 11:23 p.m.