I am looking to combine two nested lists. Both lists contain the same amount of sublists. Sublists in both lists are associated in pairs with the same index number, i.e. values in list1$'1' are associated with descriptions in list2$'1'. Order of values in sublists of list1 corresponds to order in sublist in list2 of same index number. I would like to combine those two lists into one table with all categories as columns and the sublist index number as rows.
List1: values
$`1`
[1] "1.0"
$`8`
[1] "1.0"
$`13`
[1] "1.0"
$`2`
[1] "1.0"
$`39`
[1] "6.79E-4" "2.26E-4" "0.99" "1.13E-4"
List2: description
$`1`
[1] "TypeA"
$`8`
[1] "TypeA"
$`13`
[1] "TypeJ"
$`2`
[1] "TypeH"
$`39`
[1] "TypeE" "TypeG" "TypeD" "TypeA"
Desired result:
No TypeA TypeD TypeE TypeG TypeH TypeJ
1 1.0 0 0 0 0 0
8 1.0 0 0 0 0 0
13 0 0 0 0 0 1.0
2 0 0 0 0 1.0 0
39 1.13E-4 0.99 6.79E-4 2.26E-4 0 0
Thanks for any advice!