I have two vectors x and y. I would like to get a new vector z which is a vector. In first iteration , the first element is form vector y and the rest is the third elemnt until the end of vector x, and in the second iteration the second element is from vector y and the rest is from vector x (the first, fourth, fifth, … of vector x), …
For example, these vectors are as follows:
x = c(1, 3, 5, 6, 8)
y = c(2, 4, 56, 77)
> z
[,1] [,2] [,3] [,4]
[1,] 2 5 6 8
[2,] 1 4 6 8
[3,] 1 3 56 8
[4,] 1 3 5 77
Writing a function that will do th
eg