I have a data frame (2 columns: Text and HD/TTL) in the format below:
Text HD/TTL
ABC HD
DEF
GHI HD
JKL
MNO
PQR HD
I want it transformed into a new data frame (with 2 columns: HD and Text) as:
HD Text
HD ABC\nDEF
HD GHI\nJKL\nMNO
HD PQR\n
where \n is the new line between the text. How can I go about it?