group_split: Split data frame by groups

View source: R/group_split.R

group_splitR Documentation

Split data frame by groups

Description

Split data frame by groups. Returns a list.

Usage

group_split(.df, ..., .keep = TRUE, .named = FALSE)

Arguments

.df

A data.frame or data.table

...

Columns to group and split by. tidyselect compatible.

.keep

Should the grouping columns be kept

.named

experimental: Should the list be named with labels that identify the group

Examples

df <- tidytable(
  a = 1:3,
  b = 1:3,
  c = c("a", "a", "b"),
  d = c("a", "a", "b")
)

df %>%
  group_split(c, d)

df %>%
  group_split(c, d, .keep = FALSE)

df %>%
  group_split(c, d, .named = TRUE)

mtfairbanks/gdt documentation built on April 12, 2024, 6:51 p.m.