I've got a group of 12 lists that forms a vector represented by data of one specific year (each month is represented by one list).
I would like to know how to split this group of lists in 12 lists, one for each month of the year.
I've got a group of 12 lists that forms a vector represented by data of one specific year (each month is represented by one list).
I would like to know how to split this group of lists in 12 lists, one for each month of the year.
Suppose you have a list of lists, and each element is named:
ll <- list(jan = list(1:3),
feb = list(4:6),
mar = list(7:9))
ls()
# [1] "ll"
You can use list2env
to assign the list components into the global environment:
list2env(ll, globalenv())
ls()
# [1] "feb" "jan" "ll" "mar"
jan
# [[1]]
# [1] 1 2 3