grouped_calculations: Grouped Calculations

Description Usage Arguments Value Examples

Description

Each of these functions first group the data using dplyr::group_by() and then:

The respective output is ungrouped.

Usage

1
2
3
4
5
6
7
8
9
mutate_groups(.data, .groups, ...)

summarise_groups(.data, .groups, ...)

summarize_groups(.data, .groups, ...)

transmute_groups(.data, .groups, ...)

arrange_groups(.data, .groups, ...)

Arguments

.data

A tbl_spark or a data.frame.

.groups

character(n). The columns to group by.

...

Arguments to pass onto the respective function.

Value

A tbl_spark or a data.frame depending on the input, .data.

Examples

1
2
3
4
5
6
7
8
mtcars %>%
  mutate_groups(.groups = c("am", "cyl"), avgMpg = mean(mpg))
mtcars %>%
  summarise_groups(.groups = c("am", "cyl"), avgMpg = mean(mpg))

# Additional arguments can still be passed to the dplyr functions
mtcars %>%
  mutate_groups(.groups = "am", avgMpg = mean(mpg), .before = mpg)

nathaneastwood/sparkplugs documentation built on Feb. 28, 2021, 4:57 p.m.