split_and_key: split_and_key

View source: R/wrangling-fcns.R

split_and_keyR Documentation

split_and_key

Description

Like group_split but uses grouping cols to form identifiers and uses these as names for elements of split df. A broader purpose fcn that I may move elsewhere at some point. Some surprise/discussion that this functionality isn't already built into dplyr: https://stackoverflow.com/questions/57107721/how-to-name-the-list-of-the-group-split-output-in-dplyr

Usage

split_and_key(x, .cols)

Arguments

x

object that inherits data.frame

cols

a character vector of columns to split/groupby. Concatenation of these column names, separated by "-" will form the name for each resulting df after split.

Details

Reminder that a nest/unnest workflow is often better in most cases, rather than splitting


kmcd39/taux documentation built on Jan. 29, 2024, 11:45 p.m.