Convert data frame of N columns into a data frame of two 'stacked' columns
Hello Stack Community. I am doing work with network analytics and have a data reshaping question. My original data comes in as a series of columns each column being a "source" and "target" pair. The final data frame needs to be made up of two columns "source" and "target". Note these pairs are staggered as they source and targets are linked as in a directed network. (See the final_output in the code example for desired output) I created a very hacky method producing the output I need (see code below) but it does not accommodate differing numbers of columns without me adding variables and