I have a data.frame in R which its columns are named L1, L2, L3, etc. but in a given iteration I am given randomly a data.frame with columns as the following one.
L1,L3,L5
0.0000000,0.7142857,0.2857143
0.1052632,0.8947368,0.0000000
1.0000000,0.0000000,0.0000000
0.0000000,1.0000000,0.0000000
0.0000000,0.0000000,1.0000000
1.0000000,0.0000000,0.0000000
I need a create one with the same number of columns and number with columns name ordered consequently as shown below. The added columns L2, L4, and L6 must be filled with 0.
L1,L2,L3,L4,L5,L6
0.0000000,0.0,0.7142857,0.0,0.2857143,0.0
0.1052632,0.0,0.8947368,0.0,0.0000000,0.0
1.0000000,0.0,0.0000000,0.0,0.0000000,0.0
0.0000000,0.0,1.0000000,0.0,0.0000000,0.0
0.0000000,0.0,0.0000000,0.0,1.0000000,0.0
1.0000000,0.0,0.0000000,0.0,0.0000000,0.0