This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(purrr) | |
library(rrapply) | |
# Split a data frame into a nested list using a different column for each level. | |
# This uses rrapply::rrapply() to avoid having to do any nested loops (map, lapply, | |
# for loop, whatever). | |
# Nested lists can be useful for avoiding searching through your data: the data | |
# has already been indexed in the list. This can be pretty handy for saving time | |
# if you need to do lots of filtering stuff. |