Convert a set of data frame variables into keys of a nested list

iteratively_split_df(
  x,
  variables = {
     head(colnames(x), n = -1)
 },
  f,
  ...
)

Arguments

x

data.frame to split

variables

An ordered character vector of variables in x that will be nested levels of the output list

f

A function applied to the data frame, once all variables have been used

...

Arguments passed to f

Value

A nested list

Details

May assume that every combination of variables produces a data frame to which f can be applied.