split_by_group: Split a ds/y/group tibble into one tibble per group

View source: R/grouping_utils.R

split_by_groupR Documentation

Split a ds/y/group tibble into one tibble per group

Description

Split a ds/y/group tibble into one tibble per group

Usage

split_by_group(df, group_col)

Arguments

df

A data frame with ds, y, and group_col columns.

group_col

Character scalar, the grouping column's name, or NULL (returns NULL – no grouping).

Value

A named list of ds/y tibbles, one per distinct value of group_col (names sorted), or NULL if group_col is NULL or not present in df.

Examples

df <- data.frame(ds = as.Date("2024-01-01") + 0:3,
                  y = 1:4, District = c("A", "A", "B", "B"))
split_by_group(df, "District")

forecastsuite documentation built on Oct. 18, 2026, 5:08 p.m.