I have a dataframe,
L-1 L-1-1 L-1-2 L-1-3 L-2 L-2-1 L-2-2 L-2-3
L-1 0 0 0 0 0 0 0 0
L-1-1 0 0 0 0 0 0 0 0
L-1-2 0 0 0 0 0 0 0 0
L-1-3 0 0 0 0 0 0 0 0
L-2 0 0 0 0 0 0 0 0
L-2-1 0 0 0 0 0 0 0 0
L-2-2 0 0 0 0 0 0 0 0
L-2-3 0 0 0 0 0 0 0 0
I want to fill 1's in each cell with inclusive relationships of rows and columns
The output will be
L-1 L-1-1 L-1-2 L-1-3 L-2 L-2-1 L-2-2 L-2-3
L-1 1 1 1 1 0 0 0 0
L-1-1 0 1 0 0 0 0 0 0
L-1-2 0 0 1 0 0 0 0 0
L-1-3 0 0 0 1 0 0 0 0
L-2 0 0 0 0 1 1 1 1
L-2-1 0 0 0 0 0 1 0 0
L-2-2 0 0 0 0 0 0 1 0
L-2-3 0 0 0 0 0 0 0 1
For example,
The string "L-1" includes "L-1" so the cell (1,1) will be 1.
The string "L1-1-1" includes "L-1" so the cell (1,2) will be 1.
The string "L-2-1" doesn't include "L-1" so the cell (1,6) will be 0.
and so on.