Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rsplit

Recursivly split a data.frame


Description

When there are multiple factors to split by, Base R split returns a flattened structure by splitting on the interaction of all factors. rsplit instead returns a nested list-of-lists.

Usage

rsplit(x, by, drop = FALSE)

Arguments

x

a data.frame or vector

by

a data.frame of factors

drop

drop unused factor levels

Value

a nested list of dataframes, split by each element of by

Inspired by, but different from the below

Author(s)

Neal Fultz

References


stackoverflow

Stack Overflow's Greatest Hits

v0.7.0
CC BY-SA 4.0
Authors
Neal Fultz <nfultz@gmail.com> and the StackOverflow.com community
Initial release
2020-01-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.