I have a data frame with x variables and an id_number 1:n (n is large). I want to create a new data frame that horizontally merges each pair based on id_number from the data frame. Original data looks like this:
id_number var_x1 var_x2
1 sth stuff
2 other things
3 more info
I want to get this for every possible pair:
id_numberA var_x1A var_x2A id_numberB var_x1B var_x2B
1 sth stuff 1 sth stuff
1 sth stuff 2 other things
1 sth stuff 3 more info
2 other things 3 more info
What is the most efficient way to do this for a large dataset?