Suppose that I have a matrix:
a=matrix(1:30,5)
I want to paste the columns 3 by 3 to get this result:
[,1] [,2]
[1,] "1 6 11" "16 21 26"
[2,] " 2 7 12" "17 22 27"
[3,] " 3 8 13" "18 23 28"
[4,] "4 9 14" "19 24 29"
[5,] " 5 10 15" " 20 25 30"
In fact, I require a function for a very big matrix.
For a simple example we can use whitin
and paste
(paste several column values into one value in R).