In some cases one needs to unlist a deeply nested list by certain times to make a less nested list in which the first level is reasonably equal to others. For example,
To unlist to the third level, one needs to unlist it with recursive = FALSE twice.
x %>>% unlist(recursive = FALSE) %>>% unlist(recursive = FALSE)
which produces a list with following structure
List of 6
$ a1.x1.y1:List of 2
..$ name : chr "name1"
..$ value: int [1:3] 1 2 3
$ a1.x1.y2:List of 2
..$ name : chr "name2"
..$ value: int [1:3] 2 3 5
$ a1.x2.y2:List of 2
..$ name : chr "name3"
..$ value: int [1:3] 0 0 1
$ a2.m1.y1:List of 2
..$ name : chr "name4"
..$ value: int [1:3] 1 4 2
$ a2.m1.y2:List of 2
..$ name : chr "name5"
..$ value: int [1:3] 0 1 0
$ a2.m2.y3:List of 2
..$ name : chr "name6"
..$ value: int [1:3] 0 1 1
which is desired.
Implement a function in rlist to perform unlist recursively.
In some cases one needs to
unlist
a deeply nested list by certain times to make a less nested list in which the first level is reasonably equal to others. For example,unlist
this data directly will result inTo unlist to the third level, one needs to
unlist
it withrecursive = FALSE
twice.which produces a list with following structure
which is desired.
Implement a function in rlist to perform
unlist
recursively.