Let I have two lists(list1 and list2) where each elements are data frame:
list1[1]
col1 col2
12 3
9 5
list1[2]
col1 col2
4 11
10 7
list2[1]
col1 col2
b b
b a
list1[2]
col1 col2
a b
b a
Desired output list3 is:
list3[1]
col1 col2
0 5
0 0
list3[2]
col1 col2
4 7
0 0
Namely, in list3,
i'th data frame is equal to values of i'th data frame in list1 conditional to i'th data frame in list2 equals to "a".
However, if element list2 is not equal to "b", 0 added end of each column of related each data frame in list3.
How can I do that uisng R? I will be very glad for any help. Thanks a lot.