Hello,
I have a matrix such as

> X = matrix(c(1:4,29,32,56,-45), ncol=2)

and I want one like

> Y=matrix(c(
1 , 34 , 1 , 34 ,
2 , -56 , 1 , 34 ,
3 , 27 , 1 , 34 ,
1 , 34 , 2 , -56 ,
2 , -56 , 2 , -56 ,
3 , 27 , 2 , -56 ,
1 , 34 , 3 , 27 ,
2 , -56 , 3 , 27 ,
3 , 27 , 3 , 27 ), ncol=4, byrow=T)

How do I do this in an efficient and elegant way?

Many thanks,
Dimitri

	[[alternative HTML version deleted]]


