I have a bunch of datasets (the number is not defined) with the same column names and identified by the factor reported in the column "factor". I'd like to obtain all the multiple combinations of them. Here is reported what I'd like to obtain (for the example of 3 different datasets):
frame_x = data.frame(a=c(12,10,3), b=c(6,4,2), c=c(3,62,3),factor=c("x","x","x"))
frame_y = data.frame(a=c(2,13,34), b=c(22,13,36), c=c(22,13,34),factor=c("y","y","y"))
frame_z = data.frame(a=c(36,28,11), b=c(32,24,16), c=c(33,22,17),factor=c("z","z","z"))
frame_x_new = rbind(frame_x,frame_y,frame_z)
frame_x_new$factor = c("x","x","x","other","other","other","other","other","other")
frame_y_new = rbind(frame_y,frame_x,frame_z)
frame_y_new$factor = c("y","y","y","other","other","other","other","other","other")
frame_z_new = rbind(frame_z,frame_x,frame_y)
frame_z_new$factor = c("z","z","z","other","other","other","other","other","other")
frame_x<-frame_x_new
frame_y<-frame_y_new
frame_z<-frame_z_new
Here's what I'd like to obtain if I have 3 datasets, performing the combinations of x vs y+z, y vs x+z and z vs x+y combinations.
I'd like to have a loop doing this since I might have also a higher (eg. 4 datasets, where I'd like to have x vs y+z+w, etc) or a lower (e.g. 2 datasets, x vs y) number of data frames.
Thank you for your help.