I have an array like this:
, , 1 [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 , , 2 [,1] [,2] [,3] [1,] 10 13 16 [2,] 11 14 17 [3,] 12 15 18 , , 3 [,1] [,2] [,3] [1,] 19 22 25 [2,] 20 23 26 [3,] 21 24 27
And I would like to add a column for each component populated with 0 to finally get the following:
, , 1 [,1] [,2] [,3] [,4] [1,] 1 4 7 0 [2,] 2 5 8 0 [3,] 3 6 9 0 , , 2 [,1] [,2] [,3] [,4] [1,] 10 13 16 0 [2,] 11 14 17 0 [3,] 12 15 18 0 , , 3 [,1] [,2] [,3] [,4] [1,] 19 22 25 0 [2,] 20 23 26 0 [3,] 21 24 27 0
Is there an easy way to do this using R?