'Is there a way to turn a DataFrame/correlation matrix into a DataFrame with one column per cell combination?

I have a data frame that is 89x89 that I've turned into a correlation matrix using cor(). My question is if there is a way to turn each column-row pairing into its own column in a new data.frame that would have one row and all possible combinations of row-column pairs, each as its own column. For example:

    [1] [2] [3] [4] [5]
[1]  a   b   c   d   e
[2]  f   a   g   h   i
[3]  j   k   a   l   m
[4]  n   o   p   a   q
[5]  r   s   t   u   a

would turn into

[1][1] [1][2] [1][3] [1][4] [1][5] [2][1] [2][2] [2][3] [2][4] 
   a      f      j      n      r      b      a      k     o

and so on for the entire matrix, with [1][1] being the first column header and so on.

So far, I haven't been able to find a solution that does this. I've found solutions that turn each entry into its own row in a DataFrame, e.g.,

     col1 col2 col3
row1 [1]   [1]   a
row2 [1]   [2]   f
row3 [1]   [3]   j

which isn't exactly what I am looking for.

Hopefully I am overlooking a simple solution. Thanks for any help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source