I have a matrix which is made up of 4 columns (i.e. column 1, column 2, column 3 and column 4)
V1 V2 V3 V4
1 1 1 1 1
2 1 1 1 1
3 1 -1 -1 -1
4 1 -1 -1 -1
5 2 1 1 -1
6 2 1 1 -1
7 2 -1 -1 1
8 2 -1 -1 1
9 3 1 -1 1
10 3 1 -1 1
11 3 -1 1 -1
12 3 -1 1 -1
13 4 1 -1 -1
14 4 1 -1 -1
15 4 -1 1 1
16 4 -1 1 1
My question is: I want to use this 4 columns to get a new matrix which has 15 columns. And these 15 columns are:
1, 2, 3, 4, 12, 13, 14, 23, 24, 34, 123, 124, 134, 234, 1234.
Here I use 12 to represent column 1 * column 2
So 1234 = column 1 * column 2 * column 3 * column 4
.
Does anyone have some simple pieces of code to do this? Thanks for everyone's help.