Hi,
I have a data frame with hundreds of rows and 4 columns. I re-created a small sample. I'm looking to get all the unique combinations per row into a data frame of two columns as shown in df_want
Thank you in advance
library(tidyverse)
# data
df <- tibble(
p1 = c("A", "D"),
p2 = c("B", "E"),
p3 = c("C", "F"),
p4 = c("D", "A")
)
# unique combinations of df by row
df_want <- tibble(
player = c("A", "A", "A",
"B", "B", "C",
"D", "D", "D",
"E", "E", "F"),
partner = c("B", "C", "D",
"C", "D", "D",
"E", "F", "A",
"F", "A", "A")
)