cur_group_id.: Current group context

Description Usage Examples

View source: R/cur_group.R

Description

These functions give information about the "current" group.

Can be used inside summarize.(), mutate.(), & filter.()

Usage

1
2
3

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
test_df <- data.table(
  x = 1:5,
  y = c("a", "a", "a", "b", "b")
)

test_df %>%
  mutate.(group_id = cur_group_id.(),
          .by = y)

test_df %>%
  mutate.(group_rows = cur_group_rows.(),
          .by = y)

mtfairbanks/gdt documentation built on June 21, 2021, 12:47 p.m.