squishList {PAMmisc} | R Documentation |
Compress a List by Name
Description
Attempts to compress a list by combining elements with the same name, searching recursively if there are lists in your list
Usage
squishList(myList, unique = FALSE)
Arguments
myList |
a list with named elements to be compressed |
unique |
logical flag to try and reduce result to only unique values |
Details
items with the same name are assumed to have the same structure
and will be combined. Dataframes will be combined with bind_rows, vectors
just be collapsed into one vector, matrices will be combined with rbind,
lists will be combined recursively with another call to squishList
Value
a list with one element for every unique name in the original list
Author(s)
Taiki Sakai taiki.sakai@noaa.gov
Examples
myList <- list(a=1:3, b=letters[1:4], a=5:6, b=letters[4:10])
squishList(myList)
myList <- list(a=1:3, b=data.frame(x=1:3, y=4:6), b=data.frame(x=10:14, y=1:5))
squishList(myList)
myList <- list(a=list(c=1:2, d=2), b=letters[1:3], a=list(c=4:5, d=6:9))
squishList(myList)
[Package PAMmisc version 1.12.1 Index]