I want to convert this
> tab2
X ONE TWO THREE FOUR
1 ONE 1.00000000 0.7182953806 -0.0360738799 0.05865445
2 TWO 0.71829538 1.0000000000 -0.0004615852 -0.05088079
3 THREE -0.03607388 -0.0004615852 1.0000000000 0.72551871
4 FOUR 0.05865445 -0.0508807908 0.7255187058 1.00000000
to csv file with such data
ONE, ONE, 1.00000000
ONE, TWO, 0.7182953806
ONE, THREE, -0.0360738799
ONE, FOUR, 0.05865445
TWO, ONE, 0.71829538
TWO, TWO, 1.0000000000
TWO, TREE, -0.0004615852
...
How to do this with R?
P.S. Real data contains more than 100 columns and strings.