Skip to content
Prev 326833 / 398502 Next

Matrix column flip when recycled

Dear list,

I have a matrix M.1 (30x2) into which I would like to paste another matrix M.2 (10x2) three times. However, the columns get flipped in every odd-numbered recycle run. How can I avoid this behavior?

M.1 <- matrix(numeric(30*2), ncol = 2)
M.2 <- t(combn(1:5, 2))
M.1[, 1:2] <- M.2

Many thanks for help,

Alrik