I have a dataframe that I want to make the column names categorical variables.
  topic1 topic2 topic3
1  apple  volvo toyota
2   pear    bwm   audi
3  apple    bmw    bmw
4 orange  volvo   benz
5 orange   fiat   fiat
I want topic1...3 to be become categorical variables like below and collapse the rows to a single column:
     name  terms
1  topic1  apple
2  topic1   pear
3  topic1  apple
4  topic1 orange
5  topic1 orange
6  topic2  volvo
7  topic2    bwm
8  topic2    bmw
9  topic2  volvo
10 topic2   fiat
11 topic3 toyota
12 topic3   audi
13 topic3    bmw
14 topic3   benz
15 topic3   fiat
 
     
     
    