Hello, this initially seemed to me like a pretty simple thing to do with rbind/cbind but did not manage to do it without looping. I have a simple data frame such as x: x<-cbind(c(1,2),c(3,4)) > x [,1] [,2] [1,] 1 3 [2,] 2 4 And a longer data frame, such as y: > y<-cbind(c(11,12,13,14,15,16),c(21,22,23,24,25,26)) > y [,1] [,2] [1,] 11 21 [2,] 12 22 [3,] 13 23 [4,] 14 24 [5,] 15 25 [6,] 16 26
I would like to merge them like this: [,1] [,2] [,3] [,4] [1,] 1 3 11 21 [2,] 2 4 12 22 [3,] 1 3 13 23 [4,] 2 4 14 24 [5,] 1 3 15 25 [6,] 2 4 16 26 (ie by repeating the short frame as many times as necessary (a known number) and inserting it before the y columns. The need to not loop comes from the large number of times it would have to be repeated(thousands) before merged with another table of the longer, new length. Any ideas? Thank you, Yannis Tzamouranis I tried lengthening x (as then merging them would be easy through cbind) but could not do it without looping. I wonder if there would be another way to go about this... [[alternative HTML version deleted]]
_______________________________________________ R-SIG-GUI mailing list R-SIG-GUI@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui