I want to split the row wise pairs to column wise. merge or melt functions did not work. For instance, my dataset is like,
dt<-data.frame(ID=c(123,125), AgeX=c(23,30), AgeY=c(46,28))
and the expected result will have 2 columns in this example.
dt<-data.frame(ID=c(123,123,125,125), AgeX=c(23,46,30, 28))