I'm sorry but I can't find a way to replace every 0 in a 3-dimension array by the mean of the column they are in.
Thanks. So, for example, let's say I have this array j
j
, , 1
[,1] [,2]
[1,] 0 6
[2,] 1 5
[3,] 2 2
, , 2
[,1] [,2]
[1,] 11 0
[2,] 14 12
[3,] 0 14
, , 3
[,1] [,2]
[1,] 19 22
[2,] 20 23
[3,] 21 24
I would like
j
, , 1
[,1] [,2]
[1,] 1 6
[2,] 1 5
[3,] 2 2
, , 2
[,1] [,2]
[1,] 11 26/3
[2,] 14 12
[3,] 25/3 14
, , 3
[,1] [,2]
[1,] 19 22
[2,] 20 23
[3,] 21 24