Hey fellas,
I've posted this problem a few days back and I received just one post which was in PHP that I have no idea about! (Thanks to DGPickett) It would be so nice if you can help me with this in Shell or Perl. Here is the story:
I have a big table with variables and observations. I managed to simplify the data to I/O so now it's something looks like this:
* 1 2 3 4 5 6 7 8 9 10 |
A 1 0 0 1 0 0 1 0 1 1 |
B 1 1 1 1 0 0 1 0 0 0 |
C 1 1 0 1 0 1 0 1 1 0 |
D 0 0 0 1 1 1 1 0 0 0 |
E 1 1 0 0 1 1 0 0 1 1 |
What I like to find out is the co-presence of the variables. The script has to read the table in a loop which in each round check one row with all the others (including itself). While checking 2 rows write the number of times there is number 1 for both in the same column.
Simply, it starts from row A and first check it with itself (since the first row is A!). The returning number would be the times that we have "1" in A. Then by checking row A and B it returns number of columns in which we have "1" for A and B. Like this it goes until the end of the table and writes the results to the first row of the output.
Then the output would be a table with variables as both rows and columns containing the co-presence of them based on the calculations.
It is a cool problem that I unfortunately don't have enough knowledge to solve it. If you have knowledge and time, you're a lifesaver.
Thanks for reading even if you are not going to help!